forked from KolibriOS/kolibrios
fix stack error in fs_exec
git-svn-id: svn://kolibrios.org@247 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
08a4dc7f2d
commit
88e9e4be91
@ -599,45 +599,42 @@ fat_get_name:
|
|||||||
cmp byte [edi+11], 0xF
|
cmp byte [edi+11], 0xF
|
||||||
jz .longname
|
jz .longname
|
||||||
push ecx
|
push ecx
|
||||||
mov ecx, 8
|
push edi ebp
|
||||||
push edi ebp ecx
|
|
||||||
test byte [ebp-4], 1
|
test byte [ebp-4], 1
|
||||||
jnz .unicode_short
|
jnz .unicode_short
|
||||||
|
|
||||||
|
mov eax, [edi]
|
||||||
|
mov ecx, [edi+4]
|
||||||
|
mov [ebp], eax
|
||||||
|
mov [ebp+4], ecx
|
||||||
|
|
||||||
|
mov ecx, 8
|
||||||
@@:
|
@@:
|
||||||
mov al, [edi]
|
cmp byte [ebp+ecx-1], ' '
|
||||||
inc edi
|
loope @b
|
||||||
mov [ebp], al
|
|
||||||
inc ebp
|
mov eax, [edi+8]
|
||||||
loop @b
|
cmp al, ' '
|
||||||
pop ecx
|
je .done
|
||||||
@@:
|
shl eax, 8
|
||||||
cmp byte [ebp-1], ' '
|
mov al, '.'
|
||||||
jnz @f
|
|
||||||
dec ebp
|
lea ebp, [ebp+ecx+1]
|
||||||
loop @b
|
mov [ebp], eax
|
||||||
@@:
|
|
||||||
mov byte [ebp], '.'
|
|
||||||
inc ebp
|
|
||||||
mov ecx, 3
|
mov ecx, 3
|
||||||
push ecx
|
|
||||||
@@:
|
@@:
|
||||||
mov al, [edi]
|
rol eax, 8
|
||||||
inc edi
|
cmp al, ' '
|
||||||
mov [ebp], al
|
jne .done
|
||||||
inc ebp
|
|
||||||
loop @b
|
|
||||||
pop ecx
|
|
||||||
@@:
|
|
||||||
cmp byte [ebp-1], ' '
|
|
||||||
jnz @f
|
|
||||||
dec ebp
|
|
||||||
loop @b
|
loop @b
|
||||||
dec ebp
|
dec ebp
|
||||||
@@:
|
.done:
|
||||||
and byte [ebp], 0 ; CF=0
|
and byte [ebp+ecx+1], 0 ; CF=0
|
||||||
pop ebp edi ecx
|
pop ebp edi ecx
|
||||||
ret
|
ret
|
||||||
.unicode_short:
|
.unicode_short:
|
||||||
|
mov ecx, 8
|
||||||
|
push ecx
|
||||||
@@:
|
@@:
|
||||||
mov al, [edi]
|
mov al, [edi]
|
||||||
inc edi
|
inc edi
|
||||||
|
@ -89,25 +89,24 @@ proc fs_exec_EX stdcall file_name:dword, cmd_line:dword, flags:dword
|
|||||||
|
|
||||||
stdcall load_file,[file_name]
|
stdcall load_file,[file_name]
|
||||||
mov ecx, -ERROR_FILE_NOT_FOUND
|
mov ecx, -ERROR_FILE_NOT_FOUND
|
||||||
|
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .err ;fail
|
jz .err_file
|
||||||
|
|
||||||
mov [file_base], eax
|
mov [file_base], eax
|
||||||
mov [file_size], ebx
|
mov [file_size], ebx
|
||||||
|
|
||||||
|
pushfd
|
||||||
|
cli
|
||||||
|
|
||||||
lea ebx, [app_cmdline]
|
lea ebx, [app_cmdline]
|
||||||
call test_app_header
|
call test_app_header
|
||||||
mov ecx, -0x1F
|
mov ecx, -0x1F
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .err ;fail
|
jz .err_hdr
|
||||||
|
|
||||||
mov esi, new_process_loading
|
mov esi, new_process_loading
|
||||||
call sys_msg_board_str ; write message to message board
|
call sys_msg_board_str ; write message to message board
|
||||||
|
|
||||||
pushfd
|
|
||||||
cli
|
|
||||||
|
|
||||||
.wait_lock:
|
.wait_lock:
|
||||||
cmp [application_table_status],0
|
cmp [application_table_status],0
|
||||||
je .get_lock
|
je .get_lock
|
||||||
@ -125,7 +124,7 @@ proc fs_exec_EX stdcall file_name:dword, cmd_line:dword, flags:dword
|
|||||||
call get_new_process_place
|
call get_new_process_place
|
||||||
test eax, eax
|
test eax, eax
|
||||||
mov ecx, -0x20 ; too many processes
|
mov ecx, -0x20 ; too many processes
|
||||||
jz .err
|
jz .err_hdr
|
||||||
|
|
||||||
mov [slot], eax
|
mov [slot], eax
|
||||||
shl eax, 8
|
shl eax, 8
|
||||||
@ -172,13 +171,17 @@ proc fs_exec_EX stdcall file_name:dword, cmd_line:dword, flags:dword
|
|||||||
mov [ebx+APPDATA.mem_size],eax
|
mov [ebx+APPDATA.mem_size],eax
|
||||||
|
|
||||||
mov ecx, [file_size]
|
mov ecx, [file_size]
|
||||||
add ecx, 3
|
mov eax, ecx
|
||||||
shr ecx, 2
|
shr ecx, 2
|
||||||
mov esi, [file_base]
|
mov esi, [file_base]
|
||||||
mov edi, new_app_base
|
mov edi, new_app_base
|
||||||
cld
|
cld
|
||||||
rep movsd
|
rep movsd
|
||||||
|
and eax, 3
|
||||||
|
jz @F
|
||||||
|
mov ecx, eax
|
||||||
|
rep movsb
|
||||||
|
@@:
|
||||||
stdcall kernel_free, [file_base]
|
stdcall kernel_free, [file_base]
|
||||||
lea eax, [app_cmdline]
|
lea eax, [app_cmdline]
|
||||||
stdcall set_app_params ,[slot],eax,[cmd_line],\
|
stdcall set_app_params ,[slot],eax,[cmd_line],\
|
||||||
@ -187,16 +190,18 @@ proc fs_exec_EX stdcall file_name:dword, cmd_line:dword, flags:dword
|
|||||||
mov eax, [save_cr3]
|
mov eax, [save_cr3]
|
||||||
call set_cr3
|
call set_cr3
|
||||||
|
|
||||||
xor eax, eax
|
|
||||||
mov [application_table_status],eax ;unlock application_table_status mutex
|
|
||||||
popfd
|
popfd
|
||||||
|
xor ebx, ebx
|
||||||
|
mov [application_table_status],ebx ;unlock application_table_status mutex
|
||||||
mov eax,[process_number] ;set result
|
mov eax,[process_number] ;set result
|
||||||
ret
|
ret
|
||||||
.failed:
|
.failed:
|
||||||
mov eax, [save_cr3]
|
mov eax, [save_cr3]
|
||||||
call set_cr3
|
call set_cr3
|
||||||
.err:
|
.err_hdr:
|
||||||
|
stdcall kernel_free,[file_base]
|
||||||
popfd
|
popfd
|
||||||
|
.err_file:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [application_table_status],eax
|
mov [application_table_status],eax
|
||||||
ret
|
ret
|
||||||
|
@ -693,8 +693,23 @@ proc init_codec
|
|||||||
counter dd ?
|
counter dd ?
|
||||||
endl
|
endl
|
||||||
|
|
||||||
|
mov esi, msgControl
|
||||||
|
call SysMsgBoardStr
|
||||||
|
|
||||||
|
mov edx, GLOB_CTRL
|
||||||
|
call [ctrl.ctrl_read32]
|
||||||
|
call dword2str
|
||||||
|
call SysMsgBoardStr
|
||||||
|
|
||||||
|
mov esi, msgStatus
|
||||||
|
call SysMsgBoardStr
|
||||||
|
|
||||||
mov edx, CTRL_STAT
|
mov edx, CTRL_STAT
|
||||||
call [ctrl.ctrl_read32]
|
call [ctrl.ctrl_read32]
|
||||||
|
|
||||||
|
call dword2str
|
||||||
|
call SysMsgBoardStr
|
||||||
|
|
||||||
test eax, CTRL_ST_CREADY
|
test eax, CTRL_ST_CREADY
|
||||||
jnz .ready
|
jnz .ready
|
||||||
|
|
||||||
@ -1107,6 +1122,21 @@ proc ctrl_io_w32
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
align 4
|
||||||
|
dword2str:
|
||||||
|
mov esi, hex_buff
|
||||||
|
mov ecx, -8
|
||||||
|
@@:
|
||||||
|
rol eax, 4
|
||||||
|
mov ebx, eax
|
||||||
|
and ebx, 0x0F
|
||||||
|
mov bl, [ebx+hexletters]
|
||||||
|
mov [8+esi+ecx], bl
|
||||||
|
inc ecx
|
||||||
|
jnz @B
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
include "codec.inc"
|
include "codec.inc"
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@ -1136,6 +1166,12 @@ msgWarm db 'warm reset',13,10,0
|
|||||||
msgWRFail db 'warm reset failed',13,10,0
|
msgWRFail db 'warm reset failed',13,10,0
|
||||||
msgCRFail db 'cold reset failed',13,10,0
|
msgCRFail db 'cold reset failed',13,10,0
|
||||||
msgCFail db 'codec not ready',13,10,0
|
msgCFail db 'codec not ready',13,10,0
|
||||||
|
msgStatus db 'global status ',0
|
||||||
|
msgControl db 'global control ',0
|
||||||
|
|
||||||
|
hexletters db '0123456789ABCDEF'
|
||||||
|
hex_buff db 8 dup(0),13,10,0
|
||||||
|
|
||||||
|
|
||||||
section '.data' data readable writable align 16
|
section '.data' data readable writable align 16
|
||||||
|
|
||||||
|
@ -269,8 +269,8 @@ end virtual
|
|||||||
|
|
||||||
EVENT_NOTIFY equ 0x00000200
|
EVENT_NOTIFY equ 0x00000200
|
||||||
|
|
||||||
OS_BASE equ 0; 0x80400000
|
OS_BASE equ 0;
|
||||||
new_app_base equ 0x60400000; 0x01000000
|
new_app_base equ 0x60400000
|
||||||
PROC_BASE equ OS_BASE+0x0080000
|
PROC_BASE equ OS_BASE+0x0080000
|
||||||
|
|
||||||
public START
|
public START
|
||||||
@ -830,8 +830,23 @@ proc init_codec
|
|||||||
counter dd ?
|
counter dd ?
|
||||||
endl
|
endl
|
||||||
|
|
||||||
|
mov esi, msgControl
|
||||||
|
call SysMsgBoardStr
|
||||||
|
|
||||||
|
mov edx, GLOB_CTRL
|
||||||
|
call [ctrl.ctrl_read32]
|
||||||
|
call dword2str
|
||||||
|
call SysMsgBoardStr
|
||||||
|
|
||||||
|
mov esi, msgStatus
|
||||||
|
call SysMsgBoardStr
|
||||||
|
|
||||||
mov edx, CTRL_STAT
|
mov edx, CTRL_STAT
|
||||||
call [ctrl.ctrl_read32]
|
call [ctrl.ctrl_read32]
|
||||||
|
|
||||||
|
call dword2str
|
||||||
|
call SysMsgBoardStr
|
||||||
|
|
||||||
test eax, CTRL_ST_CREADY
|
test eax, CTRL_ST_CREADY
|
||||||
jnz .ready
|
jnz .ready
|
||||||
|
|
||||||
@ -1307,6 +1322,23 @@ proc ctrl_mem_w32
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
align 4
|
||||||
|
dword2str:
|
||||||
|
mov esi, hex_buff
|
||||||
|
mov ecx, -8
|
||||||
|
@@:
|
||||||
|
rol eax, 4
|
||||||
|
mov ebx, eax
|
||||||
|
and ebx, 0x0F
|
||||||
|
mov bl, [ebx+hexletters]
|
||||||
|
mov [8+esi+ecx], bl
|
||||||
|
inc ecx
|
||||||
|
jnz @B
|
||||||
|
ret
|
||||||
|
|
||||||
|
hexletters db '0123456789ABCDEF'
|
||||||
|
hex_buff db 8 dup(0),13,10,0
|
||||||
|
|
||||||
|
|
||||||
include "codec.inc"
|
include "codec.inc"
|
||||||
|
|
||||||
@ -1376,6 +1408,8 @@ msgWRFail db 'warm reset failed',13,10,0
|
|||||||
msgCRFail db 'cold reset failed',13,10,0
|
msgCRFail db 'cold reset failed',13,10,0
|
||||||
msgCFail db 'codec not ready',13,10,0
|
msgCFail db 'codec not ready',13,10,0
|
||||||
msgResetOk db 'reset complete',13,10,0
|
msgResetOk db 'reset complete',13,10,0
|
||||||
|
msgStatus db 'global status ',0
|
||||||
|
msgControl db 'global control ',0
|
||||||
|
|
||||||
section '.data' data readable writable align 16
|
section '.data' data readable writable align 16
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user