forked from KolibriOS/kolibrios
kos-acpi: reworked create_process and fs_execute
git-svn-id: svn://kolibrios.org@6319 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
7be51f22d5
commit
c9db062cdd
@ -50,7 +50,6 @@ macro _clear_ op
|
|||||||
rep stosd
|
rep stosd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_strlen:
|
_strlen:
|
||||||
mov ecx, 0xFFFFFFFF
|
mov ecx, 0xFFFFFFFF
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
@ -59,7 +58,6 @@ _strlen:
|
|||||||
sub eax, ecx
|
sub eax, ecx
|
||||||
retn
|
retn
|
||||||
|
|
||||||
|
|
||||||
fs_execute_from_sysdir:
|
fs_execute_from_sysdir:
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
fs_execute_from_sysdir_param:
|
fs_execute_from_sysdir_param:
|
||||||
@ -94,29 +92,16 @@ proc fs_execute
|
|||||||
|
|
||||||
endl
|
endl
|
||||||
|
|
||||||
xchg bx, bx
|
|
||||||
mov eax, [ebp]
|
mov eax, [ebp]
|
||||||
mov [flags], edx
|
mov [flags], edx
|
||||||
mov [cmdline], ebx
|
mov [cmdline], ebx
|
||||||
mov [filename], eax
|
mov [filename], eax
|
||||||
|
|
||||||
call lock_application_table
|
|
||||||
|
|
||||||
call alloc_thread_slot
|
|
||||||
mov esi, -0x20 ; too many processes
|
|
||||||
test eax, eax
|
|
||||||
jz .err_0
|
|
||||||
|
|
||||||
mov [slot], eax
|
|
||||||
shl eax, 8
|
|
||||||
add eax, SLOT_BASE
|
|
||||||
mov [slot_base], eax
|
|
||||||
|
|
||||||
mov eax, [filename]
|
mov eax, [filename]
|
||||||
stdcall load_file, eax
|
stdcall load_file, eax
|
||||||
mov esi, -ERROR_FILE_NOT_FOUND
|
mov esi, -ERROR_FILE_NOT_FOUND
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .err_0
|
jz .err_file
|
||||||
|
|
||||||
mov [file_base], eax
|
mov [file_base], eax
|
||||||
mov [file_size], ebx
|
mov [file_size], ebx
|
||||||
@ -127,21 +112,31 @@ xchg bx, bx
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .err_hdr
|
jz .err_hdr
|
||||||
|
|
||||||
|
call lock_application_table
|
||||||
|
|
||||||
|
call alloc_thread_slot
|
||||||
|
mov esi, -0x20 ; too many processes
|
||||||
|
test eax, eax
|
||||||
|
jz .err_0
|
||||||
|
|
||||||
|
mov [slot], eax
|
||||||
|
shl eax, 8
|
||||||
|
lea edi, [SLOT_BASE+eax]
|
||||||
|
mov [slot_base], edi
|
||||||
|
|
||||||
;clean extended information about process
|
;clean extended information about process
|
||||||
mov edi, [slot_base]
|
mov ecx, 256/4
|
||||||
mov ecx, 265/4
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
cld
|
cld
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
; write application name
|
; write application name
|
||||||
lea eax, [filename]
|
stdcall strrchr, [filename], '/' ; now eax points to name without path
|
||||||
stdcall strrchr, eax, '/' ; now eax points to name without path
|
|
||||||
|
|
||||||
lea esi, [eax+1]
|
lea esi, [eax+1]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz @F
|
jnz @F
|
||||||
lea esi, [filename]
|
mov esi, [filename]
|
||||||
@@:
|
@@:
|
||||||
mov ecx, 11 ; 11 chars for name! 8 - is old value!
|
mov ecx, 11 ; 11 chars for name! 8 - is old value!
|
||||||
mov edi, [slot_base]
|
mov edi, [slot_base]
|
||||||
@ -216,10 +211,12 @@ xchg bx, bx
|
|||||||
call unlock_application_table
|
call unlock_application_table
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.err_hdr:
|
|
||||||
stdcall kernel_free, [file_base]
|
|
||||||
.err_0:
|
.err_0:
|
||||||
call unlock_application_table
|
call unlock_application_table
|
||||||
|
|
||||||
|
.err_hdr:
|
||||||
|
stdcall kernel_free, [file_base]
|
||||||
|
.err_file:
|
||||||
mov eax, esi
|
mov eax, esi
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@ -318,7 +315,6 @@ alloc_thread_slot:
|
|||||||
popfd
|
popfd
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc create_process stdcall, app_size:dword
|
proc create_process stdcall, app_size:dword
|
||||||
locals
|
locals
|
||||||
@ -381,8 +377,6 @@ proc create_process stdcall, app_size:dword
|
|||||||
or eax, PG_SWR
|
or eax, PG_SWR
|
||||||
mov [edi-4096+(page_tabs shr 20)], eax
|
mov [edi-4096+(page_tabs shr 20)], eax
|
||||||
|
|
||||||
xchg bx, bx
|
|
||||||
|
|
||||||
lea edx, [edi-4096]
|
lea edx, [edi-4096]
|
||||||
mov esi, [app_tabs]
|
mov esi, [app_tabs]
|
||||||
|
|
||||||
@ -403,17 +397,18 @@ xchg bx, bx
|
|||||||
dec esi
|
dec esi
|
||||||
jnz .alloc_page_dir
|
jnz .alloc_page_dir
|
||||||
|
|
||||||
|
stdcall map_page, [tmp_task_ptab], 0, PG_UNMAP
|
||||||
mov eax, [process]
|
mov eax, [process]
|
||||||
|
|
||||||
pop edi
|
pop edi
|
||||||
pop esi
|
pop esi
|
||||||
pop ebx
|
pop ebx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
cmp [process], 0
|
mov ecx, [process]
|
||||||
je @f
|
jcxz @F
|
||||||
;; stdcall destroy_app_space, [dir_addr], 0
|
|
||||||
|
call destroy_process
|
||||||
@@:
|
@@:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
pop edi
|
pop edi
|
||||||
@ -422,18 +417,6 @@ xchg bx, bx
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
align 4
|
|
||||||
set_cr3:
|
|
||||||
pushfd
|
|
||||||
cli
|
|
||||||
mov ebx, [current_slot]
|
|
||||||
mov [current_process], eax
|
|
||||||
mov [ebx+APPDATA.process], eax
|
|
||||||
mov eax, [eax+PROC.pdt_0_phys]
|
|
||||||
mov cr3, eax
|
|
||||||
popfd
|
|
||||||
ret
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc destroy_page_table stdcall, pg_tab:dword
|
proc destroy_page_table stdcall, pg_tab:dword
|
||||||
|
|
||||||
@ -693,7 +676,6 @@ proc write_process_memory
|
|||||||
mov ecx, 0x8000
|
mov ecx, 0x8000
|
||||||
@@:
|
@@:
|
||||||
mov ebx, [offset]
|
mov ebx, [offset]
|
||||||
; add ebx, new_app_base
|
|
||||||
push ecx
|
push ecx
|
||||||
stdcall map_memEx, [proc_mem_map], \
|
stdcall map_memEx, [proc_mem_map], \
|
||||||
[slot], ebx, ecx, PG_SWR
|
[slot], ebx, ecx, PG_SWR
|
||||||
@ -861,7 +843,6 @@ endp
|
|||||||
align 4
|
align 4
|
||||||
common_app_entry:
|
common_app_entry:
|
||||||
|
|
||||||
xchg bx, bx
|
|
||||||
mov ebp, [current_slot]
|
mov ebp, [current_slot]
|
||||||
mov ebp, [ebp+APPDATA.exec_params]
|
mov ebp, [ebp+APPDATA.exec_params]
|
||||||
test ebp, ebp
|
test ebp, ebp
|
||||||
@ -885,8 +866,8 @@ xchg bx, bx
|
|||||||
stosb
|
stosb
|
||||||
|
|
||||||
.copy_cmdline:
|
.copy_cmdline:
|
||||||
mov edi, [ebx+APP_HDR.cmdline]
|
mov edi, [ebp+APP_HDR.cmdline]
|
||||||
mov ecx, [ebx+APP_HDR.cmdline_size]
|
mov ecx, [ebp+APP_HDR.cmdline_size]
|
||||||
test edi, edi
|
test edi, edi
|
||||||
jz .check_tls_header
|
jz .check_tls_header
|
||||||
|
|
||||||
@ -917,24 +898,6 @@ xchg bx, bx
|
|||||||
popad
|
popad
|
||||||
iretd
|
iretd
|
||||||
|
|
||||||
align 4
|
|
||||||
tls_app_entry:
|
|
||||||
|
|
||||||
call init_heap
|
|
||||||
stdcall user_alloc, 4096
|
|
||||||
|
|
||||||
mov edx, [current_slot]
|
|
||||||
mov [edx+APPDATA.tls_base], eax
|
|
||||||
mov [tls_data_l+2], ax
|
|
||||||
shr eax, 16
|
|
||||||
mov [tls_data_l+4], al
|
|
||||||
mov [tls_data_l+7], ah
|
|
||||||
mov dx, app_tls
|
|
||||||
mov fs, dx
|
|
||||||
popad
|
|
||||||
iretd
|
|
||||||
|
|
||||||
|
|
||||||
EFL_IF equ 0x0200
|
EFL_IF equ 0x0200
|
||||||
EFL_IOPL1 equ 0x1000
|
EFL_IOPL1 equ 0x1000
|
||||||
EFL_IOPL2 equ 0x2000
|
EFL_IOPL2 equ 0x2000
|
||||||
@ -1009,11 +972,6 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
|
|||||||
shl ebx, 5
|
shl ebx, 5
|
||||||
lea ecx, [draw_data+ebx];ecx - pointer to draw data
|
lea ecx, [draw_data+ebx];ecx - pointer to draw data
|
||||||
|
|
||||||
; mov edx, common_app_entry
|
|
||||||
; cmp [ebx*8+SLOT_BASE+APPDATA.tls_base], -1
|
|
||||||
; jne @F
|
|
||||||
; mov edx, tls_app_entry
|
|
||||||
;@@:
|
|
||||||
; set window state to 'normal' (non-minimized/maximized/rolled-up) state
|
; set window state to 'normal' (non-minimized/maximized/rolled-up) state
|
||||||
mov [ebx+window_data+WDATA.fl_wstate], WSTATE_NORMAL
|
mov [ebx+window_data+WDATA.fl_wstate], WSTATE_NORMAL
|
||||||
mov [ebx+window_data+WDATA.fl_redraw], 1
|
mov [ebx+window_data+WDATA.fl_redraw], 1
|
||||||
|
@ -37,7 +37,7 @@ v86_create:
|
|||||||
; allocate tables
|
; allocate tables
|
||||||
mov ebx, eax
|
mov ebx, eax
|
||||||
|
|
||||||
stdcall create_process, 4096, eax, 4096 ;FIXME
|
stdcall create_process, 4096
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail2
|
jz .fail2
|
||||||
|
|
||||||
@ -51,7 +51,6 @@ v86_create:
|
|||||||
|
|
||||||
mov [ebx+V86_machine.iopm], eax
|
mov [ebx+V86_machine.iopm], eax
|
||||||
|
|
||||||
|
|
||||||
; initialize tables
|
; initialize tables
|
||||||
push edi
|
push edi
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
@ -66,7 +65,6 @@ v86_create:
|
|||||||
cli
|
cli
|
||||||
mov cr3, eax
|
mov cr3, eax
|
||||||
|
|
||||||
|
|
||||||
; now V86 specific: initialize known addresses in first Mb
|
; now V86 specific: initialize known addresses in first Mb
|
||||||
|
|
||||||
; first page - BIOS data (shared between all machines!)
|
; first page - BIOS data (shared between all machines!)
|
||||||
@ -109,10 +107,8 @@ v86_create:
|
|||||||
add eax, edx
|
add eax, edx
|
||||||
loop @b
|
loop @b
|
||||||
|
|
||||||
mov eax, sys_proc
|
mov eax, [sys_proc+PROC.pdt_0_phys]
|
||||||
push ebx
|
mov cr3, eax
|
||||||
call set_cr3
|
|
||||||
pop ebx
|
|
||||||
popfd
|
popfd
|
||||||
|
|
||||||
pop edi
|
pop edi
|
||||||
|
@ -761,7 +761,7 @@ endg
|
|||||||
mov esi, boot_v86machine
|
mov esi, boot_v86machine
|
||||||
call boot_log
|
call boot_log
|
||||||
; Initialize system V86 machine
|
; Initialize system V86 machine
|
||||||
; call init_sys_v86
|
call init_sys_v86
|
||||||
|
|
||||||
mov esi, boot_inittimer
|
mov esi, boot_inittimer
|
||||||
call boot_log
|
call boot_log
|
||||||
|
Loading…
Reference in New Issue
Block a user