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
|
||||
jz .longname
|
||||
push ecx
|
||||
mov ecx, 8
|
||||
push edi ebp ecx
|
||||
push edi ebp
|
||||
test byte [ebp-4], 1
|
||||
jnz .unicode_short
|
||||
|
||||
mov eax, [edi]
|
||||
mov ecx, [edi+4]
|
||||
mov [ebp], eax
|
||||
mov [ebp+4], ecx
|
||||
|
||||
mov ecx, 8
|
||||
@@:
|
||||
mov al, [edi]
|
||||
inc edi
|
||||
mov [ebp], al
|
||||
inc ebp
|
||||
loop @b
|
||||
pop ecx
|
||||
@@:
|
||||
cmp byte [ebp-1], ' '
|
||||
jnz @f
|
||||
dec ebp
|
||||
loop @b
|
||||
@@:
|
||||
mov byte [ebp], '.'
|
||||
inc ebp
|
||||
cmp byte [ebp+ecx-1], ' '
|
||||
loope @b
|
||||
|
||||
mov eax, [edi+8]
|
||||
cmp al, ' '
|
||||
je .done
|
||||
shl eax, 8
|
||||
mov al, '.'
|
||||
|
||||
lea ebp, [ebp+ecx+1]
|
||||
mov [ebp], eax
|
||||
mov ecx, 3
|
||||
push ecx
|
||||
@@:
|
||||
mov al, [edi]
|
||||
inc edi
|
||||
mov [ebp], al
|
||||
inc ebp
|
||||
loop @b
|
||||
pop ecx
|
||||
@@:
|
||||
cmp byte [ebp-1], ' '
|
||||
jnz @f
|
||||
dec ebp
|
||||
rol eax, 8
|
||||
cmp al, ' '
|
||||
jne .done
|
||||
loop @b
|
||||
dec ebp
|
||||
@@:
|
||||
and byte [ebp], 0 ; CF=0
|
||||
.done:
|
||||
and byte [ebp+ecx+1], 0 ; CF=0
|
||||
pop ebp edi ecx
|
||||
ret
|
||||
.unicode_short:
|
||||
mov ecx, 8
|
||||
push ecx
|
||||
@@:
|
||||
mov al, [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]
|
||||
mov ecx, -ERROR_FILE_NOT_FOUND
|
||||
|
||||
test eax, eax
|
||||
jz .err ;fail
|
||||
jz .err_file
|
||||
|
||||
mov [file_base], eax
|
||||
mov [file_size], ebx
|
||||
|
||||
pushfd
|
||||
cli
|
||||
|
||||
lea ebx, [app_cmdline]
|
||||
call test_app_header
|
||||
mov ecx, -0x1F
|
||||
test eax, eax
|
||||
jz .err ;fail
|
||||
jz .err_hdr
|
||||
|
||||
mov esi, new_process_loading
|
||||
call sys_msg_board_str ; write message to message board
|
||||
|
||||
pushfd
|
||||
cli
|
||||
|
||||
.wait_lock:
|
||||
cmp [application_table_status],0
|
||||
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
|
||||
test eax, eax
|
||||
mov ecx, -0x20 ; too many processes
|
||||
jz .err
|
||||
jz .err_hdr
|
||||
|
||||
mov [slot], eax
|
||||
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 ecx, [file_size]
|
||||
add ecx, 3
|
||||
mov eax, ecx
|
||||
shr ecx, 2
|
||||
mov esi, [file_base]
|
||||
mov edi, new_app_base
|
||||
cld
|
||||
rep movsd
|
||||
|
||||
and eax, 3
|
||||
jz @F
|
||||
mov ecx, eax
|
||||
rep movsb
|
||||
@@:
|
||||
stdcall kernel_free, [file_base]
|
||||
lea eax, [app_cmdline]
|
||||
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]
|
||||
call set_cr3
|
||||
|
||||
xor eax, eax
|
||||
mov [application_table_status],eax ;unlock application_table_status mutex
|
||||
popfd
|
||||
xor ebx, ebx
|
||||
mov [application_table_status],ebx ;unlock application_table_status mutex
|
||||
mov eax,[process_number] ;set result
|
||||
ret
|
||||
.failed:
|
||||
mov eax, [save_cr3]
|
||||
call set_cr3
|
||||
.err:
|
||||
.err_hdr:
|
||||
stdcall kernel_free,[file_base]
|
||||
popfd
|
||||
.err_file:
|
||||
xor eax, eax
|
||||
mov [application_table_status],eax
|
||||
ret
|
||||
|
@ -693,8 +693,23 @@ proc init_codec
|
||||
counter dd ?
|
||||
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
|
||||
call [ctrl.ctrl_read32]
|
||||
|
||||
call dword2str
|
||||
call SysMsgBoardStr
|
||||
|
||||
test eax, CTRL_ST_CREADY
|
||||
jnz .ready
|
||||
|
||||
@ -1107,6 +1122,21 @@ proc ctrl_io_w32
|
||||
ret
|
||||
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"
|
||||
|
||||
align 4
|
||||
@ -1136,6 +1166,12 @@ msgWarm db 'warm reset',13,10,0
|
||||
msgWRFail db 'warm reset failed',13,10,0
|
||||
msgCRFail db 'cold reset failed',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
|
||||
|
||||
|
@ -269,8 +269,8 @@ end virtual
|
||||
|
||||
EVENT_NOTIFY equ 0x00000200
|
||||
|
||||
OS_BASE equ 0; 0x80400000
|
||||
new_app_base equ 0x60400000; 0x01000000
|
||||
OS_BASE equ 0;
|
||||
new_app_base equ 0x60400000
|
||||
PROC_BASE equ OS_BASE+0x0080000
|
||||
|
||||
public START
|
||||
@ -830,8 +830,23 @@ proc init_codec
|
||||
counter dd ?
|
||||
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
|
||||
call [ctrl.ctrl_read32]
|
||||
|
||||
call dword2str
|
||||
call SysMsgBoardStr
|
||||
|
||||
test eax, CTRL_ST_CREADY
|
||||
jnz .ready
|
||||
|
||||
@ -1307,6 +1322,23 @@ proc ctrl_mem_w32
|
||||
ret
|
||||
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"
|
||||
|
||||
@ -1376,6 +1408,8 @@ msgWRFail db 'warm reset failed',13,10,0
|
||||
msgCRFail db 'cold reset failed',13,10,0
|
||||
msgCFail db 'codec not ready',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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user