File Makefile changed (mode: 100644) (index 1981637..e81c3db) |
... |
... |
CXXFLAGS += -Wall -Wextra -Werror |
9 |
9 |
CXXFLAGS += -fno-use-cxa-atexit -fno-builtin -fno-rtti -fno-exceptions |
CXXFLAGS += -fno-use-cxa-atexit -fno-builtin -fno-rtti -fno-exceptions |
10 |
10 |
CXXFLAGS += -fno-threadsafe-statics |
CXXFLAGS += -fno-threadsafe-statics |
11 |
11 |
ASFLAGS := -m32 |
ASFLAGS := -m32 |
12 |
|
LDFLAGS := -g -m32 -nostartfiles -nostdlib |
|
|
12 |
|
LINKFLAGS := -g -m32 -nostartfiles -nostdlib |
13 |
13 |
QEMUFLAGS := -netdev user,id=n0,hostfwd=udp::1234-:1234,hostfwd=tcp::1234-:1234 |
QEMUFLAGS := -netdev user,id=n0,hostfwd=udp::1234-:1234,hostfwd=tcp::1234-:1234 |
14 |
14 |
QEMUFLAGS += -device rtl8139,netdev=n0,mac=12:23:34:45:56:77 |
QEMUFLAGS += -device rtl8139,netdev=n0,mac=12:23:34:45:56:77 |
15 |
15 |
QEMUFLAGS += -drive file=./hda,index=0,media=disk,format=raw |
QEMUFLAGS += -drive file=./hda,index=0,media=disk,format=raw |
|
... |
... |
obj/%.o: src/%.S | $(dirs) |
38 |
38 |
$(AS) $(ASFLAGS) -c -o $@ $< |
$(AS) $(ASFLAGS) -c -o $@ $< |
39 |
39 |
|
|
40 |
40 |
kernel: linker.ld $(objects) |
kernel: linker.ld $(objects) |
41 |
|
$(LD) $(LDFLAGS) -Wl,-T $< -o $@ $(objects) |
|
|
41 |
|
$(CXX) $(LINKFLAGS) -Wl,-T $< -o $@ $(objects) |
42 |
42 |
|
|
43 |
43 |
$(dirs): |
$(dirs): |
44 |
44 |
mkdir -p $@ |
mkdir -p $@ |
File src/net/tcp.cpp changed (mode: 100644) (index 632b4e2..f301031) |
... |
... |
void |
197 |
197 |
TCPProvider::send(TCPSocket &socket, span<const std::uint8_t> buf, |
TCPProvider::send(TCPSocket &socket, span<const std::uint8_t> buf, |
198 |
198 |
TCPFlagsSubset flags) |
TCPFlagsSubset flags) |
199 |
199 |
{ |
{ |
200 |
|
uint16_t totalLength = buf.size() + TCPHeader::size(); |
|
201 |
|
uint16_t lengthInclPHdr = totalLength + TCPPseudoHeader::size(); |
|
|
200 |
|
std::uint16_t totalLength = buf.size() + TCPHeader::size(); |
|
201 |
|
std::uint16_t lengthInclPHdr = totalLength + TCPPseudoHeader::size(); |
202 |
202 |
|
|
203 |
203 |
std::unique_ptr<std::uint8_t[]> buffer(new std::uint8_t[lengthInclPHdr]); |
std::unique_ptr<std::uint8_t[]> buffer(new std::uint8_t[lengthInclPHdr]); |
204 |
204 |
|
|
205 |
205 |
TCPPseudoHeader phdr(buffer.get()); |
TCPPseudoHeader phdr(buffer.get()); |
206 |
206 |
TCPHeader tcpHdr(buffer.get() + TCPPseudoHeader::size()); |
TCPHeader tcpHdr(buffer.get() + TCPPseudoHeader::size()); |
207 |
|
uint8_t *payload = buffer.get() |
|
208 |
|
+ TCPHeader::size() |
|
209 |
|
+ TCPPseudoHeader::size(); |
|
|
207 |
|
std::uint8_t *payload = buffer.get() |
|
208 |
|
+ TCPHeader::size() |
|
209 |
|
+ TCPPseudoHeader::size(); |
210 |
210 |
|
|
211 |
211 |
tcpHdr.offsetAndReserved = |
tcpHdr.offsetAndReserved = |
212 |
212 |
netOrder(static_cast<std::uint8_t>(TCPHeader::size()/4 << 4)); |
netOrder(static_cast<std::uint8_t>(TCPHeader::size()/4 << 4)); |