From a950021011e41b7d4fd285dde278cf9b06f89574 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Wed, 20 Mar 2024 18:08:57 +0100 Subject: 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. --- kernel/network/tcp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'kernel/network') 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); -- cgit v1.2.3