fix bug in free group of port(46 sysf) in deleting thread

git-svn-id: svn://kolibrios.org@9743 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Doczom 2022-03-19 16:20:29 +00:00
parent 8708293b8f
commit 0e38558cb0
2 changed files with 29 additions and 31 deletions

View File

@ -617,14 +617,6 @@ destroy_thread:
lea ebx, [edi + APPDATA.list] lea ebx, [edi + APPDATA.list]
list_del ebx ;destroys edx, ecx list_del ebx ;destroys edx, ecx
mov eax, 0x20202020
stosd
stosd
stosd
mov ecx, 244/4
xor eax, eax
rep stosd
; activate window ; activate window
movzx eax, word [WIN_STACK + esi*2] movzx eax, word [WIN_STACK + esi*2]
cmp eax, [thread_count] cmp eax, [thread_count]
@ -672,7 +664,6 @@ destroy_thread:
mov edx, [SLOT_BASE + edx + APPDATA.tid] mov edx, [SLOT_BASE + edx + APPDATA.tid]
rmpr0: rmpr0:
mov esi, [RESERVED_PORTS] mov esi, [RESERVED_PORTS]
test esi, esi test esi, esi
@ -693,13 +684,6 @@ destroy_thread:
jmp rmpr9 jmp rmpr9
rmpr4: rmpr4:
push eax edx ebp ;TODO: check using register ebp in next code
mov eax, [edi + 4]
mov edx, [edi + 8]
xor ebp, ebp
inc ebp
call new_port_access_disable
pop ebp edx eax
mov ecx, 256 mov ecx, 256
sub ecx, esi sub ecx, esi
@ -715,8 +699,22 @@ destroy_thread:
jmp rmpr0 jmp rmpr0
rmpr9: rmpr9:
popa popa
; clearing APPDATA structure this thread
pushad
mov edi, esi
shl edi, BSF sizeof.APPDATA
add edi, SLOT_BASE
mov eax, 0x20202020
stosd
stosd
stosd
mov ecx, 244/4
xor eax, eax
rep stosd
popad
mov edi, esi ; do not run this process slot mov edi, esi ; do not run this process slot
shl edi, BSF sizeof.APPDATA shl edi, BSF sizeof.APPDATA
mov [SLOT_BASE + edi + APPDATA.state], TSTATE_FREE mov [SLOT_BASE + edi + APPDATA.state], TSTATE_FREE

View File

@ -3489,16 +3489,10 @@ align 4
set_io_access_rights: set_io_access_rights:
push edi eax push edi eax
mov edi, tss._io_map_0 mov edi, tss._io_map_0
; mov ecx,eax
; and ecx,7 ; offset in byte
; shr eax,3 ; number of byte
; add edi,eax
; mov ebx,1
; shl ebx,cl
test ebp, ebp ; enable access - ebp = 0 test ebp, ebp ; enable access - ebp = 0
jnz .siar1 jnz .siar1
; not ebx
; and [edi],byte bl
btr [edi], eax btr [edi], eax
pop eax edi pop eax edi
ret ret
@ -3508,6 +3502,12 @@ set_io_access_rights:
ret ret
align 4 align 4
; @brief ReservePortArea and FreePortArea
; @param edx number end arrea of ports (include last number of port)
; @param ecx number start arrea of ports
; @param ebx sub function 0 - reserve, 1 - free
; @param eax 46 - number function
; @returns eax = 0 - succesful eax = 1 - error
syscall_reserveportarea: ; ReservePortArea and FreePortArea syscall_reserveportarea: ; ReservePortArea and FreePortArea
call r_f_port_area call r_f_port_area
@ -3532,7 +3532,7 @@ r_f_port_area:
cmp ecx, edx ; beginning > end ? cmp ecx, edx ; beginning > end ?
ja rpal1 ja rpal1
cmp edx, 65536 cmp edx, 65536 ;test ebx, not 0xffff
jae rpal1 jae rpal1
mov eax, [RESERVED_PORTS] mov eax, [RESERVED_PORTS]
test eax, eax ; no reserved areas ? test eax, eax ; no reserved areas ?
@ -3541,7 +3541,7 @@ r_f_port_area:
jae rpal1 jae rpal1
rpal3: rpal3:
mov ebx, eax mov ebx, eax
shl ebx, 4 shl ebx, 4 ;16 byte is sizeof item in RESERVED_PORTS table
add ebx, RESERVED_PORTS add ebx, RESERVED_PORTS
cmp ecx, [ebx+8] cmp ecx, [ebx+8]
ja rpal4 ja rpal4
@ -3578,9 +3578,9 @@ no_unmask_io:
add eax, RESERVED_PORTS add eax, RESERVED_PORTS
mov ebx, [current_slot] mov ebx, [current_slot]
mov ebx, [ebx + APPDATA.tid] mov ebx, [ebx + APPDATA.tid]
mov [eax], ebx mov [eax], ebx ; tid
mov [eax+4], ecx mov [eax+4], ecx ;start port
mov [eax+8], edx mov [eax+8], edx ;finish port
xor eax, eax xor eax, eax
ret ret