kernel: new app loader

git-svn-id: svn://kolibrios.org@6333 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2016-03-13 06:08:07 +00:00
parent 97ab496246
commit a316af7413
7 changed files with 262 additions and 408 deletions

View File

@ -428,6 +428,8 @@ struct PROC
ht_free rd 1 ;htab[0] stdin ht_free rd 1 ;htab[0] stdin
ht_next rd 1 ;htab[1] stdout ht_next rd 1 ;htab[1] stdout
htab rd (4096-$)/4 ;htab[2] stderr htab rd (4096-$)/4 ;htab[2] stderr
; htab rd (4096+3072-$)/4 ;htab[2] stderr
; workdir rb 1024
pdt_0 rd 1024 pdt_0 rd 1024
ends ends

View File

@ -575,15 +575,6 @@ proc page_fault_handler
cmp ebx, kernel_tabs cmp ebx, kernel_tabs
jb .alloc;.app_tabs ;таблицы страниц приложения ; jb .alloc;.app_tabs ;таблицы страниц приложения ;
;просто создадим одну ;просто создадим одну
if 0 ;пока это просто лишнее
cmp ebx, LFB_BASE
jb .core_tabs ;таблицы страниц ядра
;Ошибка
.lfb:
;область LFB
;Ошибка
jmp .fail
end if
.core_tabs: .core_tabs:
.fail: ;simply return to caller .fail: ;simply return to caller
mov esp, ebp mov esp, ebp

View File

@ -30,13 +30,17 @@ struct APP_HEADER_01_
i_icon dd ? ;+32 i_icon dd ? ;+32
ends ends
struct APP_HDR
struct APP_PARAMS cmdline rd 1 ;0x00
app_cmdline dd ? ;0x00 path rd 1 ;0x04
app_path dd ? ;0x04 eip rd 1 ;0x08
app_eip dd ? ;0x08 esp rd 1 ;0x0C
app_esp dd ? ;0x0C _edata rd 1 ;0x10
app_mem dd ? ;0x10 _emem rd 1 ;0x14
img_base rd 1 ;0x18
img_size rd 1
filename_size rd 1
cmdline_size rd 1
ends ends
macro _clear_ op macro _clear_ op
@ -46,160 +50,59 @@ macro _clear_ op
rep stosd rep stosd
} }
align 4
_strnlen:
mov edx, ecx
xor eax, eax
repne scasb
jne @F
inc ecx
@@:
mov eax, edx
sub eax, ecx
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:
xor edx, edx xor edx, edx
mov esi, sysdir_path
align 4 align 4
proc fs_execute proc fs_execute
;fn_read:dword, file_size:dword, cluster:dword
; ebx - cmdline ; ebx - cmdline
; edx - flags ; edx - flags
; ebp - full filename ; ebp - full filename
; [esp+4] = procedure DoRead, [esp+8] = filesize & [esp+12]... - arguments for it
locals locals
cmdline_size dd ? ; +0 ; cmdline -12 filename rd 1
cmdline_adr dd ? ; +4 ; cmdline -8 cmdline rd 1
cmdline_flag dd ? ; +8 ; cmdline -4 flags rd 1
cmdline rd 64 ;256/4
filename rd 256 ;1024/4 slot rd 1
flags dd ? slot_base rd 1
;app header data
hdr_cmdline rd 1 ;0x00
hdr_path rd 1 ;0x04
hdr_eip rd 1 ;0x08
hdr_esp rd 1 ;0x0C
hdr_edata rd 1 ;0x10
hdr_emem rd 1 ;0x14
file_base rd 1 ;0x18
file_size rd 1 ;0x1c
filename_size rd 1 ;0x20
cmdline_size rd 1 ;0x24
save_proc dd ?
slot dd ?
slot_base dd ?
file_base dd ?
file_size dd ?
; handle dd ? ;temp. for default cursor handle for curr. thread
;app header data
hdr_cmdline dd ? ;0x00
hdr_path dd ? ;0x04
hdr_eip dd ? ;0x08
hdr_esp dd ? ;0x0C
hdr_mem dd ? ;0x10
hdr_i_end dd ? ;0x14
endl endl
pushad mov eax, [ebp]
; cmp [SCR_MODE], word 0x13
; jbe @f
; pushad
; stdcall set_cursor, [def_cursor_clock]
; mov [handle], eax
; mov [redrawmouse_unconditional], 1
; call wakeup_osloop
; popad
;@@:
mov [flags], edx mov [flags], edx
; [ebp] pointer to filename
lea edi, [filename]
lea ecx, [edi+1024]
mov al, '/'
stosb
@@:
cmp edi, ecx
jae .bigfilename
lodsb
stosb
test al, al
jnz @b
mov esi, [ebp]
test esi, esi
jz .namecopied
mov byte [edi-1], '/'
@@:
cmp edi, ecx
jae .bigfilename
lodsb
stosb
test al, al
jnz @b
jmp .namecopied
.bigfilename:
popad
mov eax, -ERROR_FILE_NOT_FOUND
jmp .final
.namecopied:
xor eax, eax
mov [cmdline_flag], eax
mov [cmdline_adr], eax
mov [cmdline_size], eax
mov [cmdline], ebx mov [cmdline], ebx
test ebx, ebx mov [filename], eax
jz .no_copy
;--------------------------------------
pushad
pushfd
mov esi, ebx
mov ecx, 65536 ; 64 Kb max for ext.cmdline
cld
@@:
dec ecx
jz .end_string
lodsb mov eax, [filename]
test al, al
jnz @b
.end_string:
mov eax, 65536 ; 64 Kb max for ext.cmdline
sub eax, ecx
mov [cmdline_size], eax
cmp eax, 255
ja @f
popfd
popad
jmp .old_copy
@@:
xor eax, eax
dec eax
mov [cmdline_flag], eax
popfd
popad
; get memory for the extended command line
stdcall kernel_alloc, [cmdline_size] ;eax
test eax, eax
jz .old_copy ; get memory failed
mov [cmdline_adr], eax
pushad
pushfd
mov esi, ebx
mov edi, eax
mov ecx, [cmdline_size]
cld
rep movsb
popfd
popad
jmp .no_copy
.old_copy:
; clear flag because old method with 256 bytes
xor eax, eax
mov [cmdline_flag], eax
;--------------------------------------
lea eax, [cmdline]
mov dword [eax+252], 0
.copy:
stdcall strncpy, eax, ebx, 255
.no_copy:
lea 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_file jz .err_file
@ -216,25 +119,28 @@ proc fs_execute
call lock_application_table call lock_application_table
call alloc_thread_slot call alloc_thread_slot
test eax, eax
mov esi, -0x20 ; too many processes mov esi, -0x20 ; too many processes
jz .err test eax, eax
jz .err_0
mov [slot], eax mov [slot], eax
shl eax, 8 shl eax, 8
add eax, SLOT_BASE lea edi, [SLOT_BASE+eax]
mov [slot_base], eax mov [slot_base], edi
mov edi, eax
_clear_ 256 ;clean extended information about process ;clean extended information about process
mov ecx, 256/4
xor eax, eax
cld
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]
@ -246,20 +152,33 @@ proc fs_execute
jz .copy_process_name_done jz .copy_process_name_done
stosb stosb
loop .copy_process_name_loop loop .copy_process_name_loop
.copy_process_name_done: .copy_process_name_done:
mov ebx, [current_process] mov edi, [cmdline]
mov [save_proc], ebx xor eax, eax
test edi, edi
jz @F
mov ecx, 65535
call _strnlen
cmp eax, 256
jb @F
lea ebx, [eax+1]
add [hdr_emem], ebx
@@:
mov [cmdline_size], eax
stdcall create_process, [hdr_emem]
stdcall create_process, [hdr_mem], [file_base], [file_size]
mov esi, -30; no memory mov esi, -30; no memory
test eax, eax test eax, eax
jz .failed jz .err_hdr
mov ebx, [sys_proc+LHEAD.prev] mov ebx, [sys_proc+LHEAD.prev]
__list_add eax, ebx, sys_proc __list_add eax, ebx, sys_proc
mov ebx, [hdr_mem] mov ebx, [hdr_emem]
mov [eax+PROC.mem_used], ebx mov [eax+PROC.mem_used], ebx
mov ebx, [slot_base] mov ebx, [slot_base]
@ -269,60 +188,43 @@ proc fs_execute
lea ecx, [eax+PROC.thr_list] lea ecx, [eax+PROC.thr_list]
list_add_tail edx, ecx list_add_tail edx, ecx
xor edx, edx mov esi, sizeof.APP_HDR
cmp word [6], '02' add esi, [cmdline_size]
jne @f
not edx mov edi, [filename]
@@: mov ecx, 1023
mov [ebx+APPDATA.tls_base], edx call _strnlen
add esi, eax
mov [filename_size], eax
mov ecx, [hdr_mem] stdcall kernel_alloc, esi
mov edi, [file_size] mov [ebx+APPDATA.exec_params], eax
add edi, 4095 mov edi, eax
and edi, not 4095 lea esi, [hdr_cmdline]
sub ecx, edi mov ecx, sizeof.APP_HDR/4
jna @F rep movsd
xor eax, eax mov esi, [filename]
cld mov ecx, [filename_size]
rep stosb rep movsb
@@: mov ecx, [cmdline_size]
mov esi, [cmdline]
rep movsb
; release only virtual space, not phisical memory
stdcall free_kernel_space, [file_base]
lea eax, [hdr_cmdline] lea eax, [hdr_cmdline]
lea ebx, [cmdline] stdcall set_app_params , [slot], eax, [flags]
lea ecx, [filename]
stdcall set_app_params , [slot], eax, ebx, ecx, [flags]
mov eax, [save_proc] mov eax, [process_number] ;set result
call set_cr3 call unlock_application_table
ret
mov eax, [process_number];set result .err_0:
call unlock_application_table call unlock_application_table
jmp .final
.failed:
mov eax, [save_proc]
call set_cr3
.err:
.err_hdr: .err_hdr:
stdcall kernel_free, [file_base] stdcall kernel_free, [file_base]
.err_file: .err_file:
call unlock_application_table
mov eax, esi mov eax, esi
.final:
; cmp [SCR_MODE], word 0x13
; jbe @f
; pushad
; stdcall set_cursor, [handle]
; mov [redrawmouse_unconditional], 1
; call wakeup_osloop
; popad
;@@:
ret ret
endp endp
@ -344,17 +246,17 @@ test_app_header:
jne .check_01_header jne .check_01_header
mov ecx, [APP_HEADER_00.start] mov ecx, [APP_HEADER_00.start]
mov [ebx+0x08], ecx ;app_eip mov [ebx+APP_HDR.eip], ecx
mov edx, [APP_HEADER_00.mem_size] mov edx, [APP_HEADER_00.mem_size]
mov [ebx+0x10], edx ;app_mem mov [ebx+APP_HDR._emem], edx
shr edx, 1 shr edx, 1
sub edx, 0x10 sub edx, 0x10
mov [ebx+0x0C], edx ;app_esp mov [ebx+APP_HDR.esp], edx
mov ecx, [APP_HEADER_00.i_param] mov ecx, [APP_HEADER_00.i_param]
mov [ebx], ecx ;app_cmdline mov [ebx+APP_HDR.cmdline], ecx
mov [ebx+4], dword 0 ;app_path mov [ebx+APP_HDR.path], 0
mov edx, [APP_HEADER_00.i_end] mov edx, [APP_HEADER_00.i_end]
mov [ebx+0x14], edx mov [ebx+APP_HDR._edata], edx
ret ret
.check_01_header: .check_01_header:
@ -365,7 +267,7 @@ test_app_header:
jne .fail jne .fail
@@: @@:
mov ecx, [APP_HEADER_01.start] mov ecx, [APP_HEADER_01.start]
mov [ebx+0x08], ecx ;app_eip mov [ebx+0x08], ecx
mov edx, [APP_HEADER_01.mem_size] mov edx, [APP_HEADER_01.mem_size]
; \begin{diamond}[20.08.2006] ; \begin{diamond}[20.08.2006]
@ -375,15 +277,15 @@ test_app_header:
jb .fail jb .fail
; \end{diamond}[20.08.2006] ; \end{diamond}[20.08.2006]
mov [ebx+0x10], edx ;app_mem mov [ebx+APP_HDR._emem], edx
mov ecx, [APP_HEADER_01.stack_top] mov ecx, [APP_HEADER_01.stack_top]
mov [ebx+0x0C], ecx ;app_esp mov [ebx+APP_HDR.esp], ecx
mov edx, [APP_HEADER_01.i_param] mov edx, [APP_HEADER_01.i_param]
mov [ebx], edx ;app_cmdline mov [ebx+APP_HDR.cmdline], edx
mov ecx, [APP_HEADER_01.i_icon] mov ecx, [APP_HEADER_01.i_icon]
mov [ebx+4], ecx ;app_path mov [ebx+APP_HDR.path], ecx
mov edx, [APP_HEADER_01.i_end] mov edx, [APP_HEADER_01.i_end]
mov [ebx+0x14], edx mov [ebx+APP_HDR._edata], edx
ret ret
.fail: .fail:
xor eax, eax xor eax, eax
@ -420,12 +322,9 @@ alloc_thread_slot:
popfd popfd
ret ret
align 4 align 4
proc create_process stdcall, app_size:dword,img_base:dword,img_size:dword proc create_process stdcall, app_size:dword
locals locals
app_pages dd ?
img_pages dd ?
process dd ? process dd ?
app_tabs dd ? app_tabs dd ?
endl endl
@ -434,37 +333,13 @@ proc create_process stdcall, app_size:dword,img_base:dword,img_size:dword
push esi push esi
push edi push edi
mov ecx, pg_data.mutex
call mutex_lock
xor eax, eax xor eax, eax
mov [process], eax mov [process], eax
mov eax, [app_size] mov eax, [app_size]
add eax, 4095 add eax, 0x3FFFFF
and eax, NOT(4095) shr eax, 22
mov [app_size], eax mov [app_tabs], eax
mov ebx, eax
shr eax, 12
mov [app_pages], eax
add ebx, 0x3FFFFF
and ebx, NOT(0x3FFFFF)
shr ebx, 22
mov [app_tabs], ebx
mov ecx, [img_size]
add ecx, 4095
and ecx, NOT(4095)
mov [img_size], ecx
shr ecx, 12
mov [img_pages], ecx
lea eax, [eax+ebx+2];all requested memory
cmp eax, [pg_data.pages_free]
ja .fail
stdcall kernel_alloc, 0x2000 stdcall kernel_alloc, 0x2000
test eax, eax test eax, eax
@ -509,62 +384,27 @@ proc create_process stdcall, app_size:dword,img_base:dword,img_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
lea eax, [edi-8192] lea edx, [edi-4096]
call set_cr3 mov esi, [app_tabs]
mov edx, [app_tabs] .alloc_page_dir:
xor edi, edi
@@:
call alloc_page call alloc_page
test eax, eax test eax, eax
jz .fail jz .fail
or eax, PG_UWR
mov [edx], eax
stdcall map_page_table, edi, eax mov edi, [tmp_task_ptab]
add edi, 0x00400000 stdcall map_page, edi, eax, PG_SWR
dec edx mov ecx, 1024
jnz @B
mov edi, page_tabs
mov ecx, [app_tabs]
shl ecx, 10
xor eax, eax xor eax, eax
rep stosd rep stosd
mov ecx, [img_pages] add edx, 4
mov ebx, PG_UWR dec esi
xor edx, edx jnz .alloc_page_dir
mov esi, [img_base]
shr esi, 10
add esi, page_tabs
mov edi, page_tabs
.remap:
lodsd
and eax, 0xFFFFF000
or eax, ebx; force user level r/w access
stosd
add edx, 0x1000
dec [app_pages]
dec ecx
jnz .remap
mov ecx, [app_pages] stdcall map_page, [tmp_task_ptab], 0, PG_UNMAP
test ecx, ecx
jz .done
.alloc:
call alloc_page
test eax, eax
jz .fail
stdcall map_page, edx, eax, dword PG_UWR
add edx, 0x1000
dec [app_pages]
jnz .alloc
.done:
mov ecx, pg_data.mutex
call mutex_unlock
mov eax, [process] mov eax, [process]
pop edi pop edi
@ -572,11 +412,10 @@ proc create_process stdcall, app_size:dword,img_base:dword,img_size:dword
pop ebx pop ebx
ret ret
.fail: .fail:
mov ecx, pg_data.mutex mov ecx, [process]
call mutex_unlock jcxz @F
cmp [process], 0
je @f call destroy_process
;; stdcall destroy_app_space, [dir_addr], 0
@@: @@:
xor eax, eax xor eax, eax
pop edi pop edi
@ -585,18 +424,6 @@ proc create_process stdcall, app_size:dword,img_base:dword,img_size:dword
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
@ -856,7 +683,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
@ -958,8 +784,7 @@ proc new_sys_threads
list_add_tail ebx, ecx ;add thread to process child's list list_add_tail ebx, ecx ;add thread to process child's list
lea eax, [app_cmdline] lea eax, [app_cmdline]
stdcall set_app_params , [slot], eax, dword 0, \ stdcall set_app_params , [slot], eax, [flags]
dword 0, [flags]
mov eax, [process_number] ;set result mov eax, [process_number] ;set result
call unlock_application_table call unlock_application_table
@ -972,8 +797,109 @@ proc new_sys_threads
ret ret
endp endp
proc map_process_image stdcall, img_size:dword, file_base:dword, file_size:dword
mov edx, [img_size]
mov esi, [file_base]
mov ecx, [file_size]
add edx, 4095
add ecx, 4095
shr edx, 12 ; total pages
shr ecx, 12 ; image pages
mov edi, page_tabs
shr esi, 10
add esi, edi
.map_image:
lodsd
and eax, -4096
or eax, PG_UWR
stosd
dec edx
loop .map_image
test edx, edx
jz .done
.map_bss:
call alloc_page
test eax, eax
jz .fail
or eax, PG_UWR
stosd
dec edx
jnz .map_bss
mov edi, [file_size]
mov ecx, [img_size]
add edi, 4095
and edi, -4096
add ecx, 4095
and ecx, -4096
sub ecx, edi
shr ecx, 2
xor eax, eax
rep stosd
.done:
.fail:
ret
endp
align 4 align 4
tls_app_entry: common_app_entry:
mov ebp, [current_slot]
mov ebp, [ebp+APPDATA.exec_params]
test ebp, ebp
jz .exit
stdcall map_process_image, [ebp+APP_HDR._emem],\
[ebp+APP_HDR.img_base], [ebp+APP_HDR.img_size]
xor eax, eax
mov edi, [ebp+APP_HDR.path]
lea esi, [ebp+sizeof.APP_HDR]
mov ecx, [ebp+APP_HDR.filename_size]
test edi, edi
jnz .copy_filename
add esi, ecx
jmp .check_cmdline
.copy_filename:
rep movsb
stosb
.check_cmdline:
mov edi, [ebp+APP_HDR.cmdline]
mov ecx, [ebp+APP_HDR.cmdline_size]
test edi, edi
jz .check_tls_header
cmp ecx, 256
jb .copy_cmdline
mov edi, [ebp+APP_HDR._emem]
add edi, 4095
and edi, -4096
sub edi, ecx
dec edi
cmp word [6], '00'
jne @F
mov [APP_HEADER_00_.i_param], edi
jmp .copy_cmdline
@@:
mov [APP_HEADER_01_.i_param], edi
.copy_cmdline:
rep movsb
stosb
.check_tls_header:
cmp word [6], '02'
jne .cleanup
call init_heap call init_heap
stdcall user_alloc, 4096 stdcall user_alloc, 4096
@ -986,19 +912,21 @@ tls_app_entry:
mov [tls_data_l+7], ah mov [tls_data_l+7], ah
mov dx, app_tls mov dx, app_tls
mov fs, dx mov fs, dx
.cleanup:
stdcall free_kernel_space, [ebp+APP_HDR.img_base]
stdcall kernel_free, ebp
.exit:
popad popad
iretd 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
EFL_IOPL3 equ 0x3000 EFL_IOPL3 equ 0x3000
align 4 align 4
proc set_app_params stdcall,slot:dword, params:dword,\ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
cmd_line:dword, app_path:dword, flags:dword
locals locals
pl0_stack dd ? pl0_stack dd ?
@ -1059,73 +987,13 @@ proc set_app_params stdcall,slot:dword, params:dword,\
rep movsd rep movsd
shr ebx, 3 shr ebx, 3
mov eax, new_app_base mov dword [CURRENT_TASK+ebx+0x10], 0
mov dword [CURRENT_TASK+ebx+0x10], eax
.add_command_line:
mov edx, [params]
mov edx, [edx] ;app_cmdline
test edx, edx
jz @f ;application doesn't need parameters
mov eax, edx
add eax, 256
jc @f
; cmp eax, [SLOT_BASE+APPDATA.mem_size+ebx*8]
; ja @f
mov eax, [cmd_line]
cmp [edx], dword 0xffffffff ; extended destination tag
jne .no_ext_dest
mov edx, [edx+4] ; extended destination for cmdline
jmp .continue
.no_ext_dest:
mov [eax-12], dword 255
.continue:
mov byte [edx], 0 ;force empty string if no cmdline given
test eax, eax
jz @f
;--------------------------------------
cmp [eax-4], dword 0xffffffff ; cmdline_flag
jne .old_copy
push eax
stdcall strncpy, edx, [eax-8], [eax-12]
pop eax
stdcall kernel_free, [eax-8]
jmp @f
.old_copy:
;--------------------------------------
stdcall strncpy, edx, eax, 256
@@:
mov edx, [params]
mov edx, [edx+4];app_path
test edx, edx
jz @F ;application don't need path of file
mov eax, edx
add eax, 1024
jc @f
; cmp eax, [SLOT_BASE+APPDATA.mem_size+ebx*8]
; ja @f
stdcall strncpy, edx, [app_path], 1024
@@:
mov ebx, [slot] mov ebx, [slot]
mov eax, ebx mov eax, ebx
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, irq0.return
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
@ -1152,7 +1020,7 @@ proc set_app_params stdcall,slot:dword, params:dword,\
lea ecx, [ebx+REG_EIP] lea ecx, [ebx+REG_EIP]
xor eax, eax xor eax, eax
mov [ebx+REG_RET], edx mov [ebx+REG_RET], dword common_app_entry
mov [ebx+REG_EDI], eax mov [ebx+REG_EDI], eax
mov [ebx+REG_ESI], eax mov [ebx+REG_ESI], eax
mov [ebx+REG_EBP], eax mov [ebx+REG_EBP], eax
@ -1162,8 +1030,8 @@ proc set_app_params stdcall,slot:dword, params:dword,\
mov [ebx+REG_ECX], eax mov [ebx+REG_ECX], eax
mov [ebx+REG_EAX], eax mov [ebx+REG_EAX], eax
mov eax, [esi+0x08] ;app_eip mov eax, [esi+APP_HDR.eip]
mov [ebx+REG_EIP], eax ;app_entry mov [ebx+REG_EIP], eax
mov [ebx+REG_CS], dword app_code mov [ebx+REG_CS], dword app_code
mov ecx, USER_PRIORITY mov ecx, USER_PRIORITY
@ -1172,12 +1040,11 @@ proc set_app_params stdcall,slot:dword, params:dword,\
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
mov eax, [esi+0x0C] ;app_esp mov eax, [esi+APP_HDR.esp]
mov [ebx+REG_APP_ESP], eax;app_stack mov [ebx+REG_APP_ESP], eax
mov [ebx+REG_SS], dword app_data mov [ebx+REG_SS], dword app_data
lea edx, [ebx+REG_RET] lea edx, [ebx+REG_RET]
@ -1199,9 +1066,7 @@ proc set_app_params stdcall,slot:dword, params:dword,\
ret ret
endp endp
align 4 align 4
get_stack_base: get_stack_base:
mov eax, [current_slot] mov eax, [current_slot]
mov eax, [eax+APPDATA.pl0_stack] mov eax, [eax+APPDATA.pl0_stack]

View File

@ -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

View File

@ -158,8 +158,8 @@ sz_EXPORTS db '_EXPORTS',0
szIMPORTS db 'IMPORTS',0 szIMPORTS db 'IMPORTS',0
read_firstapp db '/sys/' read_firstapp db '/sys/'
firstapp db 'LAUNCHER',0 firstapp db '/RD/1/LAUNCHER',0
notifyapp db '@notify',0 notifyapp db '/RD/1/@notify',0
if lang eq ru if lang eq ru
ud_user_message cp866 'Ошибка: неподдерживаемая инструкция процессора',0 ud_user_message cp866 'Ошибка: неподдерживаемая инструкция процессора',0
mtrr_user_message cp866 '"Обнаружена проблема с конфигурацией MTRR.\nПроизводительность может быть пониженной" -dW',0 mtrr_user_message cp866 '"Обнаружена проблема с конфигурацией MTRR.\nПроизводительность может быть пониженной" -dW',0

View File

@ -133,6 +133,15 @@ file_system_lfn:
jnz @f jnz @f
mov esi, [esi] mov esi, [esi]
lodsb lodsb
@@:
lea ebp, [esi-1]
cmp dword [ebx], 7
jne @F
mov edx, [ebx+4]
mov ebx, [ebx+8]
call fs_execute; ebp, ebx, edx
mov [image_of_eax], eax
ret
@@: @@:
cmp al, '/' cmp al, '/'
jz .notcurdir jz .notcurdir
@ -150,14 +159,6 @@ file_system_lfn:
jz .rootdir jz .rootdir
call process_replace_file_name call process_replace_file_name
.parse_normal: .parse_normal:
cmp dword [ebx], 7
jne @F
mov edx, [ebx+4]
mov ebx, [ebx+8]
call fs_execute; esi+ebp, ebx, edx
mov [image_of_eax], eax
ret
@@:
mov edi, rootdirs-8 mov edi, rootdirs-8
xor ecx, ecx xor ecx, ecx
push esi push esi

View File

@ -974,7 +974,6 @@ include "detect/vortex86.inc" ; Vortex86 SoC detection code
mov esi, 250 ; wait 1/4 a second mov esi, 250 ; wait 1/4 a second
call delay_ms call delay_ms
rdtsc rdtsc
sti
sub eax, ecx sub eax, ecx
xor edx, edx xor edx, edx