loop pollfds: only checking server for now
This commit is contained in:
parent
9f3d59cf15
commit
72b9f421e1
3 changed files with 100 additions and 75 deletions
35
poll_remove.s
Normal file
35
poll_remove.s
Normal file
|
@ -0,0 +1,35 @@
|
|||
; Returns new array length in rax
|
||||
; edi - fd
|
||||
pollfds__remove:
|
||||
mov r10d, edi
|
||||
mov rdi, [pollfds_len]
|
||||
|
||||
; Variables:
|
||||
; rdi - array length
|
||||
; rsi - array index
|
||||
; r10d - fd
|
||||
; r11d - pollfds[rdi].fd
|
||||
pollfds__remove__loop:
|
||||
cmp rsi, rdi
|
||||
jge return ; fd was not found
|
||||
mov r11d, [pollfds + rsi * pollfd_size]
|
||||
add rsi, 1
|
||||
cmp r11d, r10d
|
||||
jne pollfds__remove__loop
|
||||
sub rsi, 1
|
||||
|
||||
; Returns new array length in rax
|
||||
; rdi - array length
|
||||
; rsi - array index to remove
|
||||
pollfds__remove_index:
|
||||
cmp rdi, 1
|
||||
jle pollfds__clear
|
||||
mov r10d, [pollfds + (rdi - 1) * pollfd_size]
|
||||
mov [pollfds + rsi * pollfd_size], r10d
|
||||
sub rdi, 1
|
||||
ret
|
||||
|
||||
; Returns new array length in rax
|
||||
pollfds__clear:
|
||||
mov rax, 0
|
||||
ret
|
Loading…
Add table
Add a link
Reference in a new issue