fix stack error in fs_exec

git-svn-id: svn://kolibrios.org@247 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2006-12-24 07:50:24 +00:00
parent 08a4dc7f2d
commit 88e9e4be91
4 changed files with 145 additions and 73 deletions

View File

@ -102,7 +102,7 @@ ramdisk_free_space:
rdfs2:
shl ebx,9 ;free clusters*512
mov edi,ebx
pop ecx ebx eax
ret
@ -193,7 +193,7 @@ fileread:
mov edi,edx
dec ebx
push edx
mov edx,ecx
mov edx,ecx
add edx,ebx
cmp edx,15 ;ebx+ecx=14+1
pushf
@ -308,7 +308,7 @@ filedelete:
call expand_filename
push eax ebx ecx edx esi edi
call rd_findfile
je fifoundd
pop edi esi edx ecx ebx eax ;file not found
@ -338,7 +338,7 @@ filedelete:
xor eax,eax ; file found
ret
filesave:
;----------------------------------------------------------
@ -471,9 +471,9 @@ mov [edi+22],ax ; time
jb rd_newsearch
mov eax,5 ;if file not found - eax=5
xor ebx,ebx
dec ebx ;ebx=0xffffffff and zf=0
dec ebx ;ebx=0xffffffff and zf=0
rd_ff:
ret
ret
; \begin{diamond}
@ -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
loop @b
dec ebp
@@:
and byte [ebp], 0 ; CF=0
rol eax, 8
cmp al, ' '
jne .done
loop @b
dec ebp
.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

View File

@ -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
mov eax,[process_number] ;set result
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

View File

@ -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,11 +1122,26 @@ 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
devices dd (CTRL_SIS shl 16)+VID_SIS,msg_AC, set_SIS
dd 0
dd 0
version dd 0x00010001
@ -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

View File

@ -109,16 +109,16 @@ CTRL_CNT_COLD equ 0x00000002 ; AC97 Cold Reset
CTRL_CNT_GIE equ 0x00000001 ; GPI Interrupt Enable
CODEC_REG_POWERDOWN equ 0x26
CODEC_REG_ST equ 0x26
CODEC_REG_ST equ 0x26
DEV_PLAY equ 1
DEV_STOP equ 2
DEV_CALLBACK equ 3
DEV_SET_BUFF equ 4
DEV_NOTIFY equ 5
DEV_PLAY equ 1
DEV_STOP equ 2
DEV_CALLBACK equ 3
DEV_SET_BUFF equ 4
DEV_NOTIFY equ 5
DEV_SET_MASTERVOL equ 6
DEV_GET_MASTERVOL equ 7
DEV_GET_INFO equ 8
DEV_GET_INFO equ 8
struc AC_CNTRL ;AC controller base class
{ .bus dd ?
@ -243,15 +243,15 @@ struc CODEC ;Audio Chip base class
}
struc CTRL_INFO
{ .pci_cmd dd ?
.irq dd ?
.glob_cntrl dd ?
.glob_sta dd ?
.codec_io_base dd ?
.ctrl_io_base dd ?
.codec_mem_base dd ?
.ctrl_mem_base dd ?
.codec_id dd ?
{ .pci_cmd dd ?
.irq dd ?
.glob_cntrl dd ?
.glob_sta dd ?
.codec_io_base dd ?
.ctrl_io_base dd ?
.codec_mem_base dd ?
.ctrl_mem_base dd ?
.codec_id dd ?
}
struc IOCTL
@ -267,10 +267,10 @@ virtual at 0
IOCTL IOCTL
end virtual
EVENT_NOTIFY equ 0x00000200
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"
@ -1364,18 +1396,20 @@ msgInvIRQ db 'IRQ line not assigned or invalid', 13,10, 0
msgPlay db 'start play', 13,10,0
msgStop db 'stop play', 13,10,0
msgNotify db 'call notify',13,10,0
msgIRQ db 'AC97 IRQ', 13,10,0
msgIRQ db 'AC97 IRQ', 13,10,0
msgInitCtrl db 'init controller',13,10,0
msgInitCodec db 'init codec',13,10,0
msgPrimBuff db 'create primary buffer',13,10,0
msgReg db 'set service handler',13,10,0
msgOk db 'service installed',13,10,0
msgReg db 'set service handler',13,10,0
msgOk db 'service installed',13,10,0
msgCold db 'cold reset',13,10,0
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
msgResetOk db 'reset complete',13,10,0
msgStatus db 'global status ',0
msgControl db 'global control ',0
section '.data' data readable writable align 16