1. Execution of files with long names (function 70.7).
2. Function 70 now supports folders on ramdisk. git-svn-id: svn://kolibrios.org@91 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
3ac6e40242
commit
c1783c769f
@ -914,25 +914,104 @@ ramdisk_root_next:
|
||||
cmc
|
||||
ret
|
||||
|
||||
ramdisk_root_extend_dir:
|
||||
stc
|
||||
ret
|
||||
|
||||
ramdisk_notroot_next:
|
||||
add edi, 0x20
|
||||
test edi, 0x1FF
|
||||
jz ramdisk_notroot_next_sector
|
||||
ret ; CF=0
|
||||
ramdisk_notroot_next_sector:
|
||||
push ecx
|
||||
mov ecx, [eax]
|
||||
mov ecx, [ecx*2+0x280000]
|
||||
and ecx, 0xFFF
|
||||
cmp ecx, 2849
|
||||
jae ramdisk_notroot_first.err2
|
||||
mov [eax], ecx
|
||||
pop ecx
|
||||
ramdisk_notroot_first:
|
||||
mov eax, [eax]
|
||||
cmp eax, 2
|
||||
jb .err
|
||||
cmp eax, 2849
|
||||
jae .err
|
||||
shl eax, 9
|
||||
lea edi, [eax+(31 shl 9)+0x100000]
|
||||
clc
|
||||
ret
|
||||
.err2:
|
||||
pop ecx
|
||||
.err:
|
||||
stc
|
||||
ret
|
||||
ramdisk_notroot_next_write:
|
||||
test edi, 0x1FF
|
||||
jz ramdisk_notroot_next_sector
|
||||
ramdisk_root_next_write:
|
||||
ret
|
||||
|
||||
ramdisk_notroot_extend_dir:
|
||||
pusha
|
||||
xor eax, eax
|
||||
mov edi, 0x280000
|
||||
mov ecx, 2849
|
||||
repnz scasw
|
||||
jnz .notfound
|
||||
mov word [edi-2], 0xFFF
|
||||
sub edi, 0x280000
|
||||
shr edi, 1
|
||||
dec edi
|
||||
mov eax, [esp+28]
|
||||
mov ecx, [eax]
|
||||
mov [0x280000+ecx*2], di
|
||||
mov [eax], edi
|
||||
shl edi, 9
|
||||
add edi, (31 shl 9)+0x100000
|
||||
mov [esp], edi
|
||||
xor eax, eax
|
||||
mov ecx, 128
|
||||
rep stosd
|
||||
popa
|
||||
clc
|
||||
ret
|
||||
.notfound:
|
||||
popa
|
||||
stc
|
||||
ret
|
||||
|
||||
rd_find_lfn:
|
||||
; in: esi->name
|
||||
; out: CF=1 - file not found
|
||||
; else CF=0 and edi->direntry
|
||||
push esi edi
|
||||
push 0
|
||||
push ramdisk_root_first
|
||||
push ramdisk_root_next
|
||||
.loop:
|
||||
call fat_find_lfn
|
||||
jc .notfound
|
||||
cmp byte [esi], 0
|
||||
jnz .notfound
|
||||
add esp, 12
|
||||
pop esi
|
||||
ret ; CF=0
|
||||
jz .found
|
||||
test byte [edi+11], 10h
|
||||
jz .notfound
|
||||
movzx eax, word [edi+26]
|
||||
mov [esp+8], eax
|
||||
mov dword [esp+4], ramdisk_notroot_first
|
||||
mov dword [esp], ramdisk_notroot_next
|
||||
jmp .loop
|
||||
.notfound:
|
||||
add esp, 8
|
||||
add esp, 12
|
||||
pop edi esi
|
||||
stc
|
||||
ret
|
||||
.found:
|
||||
mov eax, [esp+8]
|
||||
add esp, 16 ; CF=0
|
||||
pop esi
|
||||
ret
|
||||
|
||||
;----------------------------------------------------------------
|
||||
;
|
||||
@ -1041,37 +1120,76 @@ fs_RamdiskRead:
|
||||
;
|
||||
;--------------------------------------------------------------
|
||||
fs_RamdiskReadFolder:
|
||||
push edi
|
||||
cmp byte [esi], 0
|
||||
jz @f
|
||||
; ramdisk doesn't support folders
|
||||
mov eax, ERROR_ACCESS_DENIED
|
||||
jz .root
|
||||
call rd_find_lfn
|
||||
jnc .found
|
||||
pop edi
|
||||
or ebx, -1
|
||||
mov eax, ERROR_FILE_NOT_FOUND
|
||||
ret
|
||||
@@:
|
||||
push esi edi ecx
|
||||
.found:
|
||||
test byte [edi+11], 0x10
|
||||
jnz .found_dir
|
||||
pop edi
|
||||
or ebx, -1
|
||||
mov eax, ERROR_ACCESS_DENIED
|
||||
ret
|
||||
.found_dir:
|
||||
movzx eax, word [edi+26]
|
||||
add eax, 31
|
||||
push 0
|
||||
jmp .doit
|
||||
.root:
|
||||
mov eax, 19
|
||||
push 14
|
||||
.doit:
|
||||
push esi ecx ebp
|
||||
sub esp, 262*2 ; reserve space for LFN
|
||||
mov ebp, esp
|
||||
push dword [ebx+4] ; for fat_get_name: read ANSI/UNICODE names
|
||||
mov ebx, [ebx]
|
||||
; init header
|
||||
push ecx
|
||||
push eax ecx
|
||||
mov edi, edx
|
||||
mov ecx, 32/4
|
||||
xor eax, eax
|
||||
rep stosd
|
||||
mov byte [edx], 1 ; version
|
||||
pop ecx
|
||||
push ebp
|
||||
sub esp, 262*2 ; allocate space for LFN
|
||||
mov ebp, esp
|
||||
push dword [ebx+4] ; for fat_get_name: read ANSI/UNICODE name
|
||||
mov ebx, [ebx]
|
||||
; read root
|
||||
pop ecx eax
|
||||
mov esi, edi ; esi points to block of data of folder entry (BDFE)
|
||||
mov edi, 0x100000+512*19
|
||||
.main_loop:
|
||||
mov edi, eax
|
||||
shl edi, 9
|
||||
add edi, 0x100000
|
||||
push eax
|
||||
.l1:
|
||||
call fat_get_name
|
||||
jc .l2
|
||||
cmp byte [edi+11], 0xF
|
||||
jnz @f
|
||||
jnz .do_bdfe
|
||||
add edi, 0x20
|
||||
test edi, 0x1FF
|
||||
jnz .do_bdfe
|
||||
pop eax
|
||||
inc eax
|
||||
dec byte [esp+262*2+16]
|
||||
jz .done
|
||||
jns @f
|
||||
; read next sector from FAT
|
||||
mov eax, [(eax-31-1)*2+0x280000]
|
||||
and eax, 0xFFF
|
||||
cmp eax, 0xFF8
|
||||
jae .done
|
||||
add eax, 31
|
||||
mov byte [esp+262*2+16], 0
|
||||
@@:
|
||||
mov edi, eax
|
||||
shl edi, 9
|
||||
add edi, 0x100000
|
||||
push eax
|
||||
.do_bdfe:
|
||||
inc dword [edx+8] ; new file found
|
||||
dec ebx
|
||||
jns .l2
|
||||
@ -1081,8 +1199,23 @@ fs_RamdiskReadFolder:
|
||||
call fat_entry_to_bdfe
|
||||
.l2:
|
||||
add edi, 0x20
|
||||
cmp edi, 0x100000+512*33
|
||||
jb .l1
|
||||
test edi, 0x1FF
|
||||
jnz .l1
|
||||
pop eax
|
||||
inc eax
|
||||
dec byte [esp+262*2+16]
|
||||
jz .done
|
||||
jns @f
|
||||
; read next sector from FAT
|
||||
mov eax, [(eax-31-1)*2+0x280000]
|
||||
and eax, 0xFFF
|
||||
cmp eax, 0xFF8
|
||||
jae .done
|
||||
add eax, 31
|
||||
mov byte [esp+262*2+16], 0
|
||||
@@:
|
||||
jmp .main_loop
|
||||
.done:
|
||||
add esp, 262*2+4
|
||||
pop ebp
|
||||
mov ebx, [edx+4]
|
||||
@ -1091,7 +1224,7 @@ fs_RamdiskReadFolder:
|
||||
js @f
|
||||
mov al, ERROR_END_OF_FILE
|
||||
@@:
|
||||
pop ecx edi esi
|
||||
pop ecx esi edi edi
|
||||
ret
|
||||
|
||||
iglobal
|
||||
@ -1346,7 +1479,8 @@ fat_gen_short_name:
|
||||
fs_RamdiskRewrite:
|
||||
cmp byte [esi], 0
|
||||
jz @b
|
||||
; ramdisk doesn't support folders
|
||||
pushad
|
||||
xor ebp, ebp
|
||||
push esi
|
||||
@@:
|
||||
lodsb
|
||||
@ -1354,18 +1488,59 @@ fs_RamdiskRewrite:
|
||||
jz @f
|
||||
cmp al, '/'
|
||||
jnz @b
|
||||
lea ebp, [esi-1]
|
||||
jmp @b
|
||||
@@:
|
||||
pop esi
|
||||
.err5:
|
||||
mov eax, 5 ; file not found
|
||||
test ebp, ebp
|
||||
jnz .noroot
|
||||
push ramdisk_root_extend_dir
|
||||
push ramdisk_root_next_write
|
||||
push ebp
|
||||
push ramdisk_root_first
|
||||
push ramdisk_root_next
|
||||
jmp .common1
|
||||
.noroot:
|
||||
; check existence
|
||||
mov byte [ebp], 0
|
||||
call rd_find_lfn
|
||||
mov byte [ebp], '/'
|
||||
lea esi, [ebp+1]
|
||||
jnc @f
|
||||
mov eax, ERROR_FILE_NOT_FOUND
|
||||
.ret1:
|
||||
mov [esp+28], eax
|
||||
popad
|
||||
xor ebx, ebx
|
||||
ret
|
||||
@@:
|
||||
pop esi
|
||||
; check existence
|
||||
push edi
|
||||
call rd_find_lfn
|
||||
test byte [edi+11], 0x10 ; must be directory
|
||||
mov eax, ERROR_ACCESS_DENIED
|
||||
jz .ret1
|
||||
movzx ebp, word [edi+26] ; ebp=cluster
|
||||
mov eax, ERROR_FAT_TABLE
|
||||
cmp ebp, 2
|
||||
jb .ret1
|
||||
cmp ebp, 2849
|
||||
jae .ret1
|
||||
push ramdisk_notroot_extend_dir
|
||||
push ramdisk_notroot_next_write
|
||||
push ebp
|
||||
push ramdisk_notroot_first
|
||||
push ramdisk_notroot_next
|
||||
.common1:
|
||||
call fat_find_lfn
|
||||
jc .notfound
|
||||
; found, delete FAT chain
|
||||
; found; must not be directory
|
||||
test byte [edi+11], 10h
|
||||
jz @f
|
||||
add esp, 20
|
||||
popad
|
||||
mov eax, ERROR_ACCESS_DENIED
|
||||
xor ebx, ebx
|
||||
ret
|
||||
@@:
|
||||
; delete FAT chain
|
||||
push edi
|
||||
xor eax, eax
|
||||
mov dword [edi+28], eax ; zero size
|
||||
@ -1392,17 +1567,24 @@ fs_RamdiskRewrite:
|
||||
; file is not found; generate short name
|
||||
call fat_name_is_legal
|
||||
jc @f
|
||||
pop edi
|
||||
jmp .err5
|
||||
add esp, 20
|
||||
popad
|
||||
mov eax, ERROR_FILE_NOT_FOUND
|
||||
xor ebx, ebx
|
||||
ret
|
||||
@@:
|
||||
sub esp, 12
|
||||
mov edi, esp
|
||||
call fat_gen_short_name
|
||||
.test_short_name_loop:
|
||||
push esi ecx
|
||||
mov esi, 0x100000+512*19
|
||||
push esi edi ecx
|
||||
mov esi, edi
|
||||
lea eax, [esp+12+12+8]
|
||||
mov [eax], ebp
|
||||
call dword [eax-4]
|
||||
jc .found
|
||||
.test_short_name_entry:
|
||||
cmp byte [esi+11], 0xF
|
||||
cmp byte [edi+11], 0xF
|
||||
jz .test_short_name_cont
|
||||
mov ecx, 11
|
||||
push esi edi
|
||||
@ -1410,22 +1592,22 @@ fs_RamdiskRewrite:
|
||||
pop edi esi
|
||||
jz .short_name_found
|
||||
.test_short_name_cont:
|
||||
add esi, 20h
|
||||
cmp esi, 0x100000+512*33
|
||||
jb .test_short_name_entry
|
||||
pop ecx esi
|
||||
lea eax, [esp+12+12+8]
|
||||
call dword [eax-8]
|
||||
jnc .test_short_name_entry
|
||||
jmp .found
|
||||
.short_name_found:
|
||||
pop ecx edi esi
|
||||
call fat_next_short_name
|
||||
pop ecx esi
|
||||
jnc .test_short_name_loop
|
||||
.disk_full:
|
||||
add esp, 12
|
||||
pop edi
|
||||
add esp, 12+20
|
||||
popad
|
||||
mov eax, ERROR_DISK_FULL
|
||||
xor ebx, ebx
|
||||
ret
|
||||
.found:
|
||||
pop ecx edi esi
|
||||
; now find space in directory
|
||||
; we need to save LFN <=> LFN is not equal to short name <=> generated name contains '~'
|
||||
mov al, '~'
|
||||
@ -1452,9 +1634,15 @@ fs_RamdiskRewrite:
|
||||
div ecx
|
||||
pop edx
|
||||
.notilde:
|
||||
push -1
|
||||
push -1
|
||||
; find <eax> successive entries in directory
|
||||
xor ecx, ecx
|
||||
mov edi, 0x100000+512*19
|
||||
push eax
|
||||
lea eax, [esp+12+8+12+8]
|
||||
mov [eax], ebp
|
||||
call dword [eax-4]
|
||||
pop eax
|
||||
.scan_dir:
|
||||
cmp byte [edi], 0
|
||||
jz .free
|
||||
@ -1462,19 +1650,36 @@ fs_RamdiskRewrite:
|
||||
jz .free
|
||||
xor ecx, ecx
|
||||
.scan_cont:
|
||||
add edi, 0x20
|
||||
cmp edi, 0x100000+512*33
|
||||
jb .scan_dir
|
||||
pop edi ecx
|
||||
jmp .disk_full
|
||||
push eax
|
||||
lea eax, [esp+12+8+12+8]
|
||||
call dword [eax-8]
|
||||
pop eax
|
||||
jnc .scan_dir
|
||||
push eax
|
||||
lea eax, [esp+12+8+12+8]
|
||||
call dword [eax+8] ; extend directory
|
||||
pop eax
|
||||
jnc .scan_dir
|
||||
add esp, 8+8+12+20
|
||||
popad
|
||||
mov eax, ERROR_DISK_FULL
|
||||
xor ebx, ebx
|
||||
ret
|
||||
.free:
|
||||
test ecx, ecx
|
||||
jnz @f
|
||||
mov [esp], edi
|
||||
mov ecx, [esp+8+8+12+8]
|
||||
mov [esp+4], ecx
|
||||
xor ecx, ecx
|
||||
@@:
|
||||
inc ecx
|
||||
cmp ecx, eax
|
||||
jb .scan_cont
|
||||
; found!
|
||||
; calculate name checksum
|
||||
push esi ecx
|
||||
mov esi, [esp+8]
|
||||
mov esi, [esp+8+8]
|
||||
mov ecx, 11
|
||||
xor eax, eax
|
||||
@@:
|
||||
@ -1483,39 +1688,40 @@ fs_RamdiskRewrite:
|
||||
inc esi
|
||||
loop @b
|
||||
pop ecx esi
|
||||
pop edi
|
||||
pop dword [esp+8+12+8]
|
||||
; edi points to last entry in free chunk
|
||||
dec ecx
|
||||
jz .nolfn
|
||||
push esi
|
||||
push edi
|
||||
push eax
|
||||
mov al, 40h
|
||||
.writelfn:
|
||||
sub edi, 20h
|
||||
push ecx eax
|
||||
mov eax, [esp+8]
|
||||
sub eax, edi
|
||||
shr eax, 5
|
||||
cmp ecx, 1
|
||||
jnz @f
|
||||
or al, 40h
|
||||
@@:
|
||||
or al, cl
|
||||
mov esi, [esp+4]
|
||||
push ecx
|
||||
dec ecx
|
||||
imul ecx, 13
|
||||
add esi, ecx
|
||||
stosb
|
||||
mov cl, 5
|
||||
call .read_symbols
|
||||
mov ax, 0xF
|
||||
stosw
|
||||
pop eax
|
||||
mov al, [esp+4]
|
||||
stosb
|
||||
push eax
|
||||
mov cl, 6
|
||||
call .read_symbols
|
||||
xor eax, eax
|
||||
stosw
|
||||
mov cl, 2
|
||||
call .read_symbols
|
||||
pop eax ecx
|
||||
sub edi, 0x20
|
||||
pop ecx
|
||||
lea eax, [esp+8+8+12+8]
|
||||
call dword [eax+4] ; next write
|
||||
xor eax, eax
|
||||
loop .writelfn
|
||||
pop edi
|
||||
pop eax
|
||||
pop esi
|
||||
.nolfn:
|
||||
xchg esi, [esp]
|
||||
@ -1537,7 +1743,7 @@ fs_RamdiskRewrite:
|
||||
and word [edi+26], 0 ; low word of cluster - to be filled
|
||||
and dword [edi+28], 0 ; file size - to be filled
|
||||
.doit:
|
||||
push ecx edx
|
||||
push edx
|
||||
push ecx
|
||||
push edi
|
||||
add edi, 26 ; edi points to low word of cluster
|
||||
@ -1578,18 +1784,20 @@ fs_RamdiskRewrite:
|
||||
jnz .write_loop
|
||||
.done:
|
||||
mov ebx, edx
|
||||
pop edi edi ecx edx ecx
|
||||
pop edi edi ecx edx
|
||||
sub ebx, edx
|
||||
mov [edi+28], ebx
|
||||
pop edi
|
||||
add esp, 20
|
||||
popad
|
||||
xor eax, eax
|
||||
ret
|
||||
.disk_full2:
|
||||
mov ebx, edx
|
||||
pop edi edi ecx edx ecx
|
||||
pop edi edi ecx edx
|
||||
sub ebx, edx
|
||||
mov [edi+28], ebx
|
||||
pop edi
|
||||
add esp, 20
|
||||
popad
|
||||
push ERROR_DISK_FULL
|
||||
pop eax
|
||||
ret
|
||||
@ -1654,4 +1862,95 @@ fs_RamdiskSetFileInfo:
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
;----------------------------------------------------------------
|
||||
;
|
||||
; fs_RamdiskExecute - LFN variant for executing on sys floppy
|
||||
;
|
||||
; esi points to ramdisk filename (e.g. 'launcher')
|
||||
; ebp points to full filename (e.g. '/rd/1/launcher')
|
||||
; dword [ebx] = flags
|
||||
; dword [ebx+4] = cmdline
|
||||
;
|
||||
; ret ebx,edx destroyed
|
||||
; eax > 0 - PID, < 0 - error
|
||||
;
|
||||
;--------------------------------------------------------------
|
||||
fs_RamdiskExecute:
|
||||
mov edx, [ebx]
|
||||
mov ebx, [ebx+4]
|
||||
test ebx, ebx
|
||||
jz @f
|
||||
add ebx, std_application_base_address
|
||||
@@:
|
||||
|
||||
;----------------------------------------------------------------
|
||||
;
|
||||
; fs_RamdiskExecute.flags - second entry
|
||||
;
|
||||
; esi points to ramdisk filename (kernel address)
|
||||
; ebp points to full filename
|
||||
; edx flags
|
||||
; ebx cmdline (kernel address)
|
||||
;
|
||||
; ret eax > 0 - PID, < 0 - error
|
||||
;
|
||||
;--------------------------------------------------------------
|
||||
|
||||
.flags:
|
||||
cmp byte [esi], 0
|
||||
jnz @f
|
||||
; cannot execute root!
|
||||
mov eax, -ERROR_ACCESS_DENIED
|
||||
ret
|
||||
@@:
|
||||
push edi
|
||||
call rd_find_lfn
|
||||
jnc .found
|
||||
pop edi
|
||||
mov eax, -ERROR_FILE_NOT_FOUND
|
||||
ret
|
||||
.found:
|
||||
movzx eax, word [edi+26] ; cluster
|
||||
push eax
|
||||
push dword [edi+28] ; size
|
||||
push .DoRead
|
||||
call fs_execute
|
||||
add esp, 12
|
||||
pop edi
|
||||
ret
|
||||
|
||||
.DoRead:
|
||||
; read next block
|
||||
; in: eax->parameters, edi->buffer
|
||||
; out: eax = error code
|
||||
pushad
|
||||
cmp dword [eax], 0 ; file size
|
||||
jz .eof
|
||||
mov edx, [eax+4] ; cluster
|
||||
lea esi, [edx+31]
|
||||
shl esi, 9
|
||||
add esi, 0x100000
|
||||
mov ecx, 512/4
|
||||
rep movsd
|
||||
mov ecx, [eax]
|
||||
sub ecx, 512
|
||||
jae @f
|
||||
add edi, ecx
|
||||
neg ecx
|
||||
push eax
|
||||
xor eax, eax
|
||||
rep stosb
|
||||
pop eax
|
||||
@@:
|
||||
mov [eax], ecx
|
||||
mov dx, [edx*2+0x280000]
|
||||
mov [eax+4], dx ; high word is already zero
|
||||
popad
|
||||
xor eax, eax
|
||||
ret
|
||||
.eof:
|
||||
popad
|
||||
mov eax, 6
|
||||
ret
|
||||
|
||||
; \end{diamond}
|
||||
|
@ -307,8 +307,8 @@ new_start_application_fl:
|
||||
jz .cleanfailed
|
||||
|
||||
mov eax,[new_process_place]
|
||||
call create_app_cr3_table ;create page directory for new process
|
||||
inc ecx ; -0x1E = no memory
|
||||
call create_app_cr3_table ;create page directory for new process
|
||||
test eax,eax
|
||||
jz .cleanfailed_mem
|
||||
|
||||
@ -563,14 +563,16 @@ new_start_application_fl:
|
||||
|
||||
mov ebx,[new_process_place]
|
||||
shl ebx,5
|
||||
mov [0x3000+ebx+0xa],byte 0 ;set process state - running
|
||||
; set if debuggee
|
||||
test byte [esp+28], 1
|
||||
jz .no_debug
|
||||
mov [0x3000+ebx+0xa],byte 1 ;set process state - suspended
|
||||
mov eax,[0x3000]
|
||||
mov [0x80000+ebx*8+0xac],eax ;set debugger PID - current
|
||||
test byte [esp+28], 1
|
||||
jz .no_debug
|
||||
mov [0x3000+ebx+0xa], byte 1 ; set process state - suspended
|
||||
mov eax, [0x3000]
|
||||
mov [0x80000+ebx*8+0xac], eax ;set debugger PID - current
|
||||
jmp .debug
|
||||
.no_debug:
|
||||
mov [0x3000+ebx+0xa], byte 0 ; set process state - running
|
||||
.debug:
|
||||
|
||||
mov esi,new_process_running
|
||||
call sys_msg_board_str ;output information about succefull startup
|
||||
@ -1269,9 +1271,9 @@ new_start_application_hd:
|
||||
jz .cleanfailed
|
||||
|
||||
mov eax,[new_process_place]
|
||||
inc ecx ; -0x1E = no memory
|
||||
call create_app_cr3_table ;create page directory
|
||||
test eax,eax
|
||||
inc ecx ; -0x1E = no memory
|
||||
jz .cleanfailed_mem
|
||||
|
||||
call MEM_Get_Linear_Address
|
||||
@ -1392,4 +1394,222 @@ new_start_application_hd:
|
||||
ret
|
||||
end if
|
||||
|
||||
include 'debug.inc'
|
||||
; \begin{diamond}
|
||||
include 'debug.inc'
|
||||
|
||||
fs_execute:
|
||||
; ebx - cmdline
|
||||
; edx - flags
|
||||
; ebp - full filename
|
||||
; [esp+4] = procedure DoRead, [esp+8] = filesize & [esp+12]... - arguments for it
|
||||
pushad
|
||||
; check filename length - with terminating NULL must be no more than 1024 symbols
|
||||
mov edi, ebp
|
||||
mov ecx, 1024
|
||||
xor eax, eax
|
||||
repnz scasb
|
||||
jz @f
|
||||
popad
|
||||
mov eax, -ERROR_FILE_NOT_FOUND
|
||||
ret
|
||||
@@:
|
||||
|
||||
mov esi, new_process_loading
|
||||
call sys_msg_board_str ; write message to message board
|
||||
|
||||
; lock application_table_status mutex
|
||||
.table_status:
|
||||
cli
|
||||
cmp [application_table_status], 0
|
||||
jz .stf
|
||||
sti
|
||||
call change_task
|
||||
jmp .table_status
|
||||
.stf:
|
||||
call set_application_table_status
|
||||
push ebx ; save command line pointer for add_app_parameters
|
||||
|
||||
call find_new_process_place ; find new process slot
|
||||
call safe_sti
|
||||
test eax, eax
|
||||
mov ecx, -0x20 ; too many processes
|
||||
jz .failed
|
||||
|
||||
; write application name
|
||||
push edi
|
||||
mov ecx, edi
|
||||
sub ecx, ebp
|
||||
mov [appl_path], ebp
|
||||
mov [appl_path_size], ecx
|
||||
dec edi
|
||||
std
|
||||
mov al, '/'
|
||||
repnz scasb
|
||||
cld
|
||||
jnz @f
|
||||
inc edi
|
||||
@@:
|
||||
inc edi
|
||||
; now edi points to name without path
|
||||
mov esi, edi
|
||||
mov ecx, 8 ; 8 chars for name
|
||||
mov edi, [new_process_place]
|
||||
shl edi, cl
|
||||
add edi, 0x80000
|
||||
.copy_process_name_loop:
|
||||
lodsb
|
||||
cmp al, '.'
|
||||
jz .copy_process_name_done
|
||||
test al, al
|
||||
jz .copy_process_name_done
|
||||
stosb
|
||||
loop .copy_process_name_loop
|
||||
.copy_process_name_done:
|
||||
mov al, ' '
|
||||
rep stosb
|
||||
pop eax
|
||||
mov cl, 3 ; 3 chars for extension
|
||||
dec esi
|
||||
@@:
|
||||
dec eax
|
||||
cmp eax, esi
|
||||
jbe .copy_process_ext_done
|
||||
cmp byte [eax], '.'
|
||||
jnz @b
|
||||
lea esi, [eax+1]
|
||||
.copy_process_ext_loop:
|
||||
lodsb
|
||||
test al, al
|
||||
jz .copy_process_ext_done
|
||||
stosb
|
||||
loop .copy_process_ext_loop
|
||||
.copy_process_ext_done:
|
||||
mov al, ' '
|
||||
rep stosb
|
||||
|
||||
; read header
|
||||
lea eax, [esp+8+36]
|
||||
mov edi, 0x90000
|
||||
call dword [eax-4]
|
||||
mov ecx, eax
|
||||
neg ecx
|
||||
jnz .cleanfailed
|
||||
; check menuet signature
|
||||
mov ecx, -0x1F
|
||||
cmp dword [0x90000], 'MENU'
|
||||
jnz .cleanfailed
|
||||
cmp word [0x90004], 'ET'
|
||||
jnz .cleanfailed
|
||||
call get_app_params
|
||||
mov ecx, -0x1F
|
||||
test esi, esi
|
||||
jz .cleanfailed
|
||||
|
||||
mov eax, [new_process_place]
|
||||
inc ecx ; -0x1E = no memory
|
||||
call create_app_cr3_table
|
||||
test eax, eax
|
||||
jz .cleanfailed_mem
|
||||
|
||||
call MEM_Get_Linear_Address
|
||||
|
||||
mov ebx, std_application_base_address
|
||||
mov ecx, [app_mem]
|
||||
add ecx, 4095
|
||||
shr ecx, 12
|
||||
mov edx, eax ; edx - linear address of page directory
|
||||
call mem_alloc_specified_region
|
||||
mov ecx, -0x1E ; no memory
|
||||
test eax, eax
|
||||
jz .cleanfailed_mem1
|
||||
|
||||
add edx, std_application_base_address shr 20
|
||||
mov eax, [edx]
|
||||
and eax, not 4095
|
||||
call MEM_Get_Linear_Address
|
||||
push edx ; save pointer to first page table
|
||||
mov edx, eax
|
||||
; read file
|
||||
; first block is already read to 0x90000
|
||||
mov eax, [edx]
|
||||
and eax, not 0xFFF
|
||||
call MEM_Get_Linear_Address
|
||||
mov esi, 0x90000
|
||||
mov edi, eax
|
||||
mov ecx, 512/4
|
||||
rep movsd
|
||||
sub edi, eax
|
||||
.loop1:
|
||||
; [esp] = pointer to current page directory entry
|
||||
; edx = pointer to current page table
|
||||
; edi = offset in page
|
||||
mov eax, [edx]
|
||||
and eax, not 0xFFF
|
||||
call MEM_Get_Linear_Address
|
||||
push edi
|
||||
add edi, eax
|
||||
lea eax, [esp+8+36+8]
|
||||
call dword [eax-4]
|
||||
pop edi
|
||||
test eax, eax
|
||||
jnz .endloop1
|
||||
add edi, 512 ; new offset
|
||||
cmp edi, 4096
|
||||
jb .loop1
|
||||
xor edi, edi
|
||||
add edx, 4 ; go to next page
|
||||
test edx, 4096-1
|
||||
jnz .loop1
|
||||
pop eax
|
||||
add eax, 4 ; go to next directory entry
|
||||
push eax
|
||||
mov eax, [eax]
|
||||
and eax, not 0xFFF
|
||||
call MEM_Get_Linear_Address
|
||||
mov edx, eax
|
||||
jmp .loop1
|
||||
.endloop1:
|
||||
pop edx
|
||||
cmp eax, 6
|
||||
jnz .cleanfailed_mem2
|
||||
call new_start_application_fl.add_app_parameters
|
||||
mov [esp+28], eax
|
||||
popad
|
||||
ret
|
||||
|
||||
.cleanfailed_mem2:
|
||||
; file read error; free all allocated mem
|
||||
mov ecx, eax
|
||||
neg ecx
|
||||
mov eax, [new_process_place]
|
||||
call dispose_app_cr3_table
|
||||
jmp .cleanfailed
|
||||
.cleanfailed_mem1:
|
||||
; there is mem for directory entry, but there is no mem for pages
|
||||
; so free directory entry
|
||||
mov eax, [new_process_place]
|
||||
shl eax, 8
|
||||
mov eax, [0x80000+eax+0xB8]
|
||||
call MEM_Free_Page
|
||||
.cleanfailed_mem:
|
||||
; there is no mem for directory entry, display message
|
||||
mov esi, start_not_enough_memory
|
||||
call sys_msg_board_str
|
||||
.cleanfailed:
|
||||
push ecx
|
||||
; clean process name, this avoid problems with @panel
|
||||
mov edi, [new_process_place]
|
||||
shl edi, 8
|
||||
add edi, 0x80000
|
||||
mov ecx, 11
|
||||
mov al, ' '
|
||||
rep stosb
|
||||
pop eax
|
||||
.failed:
|
||||
pop ebx
|
||||
mov [esp+28], eax
|
||||
popad
|
||||
mov [application_table_status], 0
|
||||
call safe_sti
|
||||
ret
|
||||
; \end{diamond}
|
||||
|
@ -581,7 +581,7 @@
|
||||
ç⮡ë ä®àá¨à®¢ âì ¢ë¡®à ¢ ¬¥î ¢ë室 .
|
||||
|
||||
======================================================================
|
||||
========= ”ãªæ¨ï 18, ¯®¤äãªæ¨ï 2 - § ¢¥àè¨âì ¯à®æ¥áá/¯®â®ª. ========
|
||||
==== ”ãªæ¨ï 18, ¯®¤äãªæ¨ï 2 - § ¢¥àè¨âì ¯à®æ¥áá/¯®â®ª ¯® á«®âã. ====
|
||||
======================================================================
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 18 - ®¬¥à äãªæ¨¨
|
||||
@ -592,6 +592,8 @@
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>¥«ì§ï § ¢¥àè¨âì ¯®â®ª ®¯¥à 樮®© á¨á⥬ë OS/IDLE (®¬¥à á«®â
|
||||
1), ¬®¦® § ¢¥àè¨âì «î¡®© ®¡ëçë© ¯®â®ª/¯à®æ¥áá.
|
||||
* ‘¬®âਠ⠪¦¥ ¯®¤äãªæ¨î 18 - § ¢¥à襨¥
|
||||
¯à®æ¥áá /¯®â®ª á § ¤ ë¬ ¨¤¥â¨ä¨ª â®à®¬.
|
||||
|
||||
======================================================================
|
||||
= ”ãªæ¨ï 18, ¯®¤äãªæ¨ï 3 - ᤥ« âì ªâ¨¢ë¬ ®ª® § ¤ ®£® ¯®â®ª . =
|
||||
@ -929,18 +931,21 @@ db 'Kolibri',0
|
||||
* eax = ®¡é¨© à §¬¥à ¨¬¥î饩áï ¯ ¬ï⨠¢ ª¨«®¡ ©â å
|
||||
|
||||
======================================================================
|
||||
====================== ”ãªæ¨ï 18¡ ¯®¤äãªæ¨ï 18 =====================
|
||||
===================== ‡ ¢¥à襨¥ ¯à®æ¥áá ¯® PID'ã ===================
|
||||
====================== ”ãªæ¨ï 18, ¯®¤äãªæ¨ï 18 =====================
|
||||
============= ‡ ¢¥àè¨âì ¯à®æ¥áá/¯®â®ª ¯® ¨¤¥â¨ä¨ª â®àã. =============
|
||||
======================================================================
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 18 - ®¬¥à äãªæ¨¨
|
||||
* ebx = 18 - ®¬¥à ¯®¤äãªæ¨¨
|
||||
* ecx = PID
|
||||
‚®§à é ¥¬®¥ § 票¥:
|
||||
* eax = 0 - ¯à®æ¥áá § ¢¥àè¥.
|
||||
* eax = -1 - ®è¨¡ª . (¯à®æ¥áá á â ª¨¬ PID ¥ áãé¥áâ¢ã¥â ¨«¨ ï¥âáï
|
||||
á¨á⥬ë¬)
|
||||
|
||||
* ecx = ¨¤¥â¨ä¨ª â®à ¯à®æ¥áá /¯®â®ª (PID/TID)
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* eax = 0 - ãᯥè®
|
||||
* eax = -1 - ®è¨¡ª (¯à®æ¥áá ¥ ©¤¥ ¨«¨ ï¥âáï á¨á⥬ë¬)
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>¥«ì§ï § ¢¥àè¨âì ¯®â®ª ®¯¥à 樮®© á¨á⥬ë OS/IDLE (®¬¥à á«®â
|
||||
1), ¬®¦® § ¢¥àè¨âì «î¡®© ®¡ëçë© ¯®â®ª/¯à®æ¥áá.
|
||||
* ‘¬®âਠ⠪¦¥ ¯®¤äãªæ¨î 2 - § ¢¥à襨¥
|
||||
¯à®æ¥áá /¯®â®ª ¯® § ¤ ®¬ã á«®âã.
|
||||
|
||||
======================================================================
|
||||
============ ”ãªæ¨ï 19 - § ¯ãáâ¨âì ¯à®£à ¬¬ã á à ¬¤¨áª . ============
|
||||
@ -953,7 +958,7 @@ db 'Kolibri',0
|
||||
* …᫨ eax > 0, â® eax ᮤ¥à¦¨â PID ᮧ¤ ®£® ¯à®æ¥áá
|
||||
* …᫨ eax < 0, â® -eax - ª®¤ ®è¨¡ª¨ ä ©«®¢®© á¨á⥬ë
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>â äãªæ¨ï ãáâ ५ ; ¨á¯®«ì§ã©â¥ ¯®¤äãªæ¨î 16 äãªæ¨¨ 58.
|
||||
* <20>â äãªæ¨ï ãáâ ५ ; ¨á¯®«ì§ã©â¥ ¯®¤äãªæ¨î 7 äãªæ¨¨ 70.
|
||||
* Š®¬ ¤ ï áâப ¤®«¦ § ª 稢 âìáï ᨬ¢®«®¬ á ª®¤®¬ 0
|
||||
(ASCIIZ-áâப ); ãç¨âë¢ îâáï «¨¡® ¢á¥ ᨬ¢®«ë ¤® § ¢¥àè î饣® ã«ï
|
||||
¢ª«îç¨â¥«ì®, «¨¡® ¯¥à¢ë¥ 256 ᨬ¢®«®¢, ¢ § ¢¨á¨¬®á⨠®â ⮣®,
|
||||
@ -3111,99 +3116,6 @@ dword-
|
||||
(¢¥à®ï⥥ ¢á¥£®, 㫨, ® íâ® ®¯à¥¤¥«ï¥âáï ãáâனá⢮¬) ¨
|
||||
íâ® ¡ã¤¥â áç¨â âìáï ãᯥ宬 (eax=0).
|
||||
|
||||
======================================================================
|
||||
========= ”ãªæ¨ï 58, ¯®¤äãªæ¨ï 12 - ¯®«ãç¨âì à §¬¥à ä ©« . =========
|
||||
======================================================================
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 58 - ®¬¥à äãªæ¨¨
|
||||
* ebx = 㪠§ â¥«ì ¨ä®à¬ 樮ãî áâàãªâãàã
|
||||
”®à¬ â ¨ä®à¬ 樮®© áâàãªâãàë:
|
||||
* +0: dword: 12 = ®¬¥à äãªæ¨¨
|
||||
* +4: dword: ¨£®à¨àã¥âáï
|
||||
* +8: dword: ¨£®à¨àã¥âáï
|
||||
* +12 = +0xC: dword: ¨£®à¨àã¥âáï
|
||||
* +16 = +0x10: dword: 㪠§ â¥«ì ¡ãä¥à ¤«ï à ¡®âë á¨á⥬ë
|
||||
(4096 ¡ ©â)
|
||||
* +20 = +0x14: ASCIIZ-¨¬ï ä ©« , ¯à ¢¨« ä®à¬¨à®¢ ¨ï ¨¬ñ 㪠§ ë ¢
|
||||
®¡é¥¬ ®¯¨á ¨¨
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* eax = 0 - ãᯥè®, ¨ ç¥ ª®¤ ®è¨¡ª¨ ä ©«®¢®© á¨á⥬ë
|
||||
* ebx = à §¬¥à ä ©« (¢ ¡ ©â å) ¨«¨ 0 ¤«ï HD, -1 ¤«ï RD,
|
||||
¥á«¨ ä ©« ¥ ©¤¥
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>â äãªæ¨ï ãáâ ५ , ¨á¯®«ì§ã©â¥ ¯®¤äãªæ¨î 5 äãªæ¨¨ 70.
|
||||
* ”ãªæ¨ï ¥ ¯®¤¤¥à¦¨¢ ¥âáï ¤«ï ¤¨áª¥â.
|
||||
* ’¥ªãé ï ॠ«¨§ æ¨ï ¯®§¢®«ï¥â â ª¦¥ ®¯à¥¤¥«ïâì à §¬¥à ¯ ¯ª¨
|
||||
(¯® 楯®çª¥ ª« áâ¥à®¢ ¢ FAT), ® ¥ á«¥¤ã¥â íâ® ¯®« £ âìáï.
|
||||
|
||||
======================================================================
|
||||
===== ”ãªæ¨ï 58, ¯®¤äãªæ¨ï 13 - ¯®«ãç¨âì âਡãâë ä ©« /¯ ¯ª¨. =====
|
||||
======================================================================
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 58 - ®¬¥à äãªæ¨¨
|
||||
* ebx = 㪠§ â¥«ì ¨ä®à¬ 樮ãî áâàãªâãàã
|
||||
”®à¬ â ¨ä®à¬ 樮®© áâàãªâãàë:
|
||||
* +0: dword: 13 = ®¬¥à äãªæ¨¨
|
||||
* +4: dword: ¨£®à¨àã¥âáï
|
||||
* +8: dword: ¨£®à¨àã¥âáï
|
||||
* +12 = +0xC: dword: ¨£®à¨àã¥âáï
|
||||
* +16 = +0x10: dword: 㪠§ â¥«ì ¡ãä¥à ¤«ï à ¡®âë á¨á⥬ë
|
||||
(4096 ¡ ©â)
|
||||
* +20 = +0x14: ASCIIZ-¨¬ï ä ©« , ¯à ¢¨« ä®à¬¨à®¢ ¨ï ¨¬ñ 㪠§ ë ¢
|
||||
®¡é¥¬ ®¯¨á ¨¨
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* eax = 0 - ãᯥè®, ¨ ç¥ ª®¤ ®è¨¡ª¨ ä ©«®¢®© á¨á⥬ë
|
||||
* ebx = ¡ ©â FAT- âਡãâ (¤®¯®«¥ë© ã«ï¬¨ ¤® dword)
|
||||
¨«¨ 0 ¤«ï HD, -1 ¤«ï RD, ¥á«¨ ä ©« ¥ ©¤¥
|
||||
‡ ç¥¨ï ¤«ï ¡¨â®¢ FAT- âਡã⮢:
|
||||
* ¡¨â 0: ä ©« ⮫쪮 ¤«ï ç⥨ï
|
||||
* ¡¨â 1: ä ©« ï¥âáï áªàëâë¬
|
||||
* ¡¨â 2: ä ©« ï¥âáï á¨á⥬ë¬
|
||||
* ¡¨â 3: íâ® ¥ ä ©«, ¬¥âª ⮬ (¬®¦¥â ¢áâà¥ç âìáï ⮫쪮
|
||||
®¤¨ à § ¤¨áª¥, ¢ ª®à¥¢®¬ ª â «®£¥)
|
||||
* ¡¨â 4: íâ® ¯ ¯ª
|
||||
* ¡¨â 5: ä ©« ¥ à娢¨à®¢ «áï - ¬®£¨¥ ¯à®£à ¬¬ë à娢 樨 ¨¬¥îâ
|
||||
®¯æ¨î, ¯® ª®â®à®© à娢¨àãîâáï ⮫쪮 ä ©«ë á ãáâ ®¢«¥ë¬ í⨬
|
||||
¡¨â®¬, ¯®á«¥ 祣® íâ®â ¡¨â á¡à áë¢ ¥âáï - íâ® ¬®¦¥â ¡ëâì ¯®«¥§®
|
||||
¤«ï ¢â®¬ â¨ç¥áª®£® ᮧ¤ ¨ï backup- à娢®¢, ¨¡® ¯à¨ § ¯¨á¨
|
||||
¡¨â ®¡ëç® ãáâ ¢«¨¢ ¥âáï (¥ ¢ Kolibri, ¯à ¢¤ )
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>â äãªæ¨ï ãáâ ५ , ¨á¯®«ì§ã©â¥ ¯®¤äãªæ¨î 5 äãªæ¨¨ 70.
|
||||
* ”ãªæ¨ï ¥ ¯®¤¤¥à¦¨¢ ¥âáï ¤«ï ¤¨áª¥â.
|
||||
|
||||
======================================================================
|
||||
====================== ”ãªæ¨ï 58, ¯®¤äãªæ¨ï 14 =====================
|
||||
======= <20>®«ãç¨âì ¤ âã/¢à¥¬ï ¯®á«¥¤¥© ¬®¤¨ä¨ª 樨 ä ©« /¯ ¯ª¨. =======
|
||||
======================================================================
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 58 - ®¬¥à äãªæ¨¨
|
||||
* ebx = 㪠§ â¥«ì ¨ä®à¬ 樮ãî áâàãªâãàã
|
||||
”®à¬ â ¨ä®à¬ 樮®© áâàãªâãàë:
|
||||
* +0: dword: 14 = ®¬¥à äãªæ¨¨
|
||||
* +4: dword: ¨£®à¨àã¥âáï
|
||||
* +8: dword: ¨£®à¨àã¥âáï
|
||||
* +12 = +0xC: dword: ¨£®à¨àã¥âáï
|
||||
* +16 = +0x10: dword: 㪠§ â¥«ì ¡ãä¥à ¤«ï à ¡®âë á¨á⥬ë
|
||||
(4096 ¡ ©â)
|
||||
* +20 = +0x14: ASCIIZ-¨¬ï ä ©« , ¯à ¢¨« ä®à¬¨à®¢ ¨ï ¨¬ñ 㪠§ ë ¢
|
||||
®¡é¥¬ ®¯¨á ¨¨
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* eax = 0 - ãᯥè®, ¨ ç¥ ª®¤ ®è¨¡ª¨ ä ©«®¢®© á¨á⥬ë
|
||||
* ebx = ¤ â /¢à¥¬ï ¢ ä®à¬ ⥠FAT ¨«¨ 0 ¤«ï HD, -1 ¤«ï RD,
|
||||
¥á«¨ ä ©« ¥ ©¤¥
|
||||
* ¬« ¤è¥¥ á«®¢® = ¢à¥¬ï ¯®á«¥¤¥© ¬®¤¨ä¨ª 樨, hhhhhmmmmmmsssss:
|
||||
* ¬« ¤è¨¥ 5 ¡¨â = ç¨á«® ¤¢ãåᥪã¤ëå ¨â¥à¢ «®¢, 0<=s<=29
|
||||
* á«¥¤ãî騥 6 ¡¨â = ¬¨ãâë, 0<=m<=59
|
||||
* áâ à訥 5 ¡¨â = ç áë, 0<=h<=23
|
||||
* áâ à襥 á«®¢® = ¤ â ¯®á«¥¤¥© ¬®¤¨ä¨ª 樨, yyyyyyymmmmddddd:
|
||||
* ¬« ¤è¨¥ 5 ¡¨â = ¤¥ì, 1<=d<=31
|
||||
* á«¥¤ãî騥 4 ¡¨â = ¬¥áïæ, 1<=m<=12
|
||||
* áâ à訥 7 ¡¨â = £®¤ ®â®á¨â¥«ì® 1980
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>â äãªæ¨ï ãáâ ५ , ¨á¯®«ì§ã©â¥ ¯®¤äãªæ¨î 5 äãªæ¨¨ 70.
|
||||
* ”ãªæ¨ï ¥ ¯®¤¤¥à¦¨¢ ¥âáï ¤«ï ¤¨áª¥â.
|
||||
* ‘®§¤ ¨¥ ä ©« /¯ ¯ª¨ áç¨â ¥âáï ¬®¤¨ä¨ª 樥©.
|
||||
|
||||
======================================================================
|
||||
= ”ãªæ¨ï 58, ¯®¤äãªæ¨ï 15 - ¯®«ãç¨âì ¨ä®à¬ æ¨î ® ä ©«®¢®© á¨á⥬¥.
|
||||
======================================================================
|
||||
@ -3267,6 +3179,7 @@ dword-
|
||||
* eax < 0 - ¯à®¨§®è« ®è¨¡ª , -eax ᮤ¥à¦¨â
|
||||
ª®¤ ®è¨¡ª¨ ä ©«®¢®© á¨á⥬ë
|
||||
‡ ¬¥ç ¨ï:
|
||||
* <20>â äãªæ¨ï ãáâ ५ , ¨á¯®«ì§ã©â¥ ¯®¤äãªæ¨î 7 äãªæ¨¨ 70.
|
||||
* Š®¬ ¤ ï áâப ¤®«¦ § ª 稢 âìáï ᨬ¢®«®¬ á ª®¤®¬ 0
|
||||
(ASCIIZ-áâப ); ãç¨âë¢ îâáï «¨¡® ¢á¥ ᨬ¢®«ë ¤® § ¢¥àè î饣® ã«ï
|
||||
¢ª«îç¨â¥«ì®, «¨¡® ¯¥à¢ë¥ 256 ᨬ¢®«®¢, ¢ § ¢¨á¨¬®á⨠®â ⮣®,
|
||||
@ -4051,7 +3964,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
||||
Ž¡é¨© ä®à¬ â ¨ä®à¬ 樮®© áâàãªâãàë:
|
||||
* +0: dword: ®¬¥à ¯®¤äãªæ¨¨
|
||||
* +4: dword: ᬥ饨¥ ¢ ä ©«¥
|
||||
* +8: dword: áâ à訩 dword ᬥ饨ï (¤®«¦¥ ¡ëâì 0)
|
||||
* +8: dword: áâ à訩 dword ᬥ饨ï (¤®«¦¥ ¡ëâì 0) ¨«¨ ¯®«¥ ä« £®¢
|
||||
* +12 = +0xC: dword: à §¬¥à
|
||||
* +16 = +0x10: dword: 㪠§ â¥«ì ¤ ë¥
|
||||
* +20 = +0x14: n db: ASCIIZ-áâப á ¨¬¥¥¬ ä ©«
|
||||
@ -4069,10 +3982,13 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
||||
* /FD/1 = /FLOPPYDISK/1 ¤«ï ¤®áâ㯠ª ¯¥à¢®¬ã ä«®¯¯¨-¤¨áª®¢®¤ã,
|
||||
/FD/2 = /FLOPPYDISK/2 ¤«ï ¢â®à®£® ä«®¯¯¨-¤¨áª®¢®¤
|
||||
* /HD0/x, /HD1/x, /HD2/x, /HD3/x ¤«ï ¤®áâ㯠ᮮ⢥âá⢥®
|
||||
ª ãáâனá⢠¬ IDE0 (Primary Master), IDE1 (Primary Slave),
|
||||
ª ¦ñá⪨¬ ¤¨áª ¬ IDE0 (Primary Master), IDE1 (Primary Slave),
|
||||
IDE2 (Secondary Master), IDE3 (Secondary Slave);
|
||||
x - ®¬¥à à §¤¥« ¢ë¡à ®¬ ¢¨ç¥áâ¥à¥, ¨§¬¥ï¥âáï ®â 1 ¤® 255
|
||||
( ª ¦¤®¬ ¨§ ¢¨ç¥áâ¥à®¢ 㬥à æ¨ï ç¨ ¥âáï á 1)
|
||||
* /CD0/1, /CD1/1, /CD2/1, /CD3/1 ¤«ï ¤®áâ㯠ᮮ⢥âá⢥®
|
||||
ª CD IDE0 (Primary Master), IDE1 (Primary Slave),
|
||||
IDE2 (Secondary Master), IDE3 (Secondary Slace)
|
||||
<EFBFBD>ਬ¥àë:
|
||||
* '/rd/1/kernel.asm',0
|
||||
* '/HD0/1/kernel.asm',0
|
||||
@ -4084,6 +4000,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
||||
* ¯®¤äãªæ¨ï 2 - ᮧ¤ ¨¥/¯¥à¥§ ¯¨áì ä ©«
|
||||
* ¯®¤äãªæ¨ï 5 - ¯®«ã票¥ âਡã⮢ ä ©« /¯ ¯ª¨
|
||||
* ¯®¤äãªæ¨ï 6 - ãáâ ®¢ª âਡã⮢ ä ©« /¯ ¯ª¨
|
||||
* ¯®¤äãªæ¨ï 7 - § ¯ã᪠¯à®£à ¬¬ë
|
||||
|
||||
======================================================================
|
||||
= ”ãªæ¨ï 70, ¯®¤äãªæ¨ï 0 - ç⥨¥ ä ©« á ¯®¤¤¥à¦ª®© ¤«¨ëå ¨¬ñ. =
|
||||
@ -4297,6 +4214,39 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
||||
* ”ãªæ¨ï ¥ ¯®¤¤¥à¦¨¢ ¥â ¢¨àâã «ìë¥ ¯ ¯ª¨ ⨯ /, /rd ¨
|
||||
ª®à¥¢ë¥ ¯ ¯ª¨ ⨯ /rd/1.
|
||||
|
||||
======================================================================
|
||||
============ ”ãªæ¨ï 70, ¯®¤äãªæ¨ï 7 - § ¯ã᪠¯à®£à ¬¬ë. ============
|
||||
======================================================================
|
||||
<EFBFBD> à ¬¥âàë:
|
||||
* eax = 70 - ®¬¥à äãªæ¨¨
|
||||
* ebx = 㪠§ â¥«ì ¨ä®à¬ 樮ãî áâàãªâãàã
|
||||
”®à¬ â ¨ä®à¬ 樮®© áâàãªâãàë:
|
||||
* +0: dword: 7 = ®¬¥à ¯®¤äãªæ¨¨
|
||||
* +4: dword: ¯®«¥ ä« £®¢:
|
||||
* ¡¨â 0: § ¯ãáâ¨âì ¯à®æ¥áá ª ª ®â« ¦¨¢ ¥¬ë©
|
||||
* ®áâ «ìë¥ ¡¨âë § १¥à¢¨à®¢ ë ¨ ¤®«¦ë ¡ëâì ãáâ ®¢«¥ë ¢ 0
|
||||
* +8: dword: 0 ¨«¨ 㪠§ ⥫ì ASCIIZ-áâபã á ¯ à ¬¥âà ¬¨
|
||||
* +12 = +0xC: dword: 0 (§ १¥à¢¨à®¢ ®)
|
||||
* +16 = +0x10: dword: 0 (§ १¥à¢¨à®¢ ®)
|
||||
* +20 = +0x14: ASCIIZ-¨¬ï ä ©« , ¯à ¢¨« ä®à¬¨à®¢ ¨ï ¨¬ñ 㪠§ ë ¢
|
||||
®¡é¥¬ ®¯¨á ¨¨
|
||||
¨«¨
|
||||
* +20 = +0x14: db 0
|
||||
* +21 = +0x15: dd 㪠§ ⥫ì ASCIIZ-áâபã á ¨¬¥¥¬ ä ©«
|
||||
‚®§¢à é ¥¬®¥ § 票¥:
|
||||
* eax > 0 - ¯à®£à ¬¬ § £à㦥 , eax ᮤ¥à¦¨â PID
|
||||
* eax < 0 - ¯à®¨§®è« ®è¨¡ª , -eax ᮤ¥à¦¨â
|
||||
ª®¤ ®è¨¡ª¨ ä ©«®¢®© á¨á⥬ë
|
||||
* ebx à §àãè ¥âáï
|
||||
‡ ¬¥ç ¨ï:
|
||||
* Š®¬ ¤ ï áâப ¤®«¦ § ª 稢 âìáï ᨬ¢®«®¬ á ª®¤®¬ 0
|
||||
(ASCIIZ-áâப ); ãç¨âë¢ îâáï «¨¡® ¢á¥ ᨬ¢®«ë ¤® § ¢¥àè î饣® ã«ï
|
||||
¢ª«îç¨â¥«ì®, «¨¡® ¯¥à¢ë¥ 256 ᨬ¢®«®¢, ¢ § ¢¨á¨¬®á⨠®â ⮣®,
|
||||
çâ® ¬¥ìè¥.
|
||||
* …᫨ ¯à®æ¥áá § ¯ã᪠¥âáï ª ª ®â« ¦¨¢ ¥¬ë©, ® ᮧ¤ ñâáï
|
||||
¢ § ¬®à®¦¥®¬ á®áâ®ï¨¨; ¤«ï § ¯ã᪠¨á¯®«ì§ã©â¥
|
||||
¯®¤äãªæ¨î 5 äãªæ¨¨ 69.
|
||||
|
||||
======================================================================
|
||||
========== ”ãªæ¨ï -1 - § ¢¥àè¨âì ¢ë¯®«¥¨¥ ¯®â®ª /¯à®æ¥áá =========
|
||||
======================================================================
|
||||
|
@ -1594,7 +1594,16 @@ fs_FloppyRewrite:
|
||||
.common1:
|
||||
call fat_find_lfn
|
||||
jc .notfound
|
||||
; found, delete FAT chain
|
||||
; found; must not be directory
|
||||
test byte [edi+11], 10h
|
||||
jz @f
|
||||
add esp, 28
|
||||
popad
|
||||
mov eax, ERROR_ACCESS_DENIED
|
||||
xor ebx, ebx
|
||||
ret
|
||||
@@:
|
||||
; delete FAT chain
|
||||
push edi
|
||||
xor eax, eax
|
||||
mov dword [edi+28], eax ; zero size
|
||||
@ -1960,4 +1969,106 @@ fs_FloppySetFileInfo:
|
||||
@@:
|
||||
ret
|
||||
|
||||
;----------------------------------------------------------------
|
||||
;
|
||||
; fs_FloppyExecute - LFN variant for executing from floppy
|
||||
;
|
||||
; esi points to floppy filename (e.g. 'dir1/name')
|
||||
; ebp points to full filename (e.g. '/fd/1/dir1/name')
|
||||
; dword [ebx] = flags
|
||||
; dword [ebx+4] = cmdline
|
||||
;
|
||||
; ret ebx,edx destroyed
|
||||
; eax > 0 - PID, < 0 - error
|
||||
;
|
||||
;--------------------------------------------------------------
|
||||
fs_FloppyExecute:
|
||||
mov edx, [ebx]
|
||||
mov ebx, [ebx+4]
|
||||
test ebx, ebx
|
||||
jz @f
|
||||
add ebx, std_application_base_address
|
||||
@@:
|
||||
|
||||
;----------------------------------------------------------------
|
||||
;
|
||||
; fs_FloppyExecute.flags - second entry
|
||||
;
|
||||
; esi points to floppy filename (kernel address)
|
||||
; ebp points to full filename
|
||||
; edx flags
|
||||
; ebx cmdline (kernel address)
|
||||
;
|
||||
; ret eax > 0 - PID, < 0 - error
|
||||
;
|
||||
;--------------------------------------------------------------
|
||||
|
||||
.flags:
|
||||
call read_flp_fat
|
||||
cmp byte [esi], 0
|
||||
jnz @f
|
||||
; cannot execute root!
|
||||
mov eax, -ERROR_ACCESS_DENIED
|
||||
ret
|
||||
@@:
|
||||
push edi
|
||||
call fd_find_lfn
|
||||
jnc .found
|
||||
pop edi
|
||||
mov eax, -ERROR_FILE_NOT_FOUND
|
||||
ret
|
||||
.found:
|
||||
movzx eax, word [edi+26] ; cluster
|
||||
push eax
|
||||
push dword [edi+28] ; size
|
||||
push .DoRead
|
||||
call fs_execute
|
||||
add esp, 12
|
||||
pop edi
|
||||
ret
|
||||
|
||||
.DoRead:
|
||||
; read next block
|
||||
; in: eax->parameters, edi->buffer
|
||||
; out: eax = error code
|
||||
pushad
|
||||
cmp dword [eax], 0 ; file size
|
||||
jz .eof
|
||||
mov eax, [eax+4] ; cluster
|
||||
add eax, 31
|
||||
call read_chs_sector
|
||||
cmp [FDC_Status], 0
|
||||
jnz .err
|
||||
pop edi
|
||||
mov esi, 0xD000
|
||||
push edi
|
||||
mov ecx, 512/4
|
||||
rep movsd
|
||||
mov eax, [esp+28]
|
||||
mov ecx, [eax]
|
||||
sub ecx, 512
|
||||
jae @f
|
||||
add edi, ecx
|
||||
neg ecx
|
||||
push eax
|
||||
xor eax, eax
|
||||
rep stosb
|
||||
pop eax
|
||||
@@:
|
||||
mov [eax], ecx
|
||||
mov edx, [eax+4]
|
||||
mov dx, [edx*2+0x282000]
|
||||
mov [eax+4], dx ; high word is already zero
|
||||
popad
|
||||
xor eax, eax
|
||||
ret
|
||||
.eof:
|
||||
popad
|
||||
mov eax, 6
|
||||
ret
|
||||
.err:
|
||||
popad
|
||||
mov eax, 11
|
||||
ret
|
||||
|
||||
; \end{diamond}
|
||||
|
@ -7,6 +7,7 @@
|
||||
;; Copyright 2002 Paolo Minazzi, paolo.minazzi@inwind.it ;;
|
||||
;; ;;
|
||||
;; See file COPYING for details ;;
|
||||
;; 23.06.2006 LFN start application - diamond ;;
|
||||
;; 15.06.2006 LFN get/set file/folder info - diamond ;;
|
||||
;; 27.05.2006 LFN create/rewrite file - diamond ;;
|
||||
;; 04.05.2006 LFN read folder - diamond ;;
|
||||
@ -3396,7 +3397,16 @@ fs_HdRewrite:
|
||||
.common1:
|
||||
call fat_find_lfn
|
||||
jc .notfound
|
||||
; found, delete FAT chain
|
||||
; found; must not be directory
|
||||
test byte [edi+11], 10h
|
||||
jz @f
|
||||
add esp, 32
|
||||
popad
|
||||
mov eax, ERROR_ACCESS_DENIED
|
||||
xor ebx, ebx
|
||||
ret
|
||||
@@:
|
||||
; delete FAT chain
|
||||
push edi
|
||||
xor eax, eax
|
||||
mov dword [edi+28], eax ; zero size
|
||||
@ -3801,4 +3811,124 @@ fs_HdSetFileInfo:
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
;----------------------------------------------------------------
|
||||
;
|
||||
; fs_HdExecute - LFN variant for executing from harddisk
|
||||
;
|
||||
; esi points to hd filename (e.g. 'dir1/name')
|
||||
; ebp points to full filename (e.g. '/hd0/1/dir1/name')
|
||||
; dword [ebx] = flags
|
||||
; dword [ebx+4] = cmdline
|
||||
;
|
||||
; ret ebx,edx destroyed
|
||||
; eax > 0 - PID, < 0 - error
|
||||
;
|
||||
;--------------------------------------------------------------
|
||||
fs_HdExecute:
|
||||
mov edx, [ebx]
|
||||
mov ebx, [ebx+4]
|
||||
test ebx, ebx
|
||||
jz @f
|
||||
add ebx, std_application_base_address
|
||||
@@:
|
||||
|
||||
;----------------------------------------------------------------
|
||||
;
|
||||
; fs_HdExecute.flags - second entry
|
||||
;
|
||||
; esi points to floppy filename (kernel address)
|
||||
; ebp points to full filename
|
||||
; edx flags
|
||||
; ebx cmdline (kernel address)
|
||||
;
|
||||
; ret eax > 0 - PID, < 0 - error
|
||||
;
|
||||
;--------------------------------------------------------------
|
||||
|
||||
.flags:
|
||||
cmp [fat_type], 0
|
||||
jnz @f
|
||||
mov eax, ERROR_UNKNOWN_FS
|
||||
ret
|
||||
@@:
|
||||
cmp byte [esi], 0
|
||||
jnz @f
|
||||
; cannot execute root!
|
||||
mov eax, -ERROR_ACCESS_DENIED
|
||||
ret
|
||||
@@:
|
||||
push edi
|
||||
call hd_find_lfn
|
||||
jnc .found
|
||||
pop edi
|
||||
mov eax, -ERROR_FILE_NOT_FOUND
|
||||
cmp [hd_error], 0
|
||||
jz @f
|
||||
mov al, -11
|
||||
@@:
|
||||
ret
|
||||
.found:
|
||||
mov eax, [edi+20-2]
|
||||
mov ax, [edi+26]
|
||||
push 0
|
||||
push eax
|
||||
push dword [edi+28] ; size
|
||||
push .DoRead
|
||||
call fs_execute
|
||||
add esp, 16
|
||||
pop edi
|
||||
ret
|
||||
|
||||
.DoRead:
|
||||
; read next block
|
||||
; in: eax->parameters, edi->buffer
|
||||
; out: eax = error code
|
||||
pushad
|
||||
cmp dword [eax], 0 ; file size
|
||||
jz .eof
|
||||
add eax, 4
|
||||
call fat_get_sector
|
||||
mov ebx, edi
|
||||
call hd_read
|
||||
cmp [hd_error], 0
|
||||
jnz .err
|
||||
mov eax, [esp+28]
|
||||
mov ecx, [eax]
|
||||
sub ecx, 512
|
||||
jae @f
|
||||
lea edi, [edi+ecx+512]
|
||||
neg ecx
|
||||
push eax
|
||||
xor eax, eax
|
||||
rep stosb
|
||||
pop eax
|
||||
@@:
|
||||
mov [eax], ecx
|
||||
mov edx, [eax+8]
|
||||
inc edx
|
||||
cmp edx, [SECTORS_PER_CLUSTER]
|
||||
jb @f
|
||||
push eax
|
||||
mov eax, [eax+4]
|
||||
call get_FAT
|
||||
cmp [hd_error], 0
|
||||
jnz .err
|
||||
mov ecx, eax
|
||||
pop eax
|
||||
mov [eax+4], ecx
|
||||
xor edx, edx
|
||||
@@:
|
||||
mov [eax+8], edx
|
||||
popad
|
||||
xor eax, eax
|
||||
ret
|
||||
.eof:
|
||||
popad
|
||||
mov eax, 6
|
||||
ret
|
||||
.err:
|
||||
popad
|
||||
mov eax, 11
|
||||
ret
|
||||
|
||||
; \end{diamond}
|
||||
|
@ -81,7 +81,7 @@ file_system_lfn:
|
||||
; 4 : set end of file - not implemented yet
|
||||
; 5 : get file/directory attributes structure
|
||||
; 6 : set file/directory attributes structure
|
||||
; 7 : start application - not implemented yet
|
||||
; 7 : start application
|
||||
; 8 : delete file - not implemented yet
|
||||
; 9 : create directory - not implemented yet
|
||||
; 10: rename file/directory - not implemented yet
|
||||
@ -90,11 +90,13 @@ file_system_lfn:
|
||||
; parse file name
|
||||
xchg ebx, eax
|
||||
lea esi, [ebx+20]
|
||||
mov ebp, esi ; for 'start app' function full path must be known
|
||||
lodsb
|
||||
test al, al
|
||||
jnz @f
|
||||
mov esi, [esi]
|
||||
add esi, std_application_base_address
|
||||
mov ebp, esi
|
||||
lodsb
|
||||
@@:
|
||||
cmp al, '/'
|
||||
@ -349,6 +351,7 @@ fs_RamdiskServices:
|
||||
dd fs_NotImplemented
|
||||
dd fs_RamdiskGetFileInfo
|
||||
dd fs_RamdiskSetFileInfo
|
||||
dd fs_RamdiskExecute
|
||||
fs_NumRamdiskServices = ($ - fs_RamdiskServices)/4
|
||||
|
||||
fs_OnFloppy:
|
||||
@ -377,6 +380,7 @@ fs_FloppyServices:
|
||||
dd fs_NotImplemented
|
||||
dd fs_FloppyGetFileInfo
|
||||
dd fs_FloppySetFileInfo
|
||||
dd fs_FloppyExecute
|
||||
fs_NumFloppyServices = ($ - fs_FloppyServices)/4
|
||||
|
||||
fs_OnHd0:
|
||||
@ -443,6 +447,7 @@ fs_HdServices:
|
||||
dd fs_NotImplemented
|
||||
dd fs_HdGetFileInfo
|
||||
dd fs_HdSetFileInfo
|
||||
dd fs_HdExecute
|
||||
fs_NumHdServices = ($ - fs_HdServices)/4
|
||||
|
||||
;*******************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user