diff --git a/kernel/trunk/blkdev/rd.inc b/kernel/trunk/blkdev/rd.inc index 3d7626cf22..3ebb641258 100644 --- a/kernel/trunk/blkdev/rd.inc +++ b/kernel/trunk/blkdev/rd.inc @@ -995,7 +995,7 @@ ramdisk_notroot_extend_dir: ret rd_find_lfn: -; in: esi->name +; in: esi+ebp -> name ; out: CF=1 - file not found ; else CF=0 and edi->direntry push esi edi @@ -1007,6 +1007,7 @@ rd_find_lfn: jc .notfound cmp byte [esi], 0 jz .found +.continue: test byte [edi+11], 10h jz .notfound movzx eax, word [edi+26] @@ -1020,6 +1021,12 @@ rd_find_lfn: stc ret .found: + test ebp, ebp + jz @f + mov esi, ebp + xor ebp, ebp + jmp .continue +@@: mov eax, [esp+8] add esp, 16 ; CF=0 pop esi @@ -1501,36 +1508,53 @@ fs_RamdiskRewrite: cmp byte [esi], 0 jz @b pushad - xor ebp, ebp + xor edi, edi push esi + test ebp, ebp + jz @f + mov esi, ebp @@: lodsb test al, al jz @f cmp al, '/' jnz @b - lea ebp, [esi-1] + lea edi, [esi-1] jmp @b @@: pop esi - test ebp, ebp + test edi, edi jnz .noroot + test ebp, ebp + jnz .hasebp push ramdisk_root_extend_dir push ramdisk_root_next_write - push ebp + push edi push ramdisk_root_first push ramdisk_root_next jmp .common1 +.hasebp: + mov eax, ERROR_ACCESS_DENIED + cmp byte [ebp], 0 + jz .ret1 + push ebp + xor ebp, ebp + call rd_find_lfn + pop esi + jc .notfound0 + jmp .common0 .noroot: mov eax, ERROR_ACCESS_DENIED - cmp byte [ebp+1], 0 + cmp byte [edi+1], 0 jz .ret1 ; check existence - mov byte [ebp], 0 + mov byte [edi], 0 + push edi call rd_find_lfn - mov byte [ebp], '/' - lea esi, [ebp+1] + pop esi + mov byte [esi], '/' jnc @f +.notfound0: mov eax, ERROR_FILE_NOT_FOUND .ret1: mov [esp+28], eax @@ -1538,6 +1562,8 @@ fs_RamdiskRewrite: xor ebx, ebx ret @@: + inc esi +.common0: test byte [edi+11], 0x10 ; must be directory mov eax, ERROR_ACCESS_DENIED jz .ret1 @@ -2283,97 +2309,6 @@ 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, RAMDISK - 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+RAMDISK_FAT] - mov [eax+4], dx ; high word is already zero - popad - xor eax, eax - ret -.eof: - popad - mov eax, 6 - ret - ;---------------------------------------------------------------- ; ; fs_RamdiskDelete - delete file or empty folder from ramdisk diff --git a/kernel/trunk/core/conf_lib.inc b/kernel/trunk/core/conf_lib.inc index 819a0a883a..9282a5219f 100644 --- a/kernel/trunk/core/conf_lib.inc +++ b/kernel/trunk/core/conf_lib.inc @@ -10,7 +10,7 @@ conf_file_loaded: db 0 ; флаг загрузки конфига conf_path_sect: db 'path',0 -conf_fname db '%sys%/sys.conf',0 +conf_fname db '/%sys%/sys.conf',0 diff --git a/kernel/trunk/core/dll.inc b/kernel/trunk/core/dll.inc index 8cf3a0d0fc..8fb051d306 100644 --- a/kernel/trunk/core/dll.inc +++ b/kernel/trunk/core/dll.inc @@ -526,10 +526,12 @@ proc load_file stdcall, file_name:dword lea edi, [eax+ebx] ;cleanup remain space mov ecx, 4096 ;from file end and ebx, 4095 + jz @f sub ecx, ebx xor eax, eax cld rep stosb +@@: mov ebx, [file_size] pop eax ret @@ -696,16 +698,16 @@ proc load_driver stdcall, driver_name:dword exports dd ? ;fake exports table dd ? - file_name rb 14+16+4+1 ; '/rd/1/drivers/.obj' + file_name rb 15+16+4+1 ; '/%sys%/drivers/.obj' endl lea edx, [file_name] - mov dword [edx], '%sys' - mov dword [edx+4], '%/dr' - mov dword [edx+8], 'iver' - mov word [edx+12], 's/' + mov dword [edx], '/%sy' + mov dword [edx+4], 's%/d' + mov dword [edx+8], 'rive' + mov dword [edx+12], 'rs/' mov esi, [driver_name] - lea edi, [edx+14] + lea edi, [edx+15] mov ecx, 16 @@: lodsb diff --git a/kernel/trunk/core/ext_lib.inc b/kernel/trunk/core/ext_lib.inc index 277d5f13e1..c2ececdd1b 100644 --- a/kernel/trunk/core/ext_lib.inc +++ b/kernel/trunk/core/ext_lib.inc @@ -15,7 +15,6 @@ macro library [name,fname] common dd 0 forward - align 4 __#name#_library_name__ db fname,0 } @@ -29,18 +28,17 @@ macro import lname,[name,sname] common dd 0 forward - align 4 __#name#_import_name__ db sname,0 } macro export [name,sname] { +align 4 forward dd __#name#_export_name__,name common dd 0 forward - align 4 __#name#_export_name__ db sname,0 } @@ -159,7 +157,9 @@ proc dll.Load, import_table:dword mov edi,s_libname - mov esi,sys_path + mov al, '/' + stosb + mov esi,sysdir_path @@: lodsb stosb or al,al @@ -306,4 +306,6 @@ proc mem.Free mptr ;////////////////////////////////////////////////////////// ret endp +uglobal s_libname db 64 dup (0) +endg diff --git a/kernel/trunk/core/sys32.inc b/kernel/trunk/core/sys32.inc index 25fdc41887..9ef6c70741 100644 --- a/kernel/trunk/core/sys32.inc +++ b/kernel/trunk/core/sys32.inc @@ -646,10 +646,15 @@ term9: mov ebx, [.slot] shl ebx, 8 + push ebx mov ebx,[SLOT_BASE+ebx+APPDATA.pl0_stack] stdcall kernel_free, ebx + pop ebx + mov ebx,[SLOT_BASE+ebx+APPDATA.cur_dir] + stdcall kernel_free, ebx + mov edi, [.slot] shl edi,8 add edi,SLOT_BASE diff --git a/kernel/trunk/core/syscall.inc b/kernel/trunk/core/syscall.inc index 430b0afb98..c73f1e6382 100644 --- a/kernel/trunk/core/syscall.inc +++ b/kernel/trunk/core/syscall.inc @@ -169,7 +169,7 @@ iglobal dd undefined_syscall ; 27-reserved dd sys_sb16II ; 28-SetSb16 dd sys_date ; 29-GetDate - dd undefined_syscall ; 30-reserved + dd sys_current_directory ; 30-Get/SetCurrentDirectory dd undefined_syscall ; 31-reserved dd syscall_delramdiskfile ; 32-DelRamdiskFile dd syscall_writeramdiskfile; 33-WriteRamdiskFile diff --git a/kernel/trunk/core/taskman.inc b/kernel/trunk/core/taskman.inc index be25cb0962..1d7fdcffef 100644 --- a/kernel/trunk/core/taskman.inc +++ b/kernel/trunk/core/taskman.inc @@ -44,6 +44,10 @@ macro _clear_ op rep stosd } +fs_execute_from_sysdir: + xor ebx, ebx + xor edx, edx + mov esi, sysdir_path align 4 proc fs_execute @@ -80,10 +84,34 @@ proc fs_execute ; [ebp] pointer to filename - lea eax, [filename] - mov dword [eax+1020],0 ;force terminate - ;string - stdcall strncpy, eax, [ebp], 1023 + lea edi, [filename] + lea ecx, [edi+1024] + mov al, '/' + stosb +@@: + cmp edi, ecx + jae .bigfilename + lodsb + stosb + test al, al + jnz @b + mov esi, [ebp] + test esi, esi + jz .namecopied + mov byte [edi-1], '/' +@@: + cmp edi, ecx + jae .bigfilename + lodsb + stosb + test al, al + jnz @b + jmp .namecopied +.bigfilename: + popad + mov eax, -ERROR_FILE_NOT_FOUND + ret +.namecopied: mov [cmdline], ebx test ebx, ebx @@ -688,7 +716,7 @@ proc read_process_memory mov [slot], eax mov [buff], ebx - mov [r_count], ecx + and [r_count], 0 mov [tmp_r_cnt], ecx mov [offset], edx @@ -724,6 +752,7 @@ proc read_process_memory mov edi, [buff] mov edx, ecx rep movsb + add [r_count], edx add [offset], edx sub [tmp_r_cnt], edx @@ -754,7 +783,7 @@ proc write_process_memory mov [slot], eax mov [buff], ebx - mov [w_count], ecx + and [w_count], 0 mov [tmp_w_cnt], ecx mov [offset], edx @@ -791,6 +820,7 @@ proc write_process_memory mov edx, ecx rep movsb + add [w_count], edx add [offset], edx sub [tmp_w_cnt], edx jnz .read_mem @@ -964,6 +994,16 @@ proc set_app_params stdcall,slot:dword, params:dword,\ mov eax, [pl0_stack] mov [SLOT_BASE+APPDATA.pl0_stack+ebx],eax + push ebx + stdcall kernel_alloc, 0x1000 + pop ebx + mov esi,[current_slot] + mov esi,[esi+APPDATA.cur_dir] + mov ecx,0x1000/4 + mov edi,eax + mov [ebx+SLOT_BASE+APPDATA.cur_dir],eax + rep movsd + shr ebx,3 mov eax, new_app_base mov dword [CURRENT_TASK+ebx+0x10],eax diff --git a/kernel/trunk/data32.inc b/kernel/trunk/data32.inc index 9c01167f90..b080d86bf2 100644 --- a/kernel/trunk/data32.inc +++ b/kernel/trunk/data32.inc @@ -82,30 +82,15 @@ szSTART db 'START',0 szEXPORTS db 'EXPORTS',0 szIMPORTS db 'IMPORTS',0 -firstapp db '%sys%/LAUNCHER',0 - -if 0 -char dd 0,0,0 - dd 2560 - dd FONT_I - db '%sys%/FONTS/CHAR.MT',0 - -char2 dd 0,0,0 - dd 2560 - dd FONT_II - db '%sys%/FONTS/CHAR2.MT',0 -else - -char db '%sys%/FONTS/CHAR.MT',0 -char2 db '%sys%/FONTS/CHAR2.MT',0 - -end if +firstapp db 'LAUNCHER',0 +char db '/%sys%/FONTS/CHAR.MT',0 +char2 db '/%sys%/FONTS/CHAR2.MT',0 bootpath db '/KOLIBRI ' bootpath2 db 0 vmode db 'drivers/VMODE.MDR',0 -vrr_m db '%sys%/VRR_M',0 +vrr_m db 'VRR_M',0 kernel_file db 'KERNEL MNT' diff --git a/kernel/trunk/docs/sysfuncr.txt b/kernel/trunk/docs/sysfuncr.txt index 666a93ae43..3f9726631f 100644 --- a/kernel/trunk/docs/sysfuncr.txt +++ b/kernel/trunk/docs/sysfuncr.txt @@ -1666,6 +1666,31 @@ db 'Kolibri',0 Замечания: * Системную дату можно установить функцией 22. +====================================================================== +================ Функция 30 - работа с текущей папкой. =============== +====================================================================== + +-------- Подфункция 1 - установить текущую папку для потока. --------- +Параметры: + * eax = 30 - номер функции + * ebx = 1 - номер подфункции + * ecx = указатель на ASCIIZ-строку с путём к новой текущей папке +Возвращаемое значение: + * функция не возвращает значения + +--------- Подфункция 2 - получить текущую папку для потока. ---------- +Параметры: + * eax = 30 - номер функции + * ebx = 2 - номер подфункции + * ecx = указатель на буфер + * edx = размер буфера +Возвращаемое значение: + * eax = длина имени текущей папки (включая завершающий 0) +Замечания: + * Если размера буфера недостаточно для копирования всего имени, + копируются только первые (edx-1) байт + и в конце ставится завершающий 0. + ====================================================================== ================ Функция 32 - удалить файл с рамдиска. =============== ====================================================================== diff --git a/kernel/trunk/docs/sysfuncs.txt b/kernel/trunk/docs/sysfuncs.txt index 6b31ce4626..62b7daa988 100644 --- a/kernel/trunk/docs/sysfuncs.txt +++ b/kernel/trunk/docs/sysfuncs.txt @@ -1641,6 +1641,30 @@ Returned value: Remarks: * To set system date use function 22. +====================================================================== +============= Function 30 - work with the current folder. ============ +====================================================================== + +--------- Subfunction 1 - set current folder for the thread. --------- +Parameters: + * eax = 30 - function number + * ebx = 1 - subfunction number + * ecx = pointer to ASCIIZ-string with the path to new current folder +Returned value: + * function does not return value + +--------- Subfunction 2 - get current folder for the thread. --------- +Parameters: + * eax = 30 - function number + * ebx = 2 - subfunction number + * ecx = pointer to buffer + * edx = size of buffer +Returned value: + * eax = size of the current folder's name (including terminating 0) +Remarks: + * If the buffer is too small to hold all data, only first (edx-1) + bytes are copied and than terminating 0 is inserted. + ====================================================================== =============== Function 32 - delete file from ramdisk. ============== ====================================================================== diff --git a/kernel/trunk/fs/fat12.inc b/kernel/trunk/fs/fat12.inc index 53849996c5..45e6725724 100644 --- a/kernel/trunk/fs/fat12.inc +++ b/kernel/trunk/fs/fat12.inc @@ -809,7 +809,7 @@ flp_notroot_extend_dir: ret fd_find_lfn: -; in: esi->name +; in: esi+ebp -> name ; out: CF=1 - file not found ; else CF=0 and edi->direntry, eax=directory cluster (0 for root) push esi edi @@ -821,6 +821,7 @@ fd_find_lfn: jc .notfound cmp byte [esi], 0 jz .found +.continue: test byte [edi+11], 10h jz .notfound movzx eax, word [edi+26] ; cluster @@ -834,6 +835,12 @@ fd_find_lfn: stc ret .found: + test ebp, ebp + jz @f + mov esi, ebp + xor ebp, ebp + jmp .continue +@@: mov eax, [esp+8] add eax, 31 cmp dword [esp], flp_root_next @@ -1116,20 +1123,25 @@ fs_FloppyRewrite: cmp [FDC_Status], 0 jnz fsfrfe pushad - xor ebp, ebp + xor edi, edi push esi + test ebp, ebp + jz @f + mov esi, ebp @@: lodsb test al, al jz @f cmp al, '/' jnz @b - lea ebp, [esi-1] + lea edi, [esi-1] jmp @b @@: pop esi - test ebp, ebp + test edi, edi jnz .noroot + test ebp, ebp + jnz .hasebp call read_flp_root cmp [FDC_Status], 0 jnz fsfrfe2 @@ -1142,16 +1154,28 @@ fs_FloppyRewrite: push flp_rootmem_first push flp_rootmem_next jmp .common1 +.hasebp: + mov eax, ERROR_ACCESS_DENIED + cmp byte [ebp], 0 + jz .ret1 + push ebp + xor ebp, ebp + call fd_find_lfn + pop esi + jc .notfound0 + jmp .common0 .noroot: mov eax, ERROR_ACCESS_DENIED - cmp byte [ebp+1], 0 + cmp byte [edi+1], 0 jz .ret1 ; check existence - mov byte [ebp], 0 + mov byte [edi], 0 + push edi call fd_find_lfn - mov byte [ebp], '/' - lea esi, [ebp+1] + pop esi + mov byte [esi], '/' jnc @f +.notfound0: mov eax, ERROR_FILE_NOT_FOUND .ret1: mov [esp+28], eax @@ -1159,6 +1183,8 @@ fs_FloppyRewrite: xor ebx, ebx ret @@: + inc esi +.common0: test byte [edi+11], 0x10 ; must be directory mov eax, ERROR_ACCESS_DENIED jz .ret1 @@ -2109,110 +2135,6 @@ fs_FloppySetFileInfo: @@: ret -if 0 -;---------------------------------------------------------------- -; -; 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, FDD_BUFF - 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+FLOPPY_FAT] - 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 if - ;---------------------------------------------------------------- ; ; fs_FloppyDelete - delete file or empty folder from floppy diff --git a/kernel/trunk/fs/fat32.inc b/kernel/trunk/fs/fat32.inc index f022eebb6b..4fdb6d156e 100644 --- a/kernel/trunk/fs/fat32.inc +++ b/kernel/trunk/fs/fat32.inc @@ -956,7 +956,7 @@ update_disk: ; \begin{diamond} hd_find_lfn: -; in: esi->name +; in: esi+ebp -> name ; out: CF=1 - file not found ; else CF=0 and edi->direntry, eax=sector ; destroys eax @@ -973,6 +973,7 @@ hd_find_lfn: jc .notfound cmp byte [esi], 0 jz .found +.continue: test byte [edi+11], 10h jz .notfound and dword [esp+12], 0 @@ -989,6 +990,12 @@ hd_find_lfn: stc ret .found: + test ebp, ebp + jz @f + mov esi, ebp + xor ebp, ebp + jmp .continue +@@: lea eax, [esp+8] cmp dword [eax], 0 jz .root @@ -1573,20 +1580,25 @@ fs_HdRewrite: cmp byte [esi], 0 jz fshrad pushad - xor ebp, ebp + xor edi, edi push esi + test ebp, ebp + jz @f + mov esi, ebp @@: lodsb test al, al jz @f cmp al, '/' jnz @b - lea ebp, [esi-1] + lea edi, [esi-1] jmp @b @@: pop esi - test ebp, ebp + test edi, edi jnz .noroot + test ebp, ebp + jnz .hasebp mov ebp, [ROOT_CLUSTER] cmp [fs_type], 32 jz .pushnotroot @@ -1600,16 +1612,28 @@ fs_HdRewrite: push fat16_root_first push fat16_root_next jmp .common1 +.hasebp: + mov eax, ERROR_ACCESS_DENIED + cmp byte [ebp], 0 + jz .ret1 + push ebp + xor ebp, ebp + call hd_find_lfn + pop esi + jc .notfound0 + jmp .common0 .noroot: mov eax, ERROR_ACCESS_DENIED - cmp byte [ebp+1], 0 + cmp byte [edi+1], 0 jz .ret1 ; check existence - mov byte [ebp], 0 + mov byte [edi], 0 + push edi call hd_find_lfn - mov byte [ebp], '/' - lea esi, [ebp+1] + pop esi + mov byte [esi], '/' jnc @f +.notfound0: mov eax, ERROR_FILE_NOT_FOUND .ret1: mov [esp+28], eax @@ -1617,6 +1641,8 @@ fs_HdRewrite: xor ebx, ebx ret @@: + inc esi +.common0: test byte [edi+11], 0x10 ; must be directory mov eax, ERROR_ACCESS_DENIED jz .ret1 @@ -2723,129 +2749,6 @@ fs_HdSetFileInfo: xor eax, eax ret -if 0 ; starting from revision 237 execute is implemented in taskman.inc - ; through fs_XxxGetFileInfo and fs_XxxRead -;---------------------------------------------------------------- -; -; 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 if - ;---------------------------------------------------------------- ; ; fs_HdDelete - delete file or empty folder from hard disk diff --git a/kernel/trunk/fs/fs_lfn.inc b/kernel/trunk/fs/fs_lfn.inc index 93f5634542..c069d432a8 100644 --- a/kernel/trunk/fs/fs_lfn.inc +++ b/kernel/trunk/fs/fs_lfn.inc @@ -6,8 +6,8 @@ $Revision$ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -image_of_eax EQU esp+44 ;36 -image_of_ebx EQU esp+32 ;24 +image_of_eax EQU esp+36 +image_of_ebx EQU esp+24 ; System function 70 - files with long names (LFN) ; diamond, 2006 @@ -82,12 +82,6 @@ virtual_root_query: dd 0 endg -end_of_file_system_lfn: - pop edx - stdcall kernel_free, edx - ret - - file_system_lfn: ; in: eax->fileinfo block ; operation codes: @@ -102,84 +96,39 @@ file_system_lfn: ; 8 : delete file ; 9 : create directory - ; чрьхэр рфЁхёр тючтЁрЄр - push eax - stdcall kernel_alloc, 200 - mov edx,eax - pop eax - - push edx - push end_of_file_system_lfn - mov ebx,edx - - mov ecx, [eax] - mov [ebx],ecx - - add ebx,4 - mov ecx, [eax+4] - mov [ebx],ecx - - add ebx,4 - mov ecx, [eax+8] - mov [ebx],ecx - - add ebx,4 - mov ecx, [eax+12] - mov [ebx],ecx - - add ebx,4 - mov ecx, [eax+16] - mov [ebx],ecx - - add ebx,4 - push edx ; !!!!!!!!!!!!!!!!!!! - ; eax - yэрўрыю ёЄрЁюую яръхЄр - ; edx - эрўрыю эютюую яръхЄр - ; ebx - ъєфр ыюцшЄ№ ёЄЁюъє - add eax,20 - mov cl, [eax] - test cl,cl - jnz @f - mov eax,[eax+1] -@@: - stdcall full_file_name,eax,ebx - pop eax - - - - ; add eax, std_application_base_address ; 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, '/' + jz .notcurdir + dec esi + mov ebp, esi + test al, al + jnz @f + xor ebp, ebp +@@: + mov esi, [current_slot] + mov esi, [esi+APPDATA.cur_dir] + jmp .parse_normal +.notcurdir: + cmp byte [esi], 0 + jz .rootdir + call process_replace_file_name +.parse_normal: cmp dword [ebx], 7 jne @F mov edx, [ebx+4] mov ebx, [ebx+8] - test ebx, ebx - jz .l1 - ; add ebx, new_app_base -.l1: - call fs_execute ; ebp, ebx, edx + call fs_execute ; esi+ebp, ebx, edx mov [image_of_eax], eax ret @@: - cmp al, '/' - jz @f -.notfound: - mov dword [image_of_eax], 5 ; file not found - ret -@@: - cmp byte [esi], 0 - jz .rootdir mov edi, rootdirs-8 xor ecx, ecx push esi @@ -189,7 +138,8 @@ file_system_lfn: scasd scasd mov cl, byte [edi] - jecxz .notfound + test cl, cl + jz .notfound inc edi push esi @@: @@ -356,6 +306,10 @@ file_system_lfn: mov [image_of_eax], eax mov [image_of_ebx], ebx ret +.notfound: + mov dword [image_of_eax], ERROR_FILE_NOT_FOUND + and dword [image_of_ebx], 0 + ret .found1: pop eax @@ -373,15 +327,21 @@ file_system_lfn: sub al, '0' cmp al, 9 ja .notfound - imul ecx, 10 - add ecx, eax + lea ecx, [ecx*5] + lea ecx, [ecx*2+eax] jmp @b .done1: - test ecx, ecx - jz .notfound + jecxz .notfound test al, al jnz @f dec esi +@@: + cmp byte [esi], 0 + jnz @f + test ebp, ebp + jz @f + mov esi, ebp + xor ebp, ebp @@: ; now [edi] contains handler address, ecx - partition number, ; esi points to ASCIIZ string - rest of name @@ -392,6 +352,7 @@ file_system_lfn: ; in: ecx = partition number ; esi -> relative (for device) name ; ebx -> fileinfo +; ebp = 0 or pointer to rest of name from folder addressed by esi ; out: [image_of_eax]=image of eax, [image_of_ebx]=image of ebx fs_OnRamdisk: @@ -424,7 +385,7 @@ fs_RamdiskServices: dd fs_RamdiskSetFileEnd dd fs_RamdiskGetFileInfo dd fs_RamdiskSetFileInfo - dd 0 ;fs_RamdiskExecute + dd 0 dd fs_RamdiskDelete dd fs_RamdiskCreateFolder fs_NumRamdiskServices = ($ - fs_RamdiskServices)/4 @@ -455,7 +416,7 @@ fs_FloppyServices: dd fs_FloppySetFileEnd dd fs_FloppyGetFileInfo dd fs_FloppySetFileInfo - dd 0 ;fs_FloppyExecute + dd 0 dd fs_FloppyDelete dd fs_FloppyCreateFolder fs_NumFloppyServices = ($ - fs_FloppyServices)/4 @@ -528,7 +489,7 @@ fs_HdServices: dd fs_HdSetFileEnd dd fs_HdGetFileInfo dd fs_HdSetFileInfo - dd 0 ;fs_HdExecute + dd 0 dd fs_HdDelete dd fs_HdCreateFolder fs_NumHdServices = ($ - fs_HdServices)/4 @@ -604,7 +565,7 @@ fs_CdServices: dd fs_NotImplemented dd fs_CdGetFileInfo dd fs_NotImplemented - dd fs_CdExecute + dd 0 fs_NumCdServices = ($ - fs_CdServices)/4 ;******************************************************* @@ -738,3 +699,156 @@ fs_NextCd: ret ;******************************************************* +process_replace_file_name: + mov ebp, [full_file_name_table] + mov edi, [full_file_name_table.size] + dec edi + shl edi, 7 + add edi, ebp +.loop: + cmp edi, ebp + jb .notfound + push esi edi +@@: + cmp byte [edi], 0 + jz .dest_done + lodsb + test al, al + jz .cont + or al, 20h + scasb + jz @b + jmp .cont +.dest_done: + cmp byte [esi], 0 + jz .found + cmp byte [esi], '/' + jnz .cont + inc esi + jmp .found +.cont: + pop edi esi + sub edi, 128 + jmp .loop +.found: + pop edi eax + mov ebp, esi + cmp byte [esi], 0 + lea esi, [edi+64] + jnz .ret +.notfound: + xor ebp, ebp +.ret: + ret + +sys_current_directory: + mov esi, [current_slot] + mov esi, [esi+APPDATA.cur_dir] + mov edx, esi + dec eax + jz .set + dec eax + jz .get + ret +.get: +; sysfunction 30.2: [for app] eax=30,ebx=2,ecx->buffer,edx=len +; for our code: ebx->buffer,ecx=len +@@: + lodsb + test al, al + jnz @b + sub esi, edx + inc esi + mov [esp+36], esi + cmp ecx, esi + jbe @f + mov ecx, esi +@@: + cmp ecx, 1 + jbe .ret + mov esi, edx + mov edi, ebx + mov al, '/' + stosb + dec ecx + dec ecx + rep movsb + mov byte [edi], 0 +.ret: + ret +.set: +; sysfunction 30.1: [for app] eax=30,ebx=1,ecx->string +; for our code: ebx->string to set +@@: + inc esi + cmp byte [esi-1], 0 + jnz @b + dec esi + cmp byte [ebx], '/' + jz .set_absolute +; string gives relative path +.relative: + cmp byte [ebx], 0 + jz .set_ok + cmp word [ebx], '.' + jz .set_ok + cmp word [ebx], './' + jnz @f + add ebx, 2 + jmp .relative +@@: + cmp word [ebx], '..' + jnz .doset_relative + cmp byte [ebx+2], 0 + jz @f + cmp byte [ebx+2], '/' + jnz .doset_relative +@@: + dec esi + cmp byte [esi], '/' + jnz @b + mov byte [esi], 0 + add ebx, 3 + jmp .relative +.doset_relative: + add edx, 0x1000 + mov byte [esi], '/' + inc esi + cmp esi, edx + jae .overflow_esi +@@: + mov al, [ebx] + inc ebx + mov [esi], al + inc esi + test al, al + jz .set_ok + cmp esi, edx + jb @b +.overflow_esi: + mov byte [esi-1], 0 ; force null-terminated string +.set_ok: + ret +.set_absolute: + lea esi, [ebx+1] + call process_replace_file_name + mov edi, edx + add edx, 0x1000 +.set_copy: + lodsb + stosb + test al, al + jz .set_part2 +.set_copy_cont: + cmp edi, edx + jb .set_copy +.overflow_edi: + mov byte [edi-1], 0 + ret +.set_part2: + mov esi, ebp + xor ebp, ebp + test esi, esi + jz .set_ok + mov byte [edi-1], '/' + jmp .set_copy_cont diff --git a/kernel/trunk/fs/iso9660.inc b/kernel/trunk/fs/iso9660.inc index b9f017339c..d3145bc529 100644 --- a/kernel/trunk/fs/iso9660.inc +++ b/kernel/trunk/fs/iso9660.inc @@ -488,128 +488,8 @@ fs_CdGetFileInfo: xor eax, eax ret -;---------------------------------------------------------------- -; -; fs_CdExecute - LFN variant for executing from CD -; -; 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_CdExecute: - mov edx, [ebx] - mov ebx, [ebx+4] - test ebx, ebx - jz @f - ; add ebx, std_application_base_address -@@: - -;---------------------------------------------------------------- -; -; fs_CdExecute.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 byte [esi], 0 - jnz @f -; cannot execute root! - mov eax, -ERROR_ACCESS_DENIED - ret -@@: - push edi - call cd_find_lfn - jnc .found - pop edi - mov eax, -ERROR_FILE_NOT_FOUND - cmp [DevErrorCode], 0 - jz @f - mov al, -11 -@@: - ret -.found: - mov edi,[cd_current_pointer_of_input] - mov eax,[edi+2] - push 0 - push eax - push dword [edi+10] ; 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 - cmp [eax+8],dword 0 - jne @f - mov ecx,[eax+4] - inc dword [eax+4] - mov [CDSectorAddress],ecx - mov [CDDataBuf_pointer],CDDataBuf ;edi - call ReadCDWRetr - cmp [DevErrorCode], 0 - jnz .err -@@: - push esi edi ecx - mov esi,512 - imul esi,[eax+8] - add esi,CDDataBuf - mov ecx,512/4 - cld - rep movsd - pop ecx edi esi - - 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, 4 ; 2048/512=4 - jb @f - xor edx, edx -@@: - mov [eax+8], edx - popad - xor eax, eax - ret -.eof: - popad - mov eax, 6 - ret -.err: - popad - mov eax, 11 - ret - cd_find_lfn: -; in: esi->name +; in: esi+ebp -> name ; out: CF=1 - file not found ; else CF=0 and [cd_current_pointer_of_input] direntry push eax esi @@ -669,6 +549,7 @@ cd_find_lfn: ; ъюэхЎ яєЄш Їрщыр cmp byte [esi-1], 0 jz .done + .nested: mov eax,[cd_current_pointer_of_input] push dword [eax+2] pop dword [CDSectorAddress] ; эрўрыю фшЁхъЄюЁшш @@ -676,6 +557,12 @@ cd_find_lfn: jmp .mainloop ; єърчрЄхы№ Їрщыр эрщфхэ .done: + test ebp, ebp + jz @f + mov esi, ebp + xor ebp, ebp + jmp .nested +@@: pop esi eax clc ret diff --git a/kernel/trunk/fs/ntfs.inc b/kernel/trunk/fs/ntfs.inc index 97db658034..edd4f05bde 100644 --- a/kernel/trunk/fs/ntfs.inc +++ b/kernel/trunk/fs/ntfs.inc @@ -938,7 +938,7 @@ ntfs_decode_mcb_entry: ret ntfs_find_lfn: -; in: esi->name +; in: esi+ebp -> name ; out: CF=1 - file not found ; else CF=0, [ntfs_cur_iRecord] valid, eax->record in parent directory mov [ntfs_cur_iRecord], 5 ; start parse from root cluster @@ -1090,6 +1090,12 @@ ntfs_find_lfn: inc esi cmp byte [esi-1], 0 jnz .doit2 + test ebp, ebp + jz @f + mov esi, ebp + xor ebp, ebp + jmp .doit2 +@@: ret ;---------------------------------------------------------------- diff --git a/kernel/trunk/fs/parse_fn.inc b/kernel/trunk/fs/parse_fn.inc index 95c67b1ccb..60e8d6f5e4 100644 --- a/kernel/trunk/fs/parse_fn.inc +++ b/kernel/trunk/fs/parse_fn.inc @@ -7,210 +7,194 @@ ; ;------------------------------------------------------------------------- -full_file_name_table dd 0 ; указатель на память для таблицы путей 4К запись 64 (32 - строка шаблон для поиска, 32 - строка шаблон для замены) +iglobal +; pointer to memory for path replace table, +; size of one record is 128 bytes: 64 bytes for search pattern + 64 bytes for replace string -; перебирает по файлу варианты замен -proc full_file_name stdcall,sourc,dest -locals - tmpsrc rb 260 ; временное хранение преобразования -endl - pushad - mov esi,[sourc] - lea edi, [tmpsrc] +; start with one entry: %sys% -> +full_file_name_table dd sysdir_name +.size dd 1 -@@: - lodsb - stosb - or al,al - jnz @b +tmp_file_name_size dd 1 +endg - mov al,[conf_file_loaded] ; требуется при обращении к первому файлу (конфигу) - or al,al - jnz @use_replace +uglobal +; Parser_params will initialize: sysdir_name = "%sys%", sysdir_path = +sysdir_name rb 64 +sysdir_path rb 64 +tmp_file_name_table dd ? +endg - jmp full_file_name_exit - - -;-------------------------------- - @use_replace: - - xor eax,eax -.loop: - push eax - - imul eax,eax,64 - add eax,[full_file_name_table] - mov ebx,eax - add eax,32 - - mov cl,[ebx] - or cl,cl - jz .done - - lea ecx, [tmpsrc] - mov edx,[dest] - - stdcall full_file_name_parse, ecx,edx,ebx,eax - - mov esi,[dest] - lea edi, [tmpsrc] -@@: - lodsb - stosb - or al,al - jnz @b - - pop eax - inc eax - jmp .loop - -.done: - pop eax -full_file_name_exit: - - lea eax, [tmpsrc] - stdcall full_file_name_parse , eax , [dest], sysdir_ , sys_path - popad - ret -endp - -; -; Преобразовать имя в полное. Если в начале стоит -; sourc - ссылка на строку... -; dest - ссылка на буфер куда результат ложить -; def - строка шаблон для поиска -; dval - к чему приравнивать шаблон -proc full_file_name_parse stdcall,sourc,dest,def,dval - ; для одного - pushad - - mov eax,[sourc] - mov ebx,[def] -@@: - mov dl,[ebx] - mov cl,[eax] - cmp cl,0 - je @@bad_s - cmp dl,0 - je @@good - - or cl,0x20 - or dl,0x20 - cmp cl,dl - jne @@bad - - inc eax - inc ebx - jmp @b - -@@bad_s: - cmp dl,0 - je @@good - -@@bad: - mov edi,[dest] - mov esi,[sourc] -@@: - lodsb - stosb - or al,al - jnz @b - jmp @@ret_ok - -@@good: - push eax - mov edi,[dest] - mov esi,[dval] -@@: - lodsb - stosb - or al,al - jnz @b - -@@goodl: - pop esi - dec edi -@@: - lodsb - stosb - or al,al - jnz @b - -@@ret_ok: - popad - ret - -endp - - sys_dir_mess: db 'System dir is ' - sys_path: db '/HD0/1/KOLIBRI',0,0 - sysdir_ db '%sys%',0 - -; берет параметры bx_from_load и исчит файл конфигурации +; берет параметры bx_from_load и инициализирует замену для %sys% Parser_params: - pushad - mov ax,[OS_BASE+0x10000+bx_from_load] + mov eax,[OS_BASE+0x10000+bx_from_load] + mov ecx,sysdir_path + mov [ecx-64],dword '%sys' + mov [ecx-64+4],word '%' cmp al,'r' ; рам диск jnz @f - mov [sys_path],dword '/RD/' - mov [sys_path+4],byte ah - mov [sys_path+5],word 0 ;0x002F - jmp .done + mov [ecx],dword 'RD/?' + mov [ecx+3],byte ah + mov [ecx+4],byte 0 + ret @@: sub al,49 - mov [sys_path],dword '/HDa' - mov [sys_path+3],byte al - mov [sys_path+4],byte '/' - mov [sys_path+5],byte ah - mov [sys_path+6],dword '/KOL' - mov [sys_path+10],dword 'IBRI' - mov [sys_path+14],word 0 ;0x002F - -.done: - popad + mov [ecx],dword 'HD?/' + mov [ecx+2],byte al + mov [ecx+4],byte ah + mov [ecx+5],dword '/KOL' + mov [ecx+9],dword 'IBRI' + mov [ecx+13],byte 0 ret - + proc load_file_parse_table - pushad stdcall kernel_alloc,0x1000 - mov [full_file_name_table],eax + mov [tmp_file_name_table],eax + mov edi,eax + mov esi,sysdir_name + mov ecx,128/4 + rep movsd invoke ini.enum_keys,conf_fname,conf_path_sect,get_every_key - - mov eax,[loading_counter] - imul eax,eax,64 - add eax,[full_file_name_table] - mov [eax],byte 0 - popad + + mov eax,[tmp_file_name_table] + mov [full_file_name_table],eax + mov eax,[tmp_file_name_size] + mov [full_file_name_table.size],eax ret endp -loading_counter dd 0 +uglobal def_val_1 db 0 +endg -proc get_every_key stdcall,f_name, sec_name, key_name - pushad - mov esi,[key_name] - mov edi,[loading_counter] - imul edi,edi,64 - add edi,[full_file_name_table] +proc get_every_key stdcall, f_name, sec_name, key_name + mov esi, [key_name] + mov ecx, esi + cmp byte [esi], '/' + jnz @f + inc esi @@: - lodsb - stosb - or al,al - jnz @b + mov edi, [tmp_file_name_size] + shl edi, 7 + cmp edi, 0x1000 + jae .stop_parse + add edi, [tmp_file_name_table] + lea ebx, [edi+64] +@@: + cmp edi, ebx + jae .skip_this_key + lodsb + test al, al + jz @f + or al, 20h + stosb + jmp @b +@@: + stosb - mov eax,[loading_counter] - imul eax,eax,64 - add eax,[full_file_name_table] - add eax,32 - mov ebx,[key_name] - invoke ini.get_str,conf_fname,conf_path_sect,ebx,eax,32,def_val_1 + invoke ini.get_str, [f_name],[sec_name],ecx,ebx,64,def_val_1 - inc dword [loading_counter] - - popad - mov eax,1 - ret + cmp byte [ebx], '/' + jnz @f + lea esi, [ebx+1] + mov edi, ebx + mov ecx, 63 + rep movsb +@@: + push ebp + mov ebp, [tmp_file_name_table] + mov ecx, [tmp_file_name_size] + jecxz .noreplace + mov eax, ecx + dec eax + shl eax, 7 + add ebp, eax +.replace_loop: + mov edi, ebx + mov esi, ebp +@@: + lodsb + test al, al + jz .doreplace + mov dl, [edi] + inc edi + test dl, dl + jz .replace_loop_cont + or dl, 20h + cmp al, dl + jz @b + jmp .replace_loop_cont +.doreplace: + cmp byte [edi], 0 + jz @f + cmp byte [edi], '/' + jnz .replace_loop_cont +@@: + lea esi, [ebp+64] + call .replace + jc .skip_this_key2 +.replace_loop_cont: + sub ebp, 128 + loop .replace_loop +.noreplace: + pop ebp + + inc [tmp_file_name_size] +.skip_this_key: + xor eax, eax + inc eax + ret +.skip_this_key2: + pop ebp + jmp .skip_this_key +.stop_parse: + xor eax, eax + ret endp +proc get_every_key.replace +; in: ebx->destination, esi->first part of name, edi->second part of name +; maximum length is 64 bytes +; out: CF=1 <=> overflow +; 1) allocate temporary buffer in stack + sub esp, 64 +; 2) save second part of name to temporary buffer + push esi + lea esi, [esp+4] ; esi->tmp buffer + xchg esi, edi ; edi->tmp buffer, esi->source +@@: + lodsb + stosb + test al, al + jnz @b +; 3) copy first part of name to destination + pop esi + mov edi, ebx +@@: + lodsb + test al, al + jz @f + stosb + jmp @b +@@: +; 4) restore second part of name from temporary buffer to destination +; (may cause overflow) + lea edx, [ebx+64] ; limit of destination + mov esi, esp +@@: + cmp edi, edx + jae .overflow + lodsb + stosb + test al, al + jnz @b +; all is OK + add esp, 64 ; CF is cleared + ret +.overflow: +; name is too long + add esp, 64 + stc + ret +endp diff --git a/kernel/trunk/gui/skindata.inc b/kernel/trunk/gui/skindata.inc index 852ac65d17..2f728fa1fe 100644 --- a/kernel/trunk/gui/skindata.inc +++ b/kernel/trunk/gui/skindata.inc @@ -11,7 +11,7 @@ $Revision$ ; iglobal - _skin_file_default db '%sys%/DEFAULT.SKN',0 + _skin_file_default db '/%sys%/DEFAULT.SKN',0 endg struct SKIN_DATA diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 91cb222345..7070c54e03 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -533,6 +533,8 @@ high_code: include 'detect/disks.inc' ;!!!!!!!!!!!!!!!!!!!!!!!!!! + call Parser_params + ; READ RAMDISK IMAGE FROM HD ;!!!!!!!!!!!!!!!!!!!!!!! @@ -549,8 +551,6 @@ include 'boot/rdload.inc' include 'vmodeld.inc' ;!!!!!!!!!!!!!!!!!!!!!!! - call Parser_params - mov ax,[OS_BASE+0x10000+bx_from_load] cmp ax,'r1' ; хёыш ёЁрь фшёъ - Єю эх уЁєчшЄ№ сшсышюЄхъш je no_lib_load @@ -689,6 +689,8 @@ no_lib_load: mov dword [SLOT_BASE+256+APPDATA.fd_obj], ebx mov dword [SLOT_BASE+256+APPDATA.bk_obj], ebx + mov dword [SLOT_BASE+256+APPDATA.cur_dir], sysdir_path + ; task list mov [CURRENT_TASK],dword 1 mov [TASK_COUNT],dword 1 @@ -774,72 +776,19 @@ no_lib_load: ; LOAD FIRST APPLICATION cli -if 0 cmp byte [BOOT_VAR+0x9030],1 jne no_load_vrr_m - stdcall kernel_alloc, 0x100 - push eax - mov ebx,eax - stdcall full_file_name,vrr_m,eax - mov ebp, eax - - xor ebx, ebx - xor edx, edx - call fs_execute - pop ebx - push eax - stdcall kernel_free, ebx - pop eax + mov ebp, vrr_m + call fs_execute_from_sysdir cmp eax,2 ; if vrr_m app found (PID=2) je first_app_found no_load_vrr_m: - stdcall kernel_alloc, 0x100 - push eax - mov ebx,eax - stdcall full_file_name,firstapp,eax - mov ebp, eax - xor ebx, ebx - xor edx, edx - call fs_execute - pop ebx - push eax - stdcall kernel_free, ebx - pop eax - cmp eax,2 ; continue if a process has been loaded - je first_app_found - mov eax, 0xDEADBEEF ; otherwise halt - hlt - -first_app_found: - -else - sub esp, 0x100 - - cmp byte [BOOT_VAR+0x9030],1 - jne no_load_vrr_m - - mov ebp, esp - stdcall full_file_name,vrr_m,ebp - - xor ebx, ebx - xor edx, edx - call fs_execute - - cmp eax,2 ; if vrr_m app found (PID=2) - je first_app_found - -no_load_vrr_m: - - mov ebp, esp - stdcall full_file_name,firstapp,ebp - - xor ebx, ebx - xor edx, edx - call fs_execute + mov ebp, firstapp + call fs_execute_from_sysdir cmp eax,2 ; continue if a process has been loaded je first_app_found @@ -849,9 +798,6 @@ no_load_vrr_m: first_app_found: - add esp, 0x100 - -end if cli ;mov [TASK_COUNT],dword 2 @@ -3462,7 +3408,7 @@ checkpixel: ret iglobal - cpustring db '%sys%/CPU',0 + cpustring db 'CPU',0 endg uglobal @@ -3477,21 +3423,8 @@ checkmisc: cmp [ctrl_alt_del], 1 jne nocpustart - - stdcall kernel_alloc, 0x100 - push eax - mov ebx,eax - stdcall full_file_name,cpustring,eax - mov ebp, eax - - xor ebx, ebx - xor edx, edx - call fs_execute - - pop ebx - push eax - stdcall kernel_free, ebx - pop eax + mov ebp, cpustring + call fs_execute_from_sysdir mov [ctrl_alt_del], 0 diff --git a/kernel/trunk/kernel32.inc b/kernel/trunk/kernel32.inc index 6be981f574..bdd83cdf47 100644 --- a/kernel/trunk/kernel32.inc +++ b/kernel/trunk/kernel32.inc @@ -126,8 +126,9 @@ struc APPDATA .saved_esp dd ? ;+64 .io_map rd 2 ;+68 .dbg_state dd ? ;+76 + .cur_dir dd ? ;+80 - db 48 dup(?) ;+80 + db 44 dup(?) ;+84 .wnd_shape dd ? ;+128 .wnd_shape_scale dd ? ;+132 diff --git a/kernel/trunk/lib_func.inc b/kernel/trunk/lib_func.inc index 2ff82895bf..c3eb378149 100644 --- a/kernel/trunk/lib_func.inc +++ b/kernel/trunk/lib_func.inc @@ -9,7 +9,7 @@ ; ;============================================================================ - +align 4 @IMPORT: library \ diff --git a/kernel/trunk/macros.inc b/kernel/trunk/macros.inc index b7d8f4e232..11ee626cf3 100644 --- a/kernel/trunk/macros.inc +++ b/kernel/trunk/macros.inc @@ -71,6 +71,8 @@ macro diff10 title,l1,l2 display 13,10 } +include 'kglobals.inc' + ; \begin{diamond}[29.09.2006] ; may be useful for kernel debugging ; example 1: diff --git a/kernel/trunk/sys.conf b/kernel/trunk/sys.conf index e2f74ee22d..3505819e2e 100644 --- a/kernel/trunk/sys.conf +++ b/kernel/trunk/sys.conf @@ -1,6 +1,6 @@ [path] -/rd/1=%sys% -%sys%/dll=%sys%/lib +/rd/1=/%sys% +/rd/1/dll=/%sys%/lib [net] active=1 diff --git a/kernel/trunk/vmodeld.inc b/kernel/trunk/vmodeld.inc index 1eaf4a0e3c..db0b3108e4 100644 --- a/kernel/trunk/vmodeld.inc +++ b/kernel/trunk/vmodeld.inc @@ -28,4 +28,5 @@ $Revision$ xor ebx, ebx mov ecx, 0x8000 ; size of memory area for driver mov edx, VMODE_BASE ; Memory position of driver + xor ebp, ebp call fs_RamdiskRead