more small updates and fixes in net branch

git-svn-id: svn://kolibrios.org@2311 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2011-11-12 22:35:01 +00:00
parent 3ce07b4be0
commit 343d6e80ca
5 changed files with 439 additions and 448 deletions

View File

@ -113,33 +113,27 @@ ETH_output:
cmp ecx, [ebx + NET_DEVICE.mtu]
ja .exit
push ecx ; << 1
push di eax edx ; << 2
push ecx
push di eax edx
add ecx, sizeof.ETH_header
push ecx ; << 3
push ecx ; << 4
call kernel_alloc ; >> 4
stdcall kernel_alloc, ecx
test eax, eax
jz .out_of_ram
mov edi, eax
pop ecx ; >> 3
pop esi ; >> 2
pop esi
movsd
movsw
pop esi ; >> 2
pop esi
movsd
movsw
pop ax ; >> 2
pop ax
stosw
lea eax, [edi - sizeof.ETH_header] ; Set eax to buffer start
mov edx, ecx ; Set edx to complete buffer size
pop ecx ; >> 1
pop ecx
lea edx, [ecx + sizeof.ETH_header] ; Set edx to complete buffer size
cmp edx, ETH_FRAME_MINIMUM
jb .adjust_size
@ -153,14 +147,13 @@ ETH_output:
.out_of_ram:
DEBUGF 2,"ETH_output: Out of ram space!!\n"
add esp, 3*4+2+4
add esp, 4+4+2+4
sub edi, edi
ret
.exit:
DEBUGF 2,"ETH_output: Packet too large!\n"
sub edi, edi
;;; dec edi
ret

View File

@ -138,7 +138,7 @@ struct UDP_SOCKET IP_SOCKET
ends
struct ICMP_SOCKET
struct ICMP_SOCKET IP_SOCKET
Identifier dw ?
@ -146,11 +146,13 @@ ends
struct RING_BUFFER
start_ptr dd ? ; Pointer to start of buffer
end_ptr dd ? ; pointer to end of buffer
read_ptr dd ? ; Read pointer
write_ptr dd ? ; Write pointer
size dd ? ; Number of bytes buffered
ends
struct STREAM_SOCKET TCP_SOCKET
@ -320,7 +322,6 @@ align 4
mov [eax + SOCKET.snd_proc], SOCKET_send_tcp
mov [eax + SOCKET.rcv_proc], SOCKET_receive_tcp
mov [eax + TCP_SOCKET.t_maxseg], 1480 ;;;;; FIXME
ret

View File

@ -172,7 +172,7 @@ UDP_input:
@@:
cmp [eax + UDP_SOCKET.firstpacket], 0
jz .updateport
je .updateport
cmp [eax + UDP_SOCKET.RemotePort], cx
jne .dump
@ -197,9 +197,8 @@ UDP_input:
call wait_mutex
pop ebx
mov si, [edx + UDP_header.SourcePort]
DEBUGF 1,"Changing remote port to: %u\n", si
mov [eax + UDP_SOCKET.RemotePort], si
DEBUGF 1,"Changing remote port to: %u\n", cx
mov [eax + UDP_SOCKET.RemotePort], cx
inc [eax + UDP_SOCKET.firstpacket]
jmp .updatesock
@ -323,11 +322,9 @@ UDP_API:
ret
.packets_tx:
add eax, UDP_PACKETS_TX
mov eax, [eax]
mov eax, [UDP_PACKETS_TX + eax]
ret
.packets_rx:
add eax, UDP_PACKETS_RX
mov eax, [eax]
mov eax, [UDP_PACKETS_RX + eax]
ret