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

View File

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

View File

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