ability to create kernel threads

git-svn-id: svn://kolibrios.org@3325 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
CleverMouse 2013-03-04 13:58:55 +00:00
parent 6639a4a944
commit d30caf231a
2 changed files with 31 additions and 5 deletions

View File

@ -1148,6 +1148,14 @@ proc set_app_params stdcall,slot:dword, params:dword,\
mov eax, [esi+0x08] ;app_eip mov eax, [esi+0x08] ;app_eip
mov [ebx+REG_EIP], eax;app_entry mov [ebx+REG_EIP], eax;app_entry
mov [ebx+REG_CS], dword app_code mov [ebx+REG_CS], dword app_code
mov eax, [CURRENT_TASK]
shl eax, 8 ; created by kernel?
cmp [SLOT_BASE+eax+APPDATA.dir_table], sys_pgdir - OS_BASE
jnz @f
cmp [app_path], 0 ; it is a thread?
jnz @f
mov [ebx+REG_CS], dword os_code ; kernel thread
@@:
mov [ebx+REG_EFLAGS], dword EFL_IOPL1+EFL_IF mov [ebx+REG_EFLAGS], dword EFL_IOPL1+EFL_IF
mov eax, [esi+0x0C] ;app_esp mov eax, [esi+0x0C] ;app_esp

View File

@ -3486,17 +3486,26 @@ nobackgr:
mov edx, [shutdown_processes] mov edx, [shutdown_processes]
cmp [SYS_SHUTDOWN], dl cmp [SYS_SHUTDOWN], dl
jne no_mark_system_shutdown jne noshutdown
lea ecx, [edx-1] lea ecx, [edx-1]
mov edx, OS_BASE+0x3040 mov edx, OS_BASE+0x3040
jecxz @f jecxz no_mark_system_shutdown
;-------------------------------------- ;--------------------------------------
align 4 align 4
markz: markz:
push ecx edx push ecx edx
lea edx, [(edx-(TASK_DATA and 1FFFFFFFh))*8+SLOT_BASE] cmp [edx+TASKDATA.state], 9
jz .nokill
lea edx, [(edx-(CURRENT_TASK and 1FFFFFFFh))*8+SLOT_BASE]
cmp [edx+APPDATA.dir_table], sys_pgdir - OS_BASE
jz .nokill
call request_terminate call request_terminate
jmp .common
.nokill:
dec byte [SYS_SHUTDOWN]
xor eax, eax
.common:
pop edx ecx pop edx ecx
test eax, eax test eax, eax
jz @f jz @f
@ -3521,11 +3530,20 @@ align 4
newct: newct:
mov cl, [ebx] mov cl, [ebx]
cmp cl, byte 3 cmp cl, byte 3
jz terminate jz .terminate
cmp cl, byte 4 cmp cl, byte 4
jz terminate jnz .noterminate
.terminate:
pushad
call terminate
popad
cmp byte [SYS_SHUTDOWN], 0
jz .noterminate
dec byte [SYS_SHUTDOWN]
je system_shutdown
.noterminate:
add ebx, 0x20 add ebx, 0x20
inc esi inc esi
dec eax dec eax