Subversion Repositories Kolibri OS

Compare Revisions

Ignore whitespace Rev 6413 → Rev 6412

/kernel/trunk/network/socket.inc
187,11 → 187,11
 
ends
 
SOCKET_STRUCT_SIZE = 4096 ; in bytes
SOCKETBUFFSIZE = 4096 ; in bytes
 
SOCKET_QUEUE_SIZE = 10 ; maximum number of incoming packets queued for 1 socket
; the incoming packet queue for sockets is placed in the socket struct itself, at this location from start
SOCKET_QUEUE_LOCATION = (SOCKET_STRUCT_SIZE - SOCKET_QUEUE_SIZE*sizeof.socket_queue_entry - sizeof.queue)
SOCKET_QUEUE_LOCATION = (SOCKETBUFFSIZE - SOCKET_QUEUE_SIZE*sizeof.socket_queue_entry - sizeof.queue)
 
uglobal
align 4
1368,7 → 1368,7
jz .invalid
 
mov esi, eax
mov ecx, SOCKET_STRUCT_SIZE/4
mov ecx, SOCKETBUFFSIZE/4
rep movsd
 
mov dword[esp+32], 0
1591,7 → 1591,7
mov esi, eax
 
push edx
stdcall create_ring_buffer, SOCKET_BUFFER_SIZE, PG_SWR
stdcall create_ring_buffer, SOCKET_MAXDATA, PG_SWR
pop edx
test eax, eax
jz .fail
1607,7 → 1607,7
mov [esi + RING_BUFFER.write_ptr], eax
mov [esi + RING_BUFFER.read_ptr], eax
mov [esi + RING_BUFFER.size], 0
add eax, SOCKET_BUFFER_SIZE
add eax, SOCKET_MAXDATA
mov [esi + RING_BUFFER.end_ptr], eax
mov eax, esi
 
1642,7 → 1642,7
popa
 
; calculate available size
mov edi, SOCKET_BUFFER_SIZE
mov edi, SOCKET_MAXDATA
sub edi, [eax + RING_BUFFER.size] ; available buffer size in edi
cmp ecx, edi
jbe .copy
1656,7 → 1656,7
add edi, ecx
cmp edi, [eax + RING_BUFFER.end_ptr]
jb @f
sub edi, SOCKET_BUFFER_SIZE ; WRAP
sub edi, SOCKET_MAXDATA ; WRAP
@@:
 
mov [eax + RING_BUFFER.write_ptr], edi
1790,7 → 1790,7
mov edx, [eax + RING_BUFFER.end_ptr]
cmp [eax + RING_BUFFER.read_ptr], edx
jb @f
sub [eax + RING_BUFFER.read_ptr], SOCKET_BUFFER_SIZE
sub [eax + RING_BUFFER.read_ptr], SOCKET_MAXDATA
@@:
 
push eax ecx
1905,9 → 1905,9
; Socket and thread exists and socket is of non blocking type.
; We'll try to flag an event to the thread.
shl ecx, 8
or [SLOT_BASE + ecx + APPDATA.event_mask], EVENT_NETWORK
or [ecx + SLOT_BASE + APPDATA.event_mask], EVENT_NETWORK
 
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_notify: poking thread %u!\n", ebx
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_notify: poking thread %u!\n", eax
pop esi ecx ebx
ret
 
1941,7 → 1941,7
 
push ebx
 
stdcall kernel_alloc, SOCKET_STRUCT_SIZE
stdcall kernel_alloc, SOCKETBUFFSIZE
or eax, eax
jz .nomem
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_alloc: ptr=%x\n", eax
1949,7 → 1949,7
; zero-initialize allocated memory
push eax
mov edi, eax
mov ecx, SOCKET_STRUCT_SIZE / 4
mov ecx, SOCKETBUFFSIZE / 4
xor eax, eax
rep stosd
pop eax