From bc47ee30d77f487346af3cb92e5751d8dfa8afb5 Mon Sep 17 00:00:00 2001 From: "Andrey Halyavin (halyavin)" Date: Thu, 13 Oct 2005 05:34:10 +0000 Subject: [PATCH] Mario79 fixes: Application can determine own path now. Some boot messages changed (it is version Kolibri 5.1.0 now). Some rd functions updated (thanks to michael). Switch to another bank-switching procedure. git-svn-id: svn://kolibrios.org@5 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/blkdev/rd.inc | 82 +++++++++++++++++++++++++- kernel/trunk/boot/booteng.inc | 10 ++-- kernel/trunk/boot/bootru.inc | 8 ++- kernel/trunk/boot/preboot.inc | 2 +- kernel/trunk/core/newproce.inc | 30 ++++++++-- kernel/trunk/core/sys32.inc | 4 +- kernel/trunk/detect/sear_par.inc | 4 +- kernel/trunk/kernel.asm | 99 +------------------------------- kernel/trunk/video/vesa12.inc | 21 ++++++- 9 files changed, 143 insertions(+), 117 deletions(-) diff --git a/kernel/trunk/blkdev/rd.inc b/kernel/trunk/blkdev/rd.inc index 6e0e1e9aed..ad0381a261 100644 --- a/kernel/trunk/blkdev/rd.inc +++ b/kernel/trunk/blkdev/rd.inc @@ -5,6 +5,82 @@ ;; Addings by M.Lisovin ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; calculate fat chain + +calculatefatchain: + + pushad + + mov esi,0x100000+512 + mov edi,0x280000 + + fcnew: + mov eax,dword [esi] + mov ebx,dword [esi+4] + mov ecx,dword [esi+8] + mov edx,ecx + shr edx,4 ;8 ok + shr dx,4 ;7 ok + xor ch,ch + shld ecx,ebx,20 ;6 ok + shr cx,4 ;5 ok + shld ebx,eax,12 + and ebx,0x0fffffff ;4 ok + shr bx,4 ;3 ok + shl eax,4 + and eax,0x0fffffff ;2 ok + shr ax,4 ;1 ok + mov dword [edi],eax + add edi,4 + mov dword [edi],ebx + add edi,4 + mov dword [edi],ecx + add edi,4 + mov dword [edi],edx + add edi,4 + add esi,12 + + cmp edi,0x280000+2856*2 ;2849 clusters + jnz fcnew + + popad + ret + + +restorefatchain: ; restore fat chain + + pushad + + mov esi,0x280000 + mov edi,0x100000+512 + + fcnew2: + mov eax,dword [esi] + mov ebx,dword [esi+4] + shl ax,4 + shl eax,4 + shl bx,4 + shr ebx,4 + shrd eax,ebx,8 + shr ebx,8 + mov dword [edi],eax + add edi,4 + mov word [edi],bx + add edi,2 + add esi,8 + + cmp edi,0x100000+512+4278 ;4274 bytes - all used FAT + jb fcnew2 + + mov esi,0x100000+512 ; duplicate fat chain + mov edi,0x100000+512+0x1200 + mov ecx,1069 ;4274/4 + cld + rep movsd + + popad + ret + ramdisk_free_space: ;--------------------------------------------- @@ -18,7 +94,7 @@ ramdisk_free_space: mov edi,0x280000 ;start of FAT xor ax,ax ;Free cluster=0x0000 in FAT xor ebx,ebx ;counter - mov ecx,2847 ;2849 ;2849 clusters + mov ecx,2849 ;2849 clusters cld rdfs1: repne scasw @@ -122,7 +198,7 @@ fileread: push edx mov edx,ecx add edx,ebx - cmp edx,14 ;ebx+ecx=14 + cmp edx,15 ;ebx+ecx=14+1 pushf jbe fr_do1 sub edx,14 @@ -136,7 +212,7 @@ fileread: rep movsd popf pop edx -; jae fr_do2 + jae fr_do2 xor eax,eax ; ok read xor ebx,ebx ret diff --git a/kernel/trunk/boot/booteng.inc b/kernel/trunk/boot/booteng.inc index 89e873a778..97d12cbaae 100644 --- a/kernel/trunk/boot/booteng.inc +++ b/kernel/trunk/boot/booteng.inc @@ -46,9 +46,11 @@ d80x25: line_full_top line_space line_space line_space - line_space - db 186,' Kolibri OS comes with ABSOLUTELY NO WARR' - db 'ANTY; See file COPYING for details ',186 +; line_space + db 186,' KolibriOS based on MenuetOS and comes with ABSOLUTELY ' + db 'NO WARRANTY ',186 + db 186,' See file COPYING for details ' + db ' ',186 line_full_bottom novesa db "Display: EGA/CGA",13,10,0 @@ -78,7 +80,7 @@ gr_direct db 186," Use direct LFB writing? " ;mem_model db 13,10,186," Motherboard memory [1-16 Mb / 2-32 Mb / " ; db "3-64Mb / 4-128 Mb / 5-256 Mb] ? ",0 bootlog db 13,10,186," After bootlog display [1-continue/2-pause] ? ",0 -bdev db 13,10,186 +bdev db 186 db " Load ramdisk from [1-floppy; 2-C:\menuet.img (FAT32);" db 13,10,186," " db "3-use preloaded ram-image from kernel restart]: ",0 diff --git a/kernel/trunk/boot/bootru.inc b/kernel/trunk/boot/bootru.inc index c1579d82e9..2cd7b9b8d4 100644 --- a/kernel/trunk/boot/bootru.inc +++ b/kernel/trunk/boot/bootru.inc @@ -46,9 +46,11 @@ d80x25: line_full_top line_space line_space line_space - line_space - db 186,' Kolibri OS не предоставляет никаких гарa' - db 'нтий; Подробнее - см. GNU.TXT ',186 +; line_space + db 186,' Kolibri OS основана на Menuet OS и не предоставляет ' + db 'никаких гарaнтий. ',186 + db 186,' Подробнее смотрите файл GNU.TXT ' + db ' ',186 line_full_bottom novesa db "Видеокарта: EGA/CGA",13,10,0 diff --git a/kernel/trunk/boot/preboot.inc b/kernel/trunk/boot/preboot.inc index de61f8579c..63d8e1c2c8 100644 --- a/kernel/trunk/boot/preboot.inc +++ b/kernel/trunk/boot/preboot.inc @@ -17,7 +17,7 @@ preboot_device db 0 ; boot device ;;preboot_memory db 0 ; amount of memory ; (1-16Mb;2-32Mb;3-64Mb;4-128Mb;5-256Mb) ; !!!! 0 - autodetect !!!! -preboot_blogesc db 0 ; start immediately after bootlog +preboot_blogesc db 1 ; start immediately after bootlog hdsysimage db 'MENUET IMG' ; load from image_save db 'MENUET IMG' ; save to diff --git a/kernel/trunk/core/newproce.inc b/kernel/trunk/core/newproce.inc index 5a5906f662..41cfd2efd9 100644 --- a/kernel/trunk/core/newproce.inc +++ b/kernel/trunk/core/newproce.inc @@ -63,6 +63,7 @@ new_start_application_floppy: ;result: ; eax - pid of new process ; or 0 if call fails. + mov [appl_path],edi pushad mov esi,new_process_loading call sys_msg_board_str ;write to debug board @@ -95,13 +96,17 @@ new_start_application_floppy: rep stosd ;clean extended information about process ;set new process name - mov eax,[esp+8] + xor eax,eax + mov [appl_path_size],eax + mov eax,[esp] ;+8] .find_last_byte: cmp byte [eax],0 jz .find_last_byte_end inc eax + inc [appl_path_size] jmp .find_last_byte -.find_last_byte_end: +.find_last_byte_end: + add [appl_path_size],24 sub eax,11 ;last 11 bytes = application name ; mov eax,[esp] ;eax - pointer to file name mov ebx,[new_process_place] @@ -217,6 +222,8 @@ new_start_application_fl: ;result: ; eax - pid of new process ; or 0 if call fails. + mov [appl_path],edi + mov [appl_path_size],36 pushad mov esi,new_process_loading call sys_msg_board_str ;write to debug board @@ -406,6 +413,16 @@ new_start_application_fl: call write_process_memory ;copy parameters to new process address space .no_command_line: +;****************************************************************** + mov edx,[app_i_icon] + test edx,edx + jz .no_command_line_1 ;application don't need path of file + mov ebx,[appl_path] + mov ecx,[appl_path_size] + mov eax,[new_process_place] + call write_process_memory ;copy path of file to new process address space +.no_command_line_1: +;****************************************************************** mov ebx,[new_process_place] mov eax,ebx shl ebx,5 @@ -1130,6 +1147,7 @@ new_start_application_hd: ;ebx - file name length ;ecx - work area (kernel address) ;ebp - parameters + mov [appl_path],edi pushad mov esi,new_process_loading @@ -1155,14 +1173,18 @@ new_start_application_hd: test eax,eax jz .failed -;write application name +;write application name + xor eax,eax + mov [appl_path_size],eax mov eax,[esp+4] .find_last_byte: cmp byte [eax],0 jz .find_last_byte_end inc eax + inc [appl_path_size] jmp .find_last_byte -.find_last_byte_end: +.find_last_byte_end: + add [appl_path_size],24 lea esi,[eax-11] ;last 11 bytes = application name mov edi,[new_process_place] shl edi,8 diff --git a/kernel/trunk/core/sys32.inc b/kernel/trunk/core/sys32.inc index 3c724d6114..9908cd1d20 100644 --- a/kernel/trunk/core/sys32.inc +++ b/kernel/trunk/core/sys32.inc @@ -1134,6 +1134,8 @@ uglobal app_mem_pos dd 0x0 ;thread_create dd 0x0 ;gdt_place dd 0x0 + appl_path dd 0x0 + appl_path_size dd 0x0 endg iglobal @@ -1154,8 +1156,6 @@ sys_threads: ; on return : eax = pid jmp new_sys_threads - - iglobal process_terminating db 'K : Process - terminating',13,10,0 process_terminated db 'K : Process - done',13,10,0 diff --git a/kernel/trunk/detect/sear_par.inc b/kernel/trunk/detect/sear_par.inc index 082f75ac83..463ac48e50 100644 --- a/kernel/trunk/detect/sear_par.inc +++ b/kernel/trunk/detect/sear_par.inc @@ -82,12 +82,14 @@ partition_data_transfer: ret transfer_adress dd 0 partition_data_transfer_1: - cli + cli + push edi mov edi,PARTITION_START mov esi,[transfer_adress] xor ecx,ecx mov cx,69 ;100 rep movsb + pop edi sti ret diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index ed19b8a2d8..3d07b95151 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -86,7 +86,7 @@ drawbar dd __sys_drawbar putpixel dd __sys_putpixel ; } mike.dld -version db 'Kolibri OS version 0.5.0.0 ',13,10,13,10,0 +version db 'Kolibri OS version 0.5.1.0 ',13,10,13,10,0 ;dd endofcode-0x10000 ;db 'Boot02' @@ -2269,7 +2269,7 @@ keyboard_mode_sys db 0 iglobal version_inf: - db 0,5,0,0 ; version 0.5.0.0 + db 0,5,1,0 ; version 0.5.1.0 db UID_KOLIBRI db 'Kolibri',0 version_end: @@ -4131,101 +4131,6 @@ memmove: ; memory move in bytes ret - -; calculate fat chain - -calculatefatchain: - - pushad - - mov esi,0x100000+512 - mov edi,0x280000 - - fcnew: - xor eax,eax - xor ebx,ebx - xor ecx,ecx - xor edx,edx - mov al,[esi+0] ; 1 - mov bl,[esi+1] - and ebx,15 - shl ebx,8 - add eax,ebx - mov [edi],ax - add edi,2 - - xor eax,eax - xor ebx,ebx - xor ecx,ecx - xor edx,edx - mov bl,[esi+1] ; 2 - mov cl,[esi+2] - shr ebx,4 - shl ecx,4 - add ecx,ebx - mov [edi],cx - add edi,2 - - add esi,3 - - cmp edi,0x280000+4100*4 - jnz fcnew - - popad - ret - - -restorefatchain: ; restore fat chain - - pushad - - mov esi,0x280000 - mov edi,0x100000+512 - - fcnew2: - cld - xor eax,eax - xor ebx,ebx - xor ecx,ecx ; esi XXXXxxxxxxxx yyyyyyyyYYYY - xor edx,edx - mov ax,[esi] ; edi xxxxxxxx YYYYXXXX yyyyyyyy - mov bx,ax - shr bx,8 - and ebx,15 - mov [edi+0],al ; 1 -> 1 & 2 - mov [edi+1],bl - add esi,2 - - xor eax,eax - xor ebx,ebx - xor ecx,ecx - xor edx,edx - mov bx,[esi] - mov cx,bx - shr ecx,4 - mov [edi+2],cl - and ebx,15 - shl ebx,4 - mov edx,[edi+1] - add edx,ebx - mov [edi+1],dl ; 2 -> 2 & 3 - add esi,2 - - add edi,3 - - cmp edi,0x100000+512+0x1200 - jb fcnew2 - - mov esi,0x100000+512 ; duplicate fat chain - mov edi,0x100000+512+0x1200 - mov ecx,0x1200/4 - cld - rep movsd - - popad - ret - - align 4 read_floppy_file: diff --git a/kernel/trunk/video/vesa12.inc b/kernel/trunk/video/vesa12.inc index bc82b40334..aa33f02d24 100644 --- a/kernel/trunk/video/vesa12.inc +++ b/kernel/trunk/video/vesa12.inc @@ -27,9 +27,26 @@ ; Modifying the set_bank -function is mostly enough ; for different Vesa 1.2 setups. -;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!{ +;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +; set_bank for Trident videocards, work on Trident 9440 +; modified by Mario79 +;set_bank: +;cli +;cmp al,[0xfff2] +;je retsb +;mov [0xfff2],al +;push dx +;mov dx,3D8h +;out dx,al +;pop dx +;retsb: +;sti +;ret -; set_bank modified by kmeaw + +;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +; set_bank for S3 videocards, work on S3 ViRGE PCI (325) +; modified by kmeaw set_bank: cli cmp al,[0xfff2]