Compare commits

..
Author SHA1 Message Date
Leency 92bcb4a591 kernel: fix sysfn 68.30 (unload driver)
- restore the SRV handle after DRV_EXIT (ecx is clobbered by the driver)
- restore esp via ebp: START may be cdecl or stdcall
- pass the SRV to free in eax, not on the stack
- check SRV.base before calling DRV_EXIT
2026-09-30 11:23:02 +03:00
3 changed files with 15 additions and 15 deletions

No files matched your search

+15 -13
View File
@@ -1233,25 +1233,27 @@ f68:
mov eax, [ecx + SRV.entry]
test eax, eax
jz .fail
push ecx ;save handl
mov eax, -2 ;error free RAM
cmp [ecx + SRV.base], 0
je .fail
push ecx ;save handl
mov ebp, esp ;START may be cdecl or stdcall
push edx ;cmdline
push DRV_EXIT
call eax ;the result is not checked
lea esp, [esp+8]
push ecx
call [ecx + SRV.entry] ;the result is not checked
mov esp, ebp
pop esi
mov ebx, [ecx + SRV.base]
mov eax, -2 ;error free RAM
test ebx, ebx
jz .fail
stdcall kernel_free, ebx ;del driver
mov eax, [ecx + SRV.fd]
mov edx, [ecx + SRV.bk]
mov eax, [esi + SRV.fd]
mov edx, [esi + SRV.bk]
mov [edx + SRV.fd], eax
mov [eax + SRV.bk], edx
stdcall free, ecx
push eax
stdcall kernel_free, [esi + SRV.base] ;del driver
mov eax, esi
call free ;eax = mem
pop eax
;dec [count_services]
mov [esp + SYSCALL_STACK.eax], eax
-1
View File
@@ -226,7 +226,6 @@ macro socket_init {
mov ecx, 5
rep stosd
rdtsc ; seed, differs from boot to boot
@@:
pseudo_random eax
cmp ax, EPHEMERAL_PORT_MIN
-1
View File
@@ -208,7 +208,6 @@ macro tcp_init {
mov ecx, (6*NET_DEVICES_MAX)
rep stosd
rdtsc ; seed, differs from boot to boot
pseudo_random eax
mov [TCP_sequence_num], eax