kos-acpi: long command line support

git-svn-id: svn://kolibrios.org@6332 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2016-03-13 05:35:05 +00:00
parent ff6211368f
commit 97ab496246
2 changed files with 33 additions and 11 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

@ -50,11 +50,15 @@ macro _clear_ op
rep stosd rep stosd
} }
_strlen: align 4
mov ecx, 0xFFFFFFFF _strnlen:
mov edx, ecx
xor eax, eax xor eax, eax
repne scasb repne scasb
mov eax, 0xFFFFFFFE jne @F
inc ecx
@@:
mov eax, edx
sub eax, ecx sub eax, ecx
retn retn
@ -156,7 +160,8 @@ proc fs_execute
test edi, edi test edi, edi
jz @F jz @F
call _strlen mov ecx, 65535
call _strnlen
cmp eax, 256 cmp eax, 256
jb @F jb @F
lea ebx, [eax+1] lea ebx, [eax+1]
@ -185,8 +190,10 @@ proc fs_execute
mov esi, sizeof.APP_HDR mov esi, sizeof.APP_HDR
add esi, [cmdline_size] add esi, [cmdline_size]
mov edi, [filename] mov edi, [filename]
call _strlen mov ecx, 1023
call _strnlen
add esi, eax add esi, eax
mov [filename_size], eax mov [filename_size], eax
@ -834,7 +841,6 @@ proc map_process_image stdcall, img_size:dword, file_base:dword, file_size:dword
shr ecx, 2 shr ecx, 2
xor eax, eax xor eax, eax
rep stosd rep stosd
.done: .done:
.fail: .fail:
ret ret
@ -859,23 +865,39 @@ common_app_entry:
jnz .copy_filename jnz .copy_filename
add esi, ecx add esi, ecx
jmp .copy_cmdline jmp .check_cmdline
.copy_filename: .copy_filename:
rep movsb rep movsb
stosb stosb
.copy_cmdline: .check_cmdline:
mov edi, [ebp+APP_HDR.cmdline] mov edi, [ebp+APP_HDR.cmdline]
mov ecx, [ebp+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
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 rep movsb
stosb stosb
.check_tls_header: .check_tls_header:
cmp word [6], '02' cmp word [6], '02'
jne .cleanup jne .cleanup
@ -1044,9 +1066,7 @@ proc set_app_params stdcall,slot:dword, params:dword, flags: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]