From 72f900e956c43cad48c1d59deb6c1718cfb33ceb Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Wed, 7 Aug 2013 13:13:29 +0000 Subject: [PATCH] new function: NET_packet_free, i8255x driver should not cause problems anymore. git-svn-id: svn://kolibrios.org@3861 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/network/ARP.inc | 2 +- kernel/trunk/network/IPv4.inc | 8 ++++---- kernel/trunk/network/PPPoE.inc | 6 +++--- kernel/trunk/network/ethernet.inc | 2 +- kernel/trunk/network/icmp.inc | 4 ++-- kernel/trunk/network/loopback.inc | 2 +- kernel/trunk/network/socket.inc | 4 ++-- kernel/trunk/network/stack.inc | 5 +++++ kernel/trunk/network/tcp_input.inc | 8 +++++--- kernel/trunk/network/udp.inc | 4 ++-- 10 files changed, 26 insertions(+), 19 deletions(-) diff --git a/kernel/trunk/network/ARP.inc b/kernel/trunk/network/ARP.inc index 6b126f309..0f149b6c3 100644 --- a/kernel/trunk/network/ARP.inc +++ b/kernel/trunk/network/ARP.inc @@ -293,7 +293,7 @@ ARP_input: DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_input: IP address conflict detected!\n" .exit: - call kernel_free + call NET_packet_free add esp, 4 ; pop (balance stack) DEBUGF DEBUG_NETWORK_VERBOSE, "ARP_input: exiting\n" diff --git a/kernel/trunk/network/IPv4.inc b/kernel/trunk/network/IPv4.inc index b827ad29c..ad17b1902 100644 --- a/kernel/trunk/network/IPv4.inc +++ b/kernel/trunk/network/IPv4.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; IPv4.INC ;; @@ -305,7 +305,7 @@ IPv4_input: ; TODO: add IPv4 .dump: DEBUGF DEBUG_NETWORK_VERBOSE, "IPv4_input: dumping\n" inc [IP_packets_dumped] ; FIXME: use correct interface - call kernel_free + call NET_packet_free add esp, 4 ; pop (balance stack) ret @@ -485,7 +485,7 @@ IPv4_input: ; TODO: add IPv4 push edx ; Push pointer to fragment onto stack mov ebx, [edx + FRAGMENT_entry.Owner] ; we need to remeber the owner, in case this is the last packet mov edx, [edx + FRAGMENT_entry.NextPtr] ; Set edx to the next pointer - call kernel_free ; free the previous fragment buffer (this uses the value from stack) + call NET_packet_free ; free the previous fragment buffer (this uses the value from stack) pop eax cmp edx, -1 ; Check if it is last fragment in chain jne .rebuild_packet_loop @@ -845,7 +845,7 @@ IPv4_fragment: add esp, 12 + 4 + 6 .err2: DEBUGF DEBUG_NETWORK_VERBOSE, "Ipv4_fragment: dumping\n" - call kernel_free + call NET_packet_free add esp, 4 ret diff --git a/kernel/trunk/network/PPPoE.inc b/kernel/trunk/network/PPPoE.inc index a552e03b3..8e33e1450 100644 --- a/kernel/trunk/network/PPPoE.inc +++ b/kernel/trunk/network/PPPoE.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2012. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2012-2013. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; PPPoE.INC ;; @@ -103,7 +103,7 @@ PPPoE_discovery_input: popa DEBUGF DEBUG_NETWORK_VERBOSE, 'PPPoE_discovery_input: dumping\n' - call kernel_free + call NET_packet_free add esp, 4 ret @@ -229,7 +229,7 @@ PPPoE_session_input: .dump: DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_input: dumping\n" - call kernel_free + call NET_packet_free add esp, 4 ret diff --git a/kernel/trunk/network/ethernet.inc b/kernel/trunk/network/ethernet.inc index 26dcb2d93..7177c79b2 100644 --- a/kernel/trunk/network/ethernet.inc +++ b/kernel/trunk/network/ethernet.inc @@ -82,7 +82,7 @@ ETH_input: .dump: DEBUGF DEBUG_NETWORK_VERBOSE,"ETH_input: dumping\n" - call kernel_free + call NET_packet_free add esp, 4 ret diff --git a/kernel/trunk/network/icmp.inc b/kernel/trunk/network/icmp.inc index a9080903a..b91e5f258 100644 --- a/kernel/trunk/network/icmp.inc +++ b/kernel/trunk/network/icmp.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2010. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; ICMP.INC ;; @@ -304,7 +304,7 @@ ICMP_input: .dump: DEBUGF DEBUG_NETWORK_VERBOSE, "ICMP_input: dumping\n" - call kernel_free + call NET_packet_free add esp, 4 ; pop (balance stack) ret diff --git a/kernel/trunk/network/loopback.inc b/kernel/trunk/network/loopback.inc index 9de8934af..8eb22d933 100644 --- a/kernel/trunk/network/loopback.inc +++ b/kernel/trunk/network/loopback.inc @@ -97,7 +97,7 @@ LOOP_input: .dump: DEBUGF DEBUG_NETWORK_VERBOSE, "LOOP_input: dumping\n" - call kernel_free + call NET_packet_free add esp, 4 ret diff --git a/kernel/trunk/network/socket.inc b/kernel/trunk/network/socket.inc index a871edc8c..8d33cd669 100644 --- a/kernel/trunk/network/socket.inc +++ b/kernel/trunk/network/socket.inc @@ -929,7 +929,7 @@ SOCKET_receive_dgram: rep movsd .nd: - call kernel_free ; free kernel buffer + call NET_packet_free pop eax ; return number of bytes copied to application xor ebx, ebx ret @@ -1568,7 +1568,7 @@ SOCKET_input: call mutex_unlock popa - call kernel_free + call NET_packet_free add esp, 8 ret diff --git a/kernel/trunk/network/stack.inc b/kernel/trunk/network/stack.inc index fd26d60cf..264e97b3f 100644 --- a/kernel/trunk/network/stack.inc +++ b/kernel/trunk/network/stack.inc @@ -316,6 +316,11 @@ stack_handler: ret +align 4 +NET_packet_free: + and dword[esp+4], not 0xfff + jmp kernel_free + align 4 NET_link_changed: diff --git a/kernel/trunk/network/tcp_input.inc b/kernel/trunk/network/tcp_input.inc index ff65dd889..1fc85c233 100644 --- a/kernel/trunk/network/tcp_input.inc +++ b/kernel/trunk/network/tcp_input.inc @@ -69,7 +69,7 @@ TCP_input: inc [TCP_segments_missed + edi] add esp, sizeof.TCP_queue_entry - 8 - call kernel_free + call NET_packet_free add esp, 4 ret @@ -1490,6 +1490,8 @@ align 4 .out_of_order: + DEBUGF DEBUG_NETWORK_VERBOSE, "TCP data is out of order\n" + ; Uh-oh, some data is out of order, lets call TCP reassemble for help call TCP_reassemble @@ -1621,7 +1623,7 @@ align 4 .dumpit: DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: dumping\n" - call kernel_free + call NET_packet_free add esp, 4 jmp .loop @@ -1694,6 +1696,6 @@ align 4 .drop_no_socket: DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Drop (no socket)\n" - call kernel_free + call NET_packet_free add esp, 4 jmp .loop diff --git a/kernel/trunk/network/udp.inc b/kernel/trunk/network/udp.inc index d50bb164c..cafc5f1e7 100644 --- a/kernel/trunk/network/udp.inc +++ b/kernel/trunk/network/udp.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; UDP.INC ;; @@ -230,7 +230,7 @@ UDP_input: DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: checksum mismatch\n" .dump: - call kernel_free + call NET_packet_free add esp, 4 ; pop (balance stack) DEBUGF DEBUG_NETWORK_VERBOSE,"UDP_input: dumping\n"