diff --git a/kernel/branches/net/network/stack.inc b/kernel/branches/net/network/stack.inc index 0bd2b04346..d418d52701 100644 --- a/kernel/branches/net/network/stack.inc +++ b/kernel/branches/net/network/stack.inc @@ -264,8 +264,6 @@ stack_handler: cmp [NET_RUNNING], 0 je .exit - call TCP_process_input ; de-queue TCP ragments and process them - ; Test for 10ms tick mov eax, [timer_ticks] cmp eax, [net_10ms] diff --git a/kernel/branches/net/network/tcp.inc b/kernel/branches/net/network/tcp.inc index 6c261650c0..4a76ae2f8d 100644 --- a/kernel/branches/net/network/tcp.inc +++ b/kernel/branches/net/network/tcp.inc @@ -137,6 +137,7 @@ uglobal ; TCP_bytes_tx rq MAX_NET_DEVICES TCP_sequence_num dd ? TCP_queue rd TCP_QUEUE_SIZE*sizeof.TCP_queue_entry/4 + TCP_input_event dd ? endg @@ -159,6 +160,11 @@ macro TCP_init { init_queue TCP_queue + push 1 + pop ebx + mov ecx, TCP_process_input + call new_sys_threads + } diff --git a/kernel/branches/net/network/tcp_input.inc b/kernel/branches/net/network/tcp_input.inc index 7ca1bb08c1..019e39d04a 100644 --- a/kernel/branches/net/network/tcp_input.inc +++ b/kernel/branches/net/network/tcp_input.inc @@ -49,6 +49,14 @@ TCP_input: popf add esp, sizeof.TCP_queue_entry + + mov [check_idle_semaphore], 5 + xor edx, edx + mov eax, [TCP_input_event] + mov ebx, [eax + EVENT.id] + xor esi, esi + call raise_event + ret .fail: @@ -60,7 +68,7 @@ TCP_input: add esp, sizeof.TCP_queue_entry - 8 call kernel_free add esp, 4 - .done: + ret @@ -68,8 +76,16 @@ TCP_input: align 4 TCP_process_input: + xor esi, esi + mov ecx, MANUAL_DESTROY + call create_event + mov [TCP_input_event], eax + .loop: - get_from_queue TCP_queue, TCP_QUEUE_SIZE, sizeof.TCP_queue_entry, TCP_input.done + mov eax, [TCP_input_event] + call wait_event + + get_from_queue TCP_queue, TCP_QUEUE_SIZE, sizeof.TCP_queue_entry, .loop push .loop push [esi + TCP_queue_entry.buffer_size]