summaryrefslogtreecommitdiff
path: root/kernel/network
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-03-20 18:08:57 +0100
committerAnton Kling <anton@kling.gg>2024-03-20 19:08:18 +0100
commita950021011e41b7d4fd285dde278cf9b06f89574 (patch)
tree1d88d00ac2f31d8d7c47dc84a954caea68c0b5f2 /kernel/network
parent553b43d2e563dcff74d4c86904fa3737e96d7365 (diff)
MMU: Fixed massive problem in assumption of RAM layout
This caused certain addreses which where not RAM memory to be assigned to virtual addresses incorrectly. This caused a significant slowdown when running it with KVM due to constantly having to exit the VM if the OS writes to memory that is not RAM. This fix increased the performance of KVM significantly and improved TCG performance.
Diffstat (limited to 'kernel/network')
-rw-r--r--kernel/network/tcp.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/kernel/network/tcp.c b/kernel/network/tcp.c
index b929005..dd6e6a8 100644
--- a/kernel/network/tcp.c
+++ b/kernel/network/tcp.c
@@ -162,12 +162,11 @@ void send_tcp_packet(struct TcpConnection *con, const u8 *payload,
void handle_tcp(ipv4_t src_ip, const u8 *payload, u32 payload_length) {
const struct TCP_HEADER *header = (const struct TCP_HEADER *)payload;
(void)header;
- u16 n_src_port = *(u16 *)(payload);
- u16 n_dst_port = *(u16 *)(payload + 2);
- u32 n_seq_num = *(u32 *)(payload + 4);
- u32 n_ack_num = *(u32 *)(payload + 8);
+ u16 n_src_port = header->src_port;
+ u16 n_dst_port = header->dst_port;
+ u32 n_seq_num = header->seq_num;
+ u32 n_ack_num = header->ack_num;
- // u8 flags = *(payload + 13);
u8 flags = header->flags;
u16 src_port = htons(n_src_port);