forked from KolibriOS/kolibrios
Kernel: export new_sys_threads as CreateThread. Remove hack in set_app_params that allowed creating threads in kernel context under certain conditions
git-svn-id: svn://kolibrios.org@4105 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
7f2170cd0d
commit
1e36f2a2c8
@ -81,6 +81,8 @@ __exports:
|
|||||||
register_keyboard, 'RegKeyboard', \
|
register_keyboard, 'RegKeyboard', \
|
||||||
delete_keyboard, 'DelKeyboard', \
|
delete_keyboard, 'DelKeyboard', \
|
||||||
get_cpu_freq, 'GetCpuFreq', \
|
get_cpu_freq, 'GetCpuFreq', \
|
||||||
|
\
|
||||||
|
new_sys_threads, 'CreateThread', \ ; ebx, ecx, edx
|
||||||
\
|
\
|
||||||
srv_handler, 'ServiceHandler', \
|
srv_handler, 'ServiceHandler', \
|
||||||
fpu_save, 'FpuSave', \
|
fpu_save, 'FpuSave', \
|
||||||
|
@ -924,10 +924,17 @@ proc write_process_memory
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
;ebx = 1 - kernel thread
|
||||||
|
;ecx=thread entry point
|
||||||
|
;edx=thread stack pointer
|
||||||
|
;creation flags 0x01 - debugged
|
||||||
|
; 0x02 - kernel
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc new_sys_threads
|
proc new_sys_threads
|
||||||
locals
|
locals
|
||||||
slot dd ?
|
slot dd ?
|
||||||
|
flags dd ?
|
||||||
app_cmdline dd ? ;0x00
|
app_cmdline dd ? ;0x00
|
||||||
app_path dd ? ;0x04
|
app_path dd ? ;0x04
|
||||||
app_eip dd ? ;0x08
|
app_eip dd ? ;0x08
|
||||||
@ -935,16 +942,15 @@ proc new_sys_threads
|
|||||||
app_mem dd ? ;0x10
|
app_mem dd ? ;0x10
|
||||||
endl
|
endl
|
||||||
|
|
||||||
cmp ebx, 1
|
shl ebx, 1
|
||||||
jne .failed ;other subfunctions
|
mov [flags], ebx
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [app_eip], ecx
|
mov [app_eip], ecx
|
||||||
mov [app_cmdline], eax
|
mov [app_cmdline], eax
|
||||||
mov [app_esp], edx
|
mov [app_esp], edx
|
||||||
mov [app_path], eax
|
mov [app_path], eax
|
||||||
;mov esi,new_process_loading
|
|
||||||
;call sys_msg_board_str
|
|
||||||
call lock_application_table
|
call lock_application_table
|
||||||
|
|
||||||
call get_new_process_place
|
call get_new_process_place
|
||||||
@ -998,10 +1004,8 @@ proc new_sys_threads
|
|||||||
|
|
||||||
lea eax, [app_cmdline]
|
lea eax, [app_cmdline]
|
||||||
stdcall set_app_params , [slot], eax, dword 0, \
|
stdcall set_app_params , [slot], eax, dword 0, \
|
||||||
dword 0,dword 0
|
dword 0, [flags]
|
||||||
|
|
||||||
;mov esi,new_process_running
|
|
||||||
;call sys_msg_board_str ;output information about succefull startup
|
|
||||||
mov eax, [process_number] ;set result
|
mov eax, [process_number] ;set result
|
||||||
call unlock_application_table
|
call unlock_application_table
|
||||||
ret
|
ret
|
||||||
@ -1204,17 +1208,16 @@ proc set_app_params stdcall,slot:dword, params:dword,\
|
|||||||
mov [ebx+REG_EAX], eax
|
mov [ebx+REG_EAX], eax
|
||||||
|
|
||||||
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 ecx, USER_PRIORITY
|
mov ecx, USER_PRIORITY
|
||||||
mov eax, [CURRENT_TASK]
|
|
||||||
shl eax, 8 ; created by kernel?
|
test byte [flags], 2
|
||||||
cmp [SLOT_BASE+eax+APPDATA.dir_table], sys_pgdir - OS_BASE
|
jz @F
|
||||||
jnz @f
|
|
||||||
cmp [app_path], 0 ; it is a thread?
|
|
||||||
jnz @f
|
|
||||||
mov [ebx+REG_CS], dword os_code ; kernel thread
|
mov [ebx+REG_CS], dword os_code ; kernel thread
|
||||||
mov ecx, MAX_PRIORITY
|
mov ecx, MAX_PRIORITY
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
mov [ebx+REG_EFLAGS], dword EFL_IOPL1+EFL_IF
|
mov [ebx+REG_EFLAGS], dword EFL_IOPL1+EFL_IF
|
||||||
|
|
||||||
@ -1238,8 +1241,6 @@ proc set_app_params stdcall,slot:dword, params:dword,\
|
|||||||
mov [CURRENT_TASK+ebx+TASKDATA.state], dl
|
mov [CURRENT_TASK+ebx+TASKDATA.state], dl
|
||||||
lea edx, [SLOT_BASE+ebx*8]
|
lea edx, [SLOT_BASE+ebx*8]
|
||||||
call scheduler_add_thread
|
call scheduler_add_thread
|
||||||
;mov esi,new_process_running
|
|
||||||
;call sys_msg_board_str ;output information about succefull startup
|
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
@ -5568,13 +5568,13 @@ syscall_reserveportarea: ; ReservePortArea and FreePortArea
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
syscall_threads: ; CreateThreads
|
syscall_threads: ; CreateThreads
|
||||||
; eax=1 create thread
|
|
||||||
;
|
;
|
||||||
; ebx=thread start
|
; ecx=thread entry point
|
||||||
; ecx=thread stack value
|
; edx=thread stack pointer
|
||||||
;
|
;
|
||||||
; on return : eax = pid
|
; on return : eax = pid
|
||||||
|
|
||||||
|
xor ebx, ebx
|
||||||
call new_sys_threads
|
call new_sys_threads
|
||||||
|
|
||||||
mov [esp+32], eax
|
mov [esp+32], eax
|
||||||
|
Loading…
Reference in New Issue
Block a user