cleanup kernel objects in terminate()

git-svn-id: svn://kolibrios.org@329 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-02-08 07:15:14 +00:00
parent 5a467f60e3
commit 82fe412a09
2 changed files with 58 additions and 43 deletions

View File

@ -543,20 +543,20 @@ get_app_params:
stc stc
ret ret
uglobal
new_process_place dd 0x0
app_start dd 0x0
app_i_end dd 0x0
app_mem dd 0x0
app_esp dd 0x0
app_i_param dd 0x0
app_i_icon dd 0x0
app_mem_pos dd 0x0
endg
end if end if
;uglobal
; new_process_place dd 0x0
; app_start dd 0x0
; app_i_end dd 0x0
; app_mem dd 0x0
; app_esp dd 0x0
; app_i_param dd 0x0
; app_i_icon dd 0x0
; app_mem_pos dd 0x0
;endg
sys_threads: sys_threads:
; eax=1 create thread ; eax=1 create thread
@ -570,46 +570,64 @@ jmp new_sys_threads
iglobal iglobal
process_terminating db 'K : Process - terminating',13,10,0 process_terminating db 'K : Process - terminating',13,10,0
process_terminated db 'K : Process - done',13,10,0 process_terminated db 'K : Process - done',13,10,0
msg_obj_destroy db 'K : destroy app object',13,10,0
endg endg
; param
; esi= slot
terminate: ; terminate application terminate: ; terminate application
push esi
mov esi,process_terminating
call sys_msg_board_str
pop esi
.slot equ esp ;locals
push esi ;save .slot
mov esi,process_terminating
call sys_msg_board_str
@@: @@:
cli cli
cmp [application_table_status],0 cmp [application_table_status],0
je term9 je term9
sti sti
call change_task call change_task
jmp @b jmp @b
term9: term9:
call set_application_table_status
call set_application_table_status mov esi, [.slot]
shl esi,8
add esi, PROC_BASE+APP_OBJ_OFFSET
@@:
mov eax, [esi+APPOBJ.fd]
cmp eax, esi
je @F
mov eax,esi push esi
call [eax+APPOBJ.destroy]
mov esi, msg_obj_destroy
call sys_msg_board_str
pop esi
jmp @B
@@:
mov eax, [.slot]
shl eax, 8
mov eax,[PROC_BASE+eax+APPDATA.dir_table]
stdcall destroy_app_space, eax
pushad ;; mov esi, [.slot]
shl eax,8 pop esi ;restore stack
mov eax,[PROC_BASE+eax+0xB8] cmp [fpu_owner],esi ; if user fpu last -> fpu user = 1
stdcall destroy_app_space, eax jne fpu_ok_1
popad
cmp [fpu_owner],esi ; if user fpu last -> fpu user = 1 mov [fpu_owner],1
jne fpu_ok_1 mov eax, [256+PROC_BASE+APPDATA.fpu_state]
bt [cpu_caps], CAPS_SSE
mov [fpu_owner],1 clts
mov eax, [256+PROC_BASE+0x10] jnc .no_SSE
bt [cpu_caps], CAPS_SSE fxrstor [eax]
jnc .no_SSE jmp fpu_ok_1
fxrstor [eax]
jmp fpu_ok_1
.no_SSE: .no_SSE:
fnclex fnclex
frstor [eax] frstor [eax]
fpu_ok_1: fpu_ok_1:
mov [0xf400],byte 0 ; empty keyboard buffer mov [0xf400],byte 0 ; empty keyboard buffer
@ -882,7 +900,6 @@ fpu_ok_1:
mov [application_table_status],0 mov [application_table_status],0
mov esi,process_terminated mov esi,process_terminated
call sys_msg_board_str call sys_msg_board_str
ret ret
iglobal iglobal

View File

@ -456,8 +456,6 @@ end if
ret ret
endp endp
align 4 align 4
set_cr3: set_cr3:
mov esi, [CURRENT_TASK] mov esi, [CURRENT_TASK]