diff --git a/kernel/branches/flat_kernel/blkdev/rd.inc b/kernel/branches/flat_kernel/blkdev/rd.inc index cad449e788..002266508c 100644 --- a/kernel/branches/flat_kernel/blkdev/rd.inc +++ b/kernel/branches/flat_kernel/blkdev/rd.inc @@ -1,10 +1,14 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +$Revision$ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; +;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; ;; RAMDISK functions ;; ;; (C) 2004 Ville Turjanmaa, License: GPL ;; ;; Addings by M.Lisovin ;; ;; LFN support by diamond ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; calculate fat chain @@ -1873,6 +1877,9 @@ fs_RamdiskRewrite: mov byte [edi-32+11], 10h mov eax, [esp+16+8] mov word [edi-32+26], ax + xor eax, eax + mov ecx, (512-32*2)/4 + rep stosd pop edi edi ecx edx add esp, 20 popad diff --git a/kernel/branches/flat_kernel/boot/bootcode.inc b/kernel/branches/flat_kernel/boot/bootcode.inc index 23d915c3c9..36fc220fc8 100644 --- a/kernel/branches/flat_kernel/boot/bootcode.inc +++ b/kernel/branches/flat_kernel/boot/bootcode.inc @@ -1,11 +1,18 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; BOOTCODE.INC ;; -;; ;; -;; KolibriOS 16-bit loader, ;; -;; based on bootcode for MenuetOS ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +$Revision: 437 $ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;; BOOTCODE.INC ;; +;; ;; +;; KolibriOS 16-bit loader, ;; +;; based on bootcode for MenuetOS ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + ;========================================================================== ; @@ -126,11 +133,11 @@ start_of_code: if lang eq ru ; Load & set russian VGA font (RU.INC) mov bp, RU_FNT1 ; RU_FNT1 - First part - mov bx,1000h ; 768 bytes - mov cx,30h ; 48 symbols - mov dx,80h ; 128 - position of first symbol + mov bx,1000h ; 768 bytes + mov cx,30h ; 48 symbols + mov dx,80h ; 128 - position of first symbol mov ax,1100h - int 10h + int 10h mov bp,RU_FNT2 ; RU_FNT2 -Second part mov bx,1000h ; 512 bytes @@ -289,9 +296,7 @@ wait_loop: ; variant 2 mov [si + 5], ah mov [si + 7], al _setcursor 0, 3 - call printplain - _setcursor d80x25_top_num,0 ; ------------------ mov ax, 0x5304 ; Disconnect interface @@ -310,11 +315,13 @@ wait_loop: ; variant 2 mov [es:0x9054], dx apm_end: + _setcursor d80x25_top_num, 0 +; ----------------------------------------- ; DISPLAY VESA INFORMATION - push 0 - pop es + push 0 + pop es mov ax,0x4f00 mov di,0xa000 int 0x10 @@ -549,9 +556,10 @@ virtual at novesa .bSettingsChanged db ? .timer dd ? end virtual + org $+0x10000 .loader_block dd -1 + org $-0x10000 .gettime: - mov ah, 0 int 1Ah xchg ax, cx @@ -992,18 +1000,16 @@ sayerr_floppy: ; readdone: ; pop ax - mov si,backspace2 call printplain mov si,okt call printplain - -no_sys_on_floppy: + no_sys_on_floppy: xor ax, ax ; reset drive xor dx, dx int 0x13 - mov dx,0x3f2 ; floppy motor off - mov al,0 - out dx,al + mov dx,0x3f2 ; floppy motor off + mov al,0 + out dx,al ; SET GRAPHICS @@ -1023,7 +1029,6 @@ setgr: test ah,ah mov si, fatalsel jnz sayerr - ; set mode 0x12 graphics registers: cmp bx,0x12 jne gmok2 diff --git a/kernel/branches/flat_kernel/boot/booteng.inc b/kernel/branches/flat_kernel/boot/booteng.inc index bdf20f2ad5..56c1c390d4 100644 --- a/kernel/branches/flat_kernel/boot/booteng.inc +++ b/kernel/branches/flat_kernel/boot/booteng.inc @@ -1,49 +1,10 @@ +$Revision: 437 $ ;====================================================================== ; ; BOOT DATA ; ;====================================================================== -macro line_full_top { - db 201 - times 78 db 205 - db 187 -} -macro line_full_bottom { - db 200 - times 78 db 205 - db 188 -} -macro line_half { - db 186,' ' - times 76 db 0xc4 - db ' ',186 -} -macro line_space { - db 186 - times 78 db 32 - db 186 -} -d80x25_top: - line_full_top -space_msg: line_space -verstr: -; line_space -; version string - db 186,32 - repeat 78 - load a byte from version+%-1 - if a = 13 - break - end if - db a - end repeat - repeat 78 - ($-verstr) - db ' ' - end repeat - db 32,186 - line_half -d80x25_top_num = 4 d80x25_bottom: db 186,' KolibriOS based on MenuetOS and comes with ABSOLUTELY ' db 'NO WARRANTY ',186 diff --git a/kernel/branches/flat_kernel/boot/bootet.inc b/kernel/branches/flat_kernel/boot/bootet.inc index 84bd4e726b..82dbc159a6 100644 --- a/kernel/branches/flat_kernel/boot/bootet.inc +++ b/kernel/branches/flat_kernel/boot/bootet.inc @@ -1,49 +1,10 @@ +$Revision: 437 $ ;====================================================================== ; ; BOOT DATA ; ;====================================================================== -macro line_full_top { - db 201 - times 78 db 205 - db 187 -} -macro line_full_bottom { - db 200 - times 78 db 205 - db 188 -} -macro line_half { - db 186,' ' - times 76 db 0xc4 - db ' ',186 -} -macro line_space { - db 186 - times 78 db 32 - db 186 -} -d80x25_top: - line_full_top -space_msg: line_space -verstr: -; line_space -; version string - db 186,32 - repeat 78 - load a byte from version+%-1 - if a = 13 - break - end if - db a - end repeat - repeat 78 - ($-verstr) - db ' ' - end repeat - db 32,186 - line_half -d80x25_top_num = 4 d80x25_bottom: db 186,' KolibriOS based on MenuetOS and comes with ABSOLUTELY ' db 'NO WARRANTY ',186 diff --git a/kernel/branches/flat_kernel/boot/bootge.inc b/kernel/branches/flat_kernel/boot/bootge.inc index 6d7606de05..dda0f4aef3 100644 --- a/kernel/branches/flat_kernel/boot/bootge.inc +++ b/kernel/branches/flat_kernel/boot/bootge.inc @@ -1,49 +1,10 @@ +$Revision: 437 $ ;====================================================================== ; ; BOOT DATA ; ;====================================================================== -macro line_full_top { - db 201 - times 78 db 205 - db 187 -} -macro line_full_bottom { - db 200 - times 78 db 205 - db 188 -} -macro line_half { - db 186,' ' - times 76 db 0xc4 - db ' ',186 -} -macro line_space { - db 186 - times 78 db 32 - db 186 -} -d80x25_top: - line_full_top -space_msg: line_space -verstr: -; line_space -; version string - db 186,32 - repeat 78 - load a byte from version+%-1 - if a = 13 - break - end if - db a - end repeat - repeat 78 - ($-verstr) - db ' ' - end repeat - db 32,186 - line_half -d80x25_top_num = 4 d80x25_bottom: ; db 186,' KolibriOS based on MenuetOS and comes with ABSOLUTELY ' ; db 'NO WARRANTY ',186 diff --git a/kernel/branches/flat_kernel/boot/bootru.inc b/kernel/branches/flat_kernel/boot/bootru.inc index 87e3899cb7..640f5bb543 100644 --- a/kernel/branches/flat_kernel/boot/bootru.inc +++ b/kernel/branches/flat_kernel/boot/bootru.inc @@ -1,49 +1,10 @@ +$Revision: 437 $ ;====================================================================== ; ; BOOT DATA ; ;====================================================================== -macro line_full_top { - db 201 - times 78 db 205 - db 187 -} -macro line_full_bottom { - db 200 - times 78 db 205 - db 188 -} -macro line_half { - db 186,' ' - times 76 db 0xc4 - db ' ',186 -} -macro line_space { - db 186 - times 78 db 32 - db 186 -} -d80x25_top: - line_full_top -space_msg: line_space -verstr: -; line_space -; version string - db 186,32 - repeat 78 - load a byte from version+%-1 - if a = 13 - break - end if - db a - end repeat - repeat 78 - ($-verstr) - db ' ' - end repeat - db 32,186 - line_half -d80x25_top_num = 4 d80x25_bottom: db 186,' Kolibri OS основана на Menuet OS и не предоставляет ' db 'никаких гарaнтий. ',186 diff --git a/kernel/branches/flat_kernel/boot/bootstr.inc b/kernel/branches/flat_kernel/boot/bootstr.inc new file mode 100644 index 0000000000..e82fb85f0e --- /dev/null +++ b/kernel/branches/flat_kernel/boot/bootstr.inc @@ -0,0 +1,52 @@ +; boot data: common strings (for all languages) +macro line_full_top { + db 201 + times 78 db 205 + db 187 +} +macro line_full_bottom { + db 200 + times 78 db 205 + db 188 +} +macro line_half { + db 186,' ' + times 76 db 0xc4 + db ' ',186 +} +macro line_space { + db 186 + times 78 db 32 + db 186 +} +d80x25_top: + line_full_top +cur_line_pos = 75 + store byte ' ' at d80x25_top+cur_line_pos+1 +rev_var = __REV__ +while rev_var > 0 + store byte rev_var mod 10 + '0' at d80x25_top+cur_line_pos + cur_line_pos = cur_line_pos - 1 + rev_var = rev_var / 10 +end while + store byte ' ' at d80x25_top+cur_line_pos + store dword ' SVN' at d80x25_top+cur_line_pos-4 + +space_msg: line_space +verstr: +; line_space +; version string + db 186,32 + repeat 78 + load a byte from version+%-1 + if a = 13 + break + end if + db a + end repeat + repeat 78 - ($-verstr) + db ' ' + end repeat + db 32,186 + line_half +d80x25_top_num = 4 diff --git a/kernel/branches/flat_kernel/core/taskman.inc b/kernel/branches/flat_kernel/core/taskman.inc index 080ff6897e..42a713462f 100644 --- a/kernel/branches/flat_kernel/core/taskman.inc +++ b/kernel/branches/flat_kernel/core/taskman.inc @@ -839,8 +839,6 @@ proc new_sys_threads rep stosd ;clean extended information about new thread mov esi,ebx mov edi,edx - mov byte [edi], '@' - inc edi mov ecx,11 rep movsb ;copy process name @@ -1018,7 +1016,7 @@ proc set_app_params stdcall,slot:dword, params:dword,\ mov eax, [esi+0x08] ;app_eip mov [ebx+REG_EIP], eax ;app_entry mov [ebx+REG_CS], dword app_code - mov [ebx+REG_EFLAGS], dword 0x1202 + mov [ebx+REG_EFLAGS], dword 0x3202 mov eax, [esi+0x0C] ;app_esp mov [ebx+REG_APP_ESP], eax ;app_stack diff --git a/kernel/branches/flat_kernel/kernel.asm b/kernel/branches/flat_kernel/kernel.asm index d98fdbd794..fae3ea3224 100644 --- a/kernel/branches/flat_kernel/kernel.asm +++ b/kernel/branches/flat_kernel/kernel.asm @@ -52,7 +52,9 @@ ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; $Revision$ +include 'macros.inc' + +$Revision$ include "proc32.inc" include "kglobals.inc" @@ -107,6 +109,7 @@ use16 version db 'Kolibri OS version 0.6.5.0 ',13,10,13,10,0 +include "boot/bootstr.inc" ; language-independent boot messages include "boot/preboot.inc" if lang eq en @@ -5034,6 +5037,8 @@ yes_shutdown_param: include "data32.inc" +__REV__ = __REV + uglobals_size = $ - endofcode diff16 "end of kernel code",0,$ diff --git a/kernel/branches/flat_kernel/kernel16.inc b/kernel/branches/flat_kernel/kernel16.inc deleted file mode 100644 index e69bd79df8..0000000000 --- a/kernel/branches/flat_kernel/kernel16.inc +++ /dev/null @@ -1,40 +0,0 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; KERNEL16.INC ;; -;; ;; -;; Included 16 bit kernel files for MenuetOS ;; -;; ;; -;; This file is kept separate as it will be easier to ;; -;; maintain and compile with an automated SETUP program ;; -;; in the future. ;; -;; ;; -;; Copyright Ville Turjanmaa, see file COPYING for details. ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - - -;% +include - -;!!! -if lang eq en -include "boot/booteng.inc" ; english system boot messages -else if lang eq ru -include "boot/bootru.inc" ; russian system boot messages -else if lang eq et -include "boot/bootet.inc" ; estonian system boot messages -else -include "boot/bootge.inc" ; german system boot messages -;!!! -end if -if lang eq et -include "boot/et.inc" ; Estonian font -else -include "boot/ru.inc" ; Russian font -end if -org $-0x10000 - -include "boot/bootcode.inc" ; 16 bit system boot code - -include "bus/pci/pci16.inc" - -;% -include \ No newline at end of file diff --git a/kernel/branches/flat_kernel/macros.inc b/kernel/branches/flat_kernel/macros.inc new file mode 100644 index 0000000000..dc31e92896 --- /dev/null +++ b/kernel/branches/flat_kernel/macros.inc @@ -0,0 +1,97 @@ + +__REV = 0 + +macro $Revision a { + match =: Num =$,a \{ + if __REV < Num + __REV = Num + end if + \} +} + +$Revision: 426 $ + +; structure definition helper +macro struct name, [arg] + { + common + name@struct equ name + struc name arg { + } + +macro struct_helper name + { + match xname,name + \{ + virtual at 0 + xname xname + sizeof.#xname = $ - xname + name equ sizeof.#xname + end virtual + \} + } + +ends fix } struct_helper name@struct + +;// mike.dld, 2006-29-01 [ + +; macros definition +macro diff16 title,l1,l2 +{ + local s,d + s = l2-l1 + display title,': 0x' + repeat 8 + d = 48 + s shr ((8-%) shl 2) and $0F + if d > 57 + d = d + 65-57-1 + end if + display d + end repeat + display 13,10 +} +macro diff10 title,l1,l2 + { + local s,d,z,m + s = l2-l1 + z = 0 + m = 1000000000 + display title,': ' + repeat 10 + d = '0' + s / m + s = s - (s/m)*m + m = m / 10 + if d <> '0' + z = 1 + end if + if z <> 0 + display d + end if + end repeat + display 13,10 + } + +; \begin{diamond}[29.09.2006] +; may be useful for kernel debugging +; example 1: +; dbgstr 'Hello, World!' +; example 2: +; dbgstr 'Hello, World!', save_flags +macro dbgstr string*, f +{ +local a +iglobal_nested +a db 'K : ',string,13,10,0 +endg_nested +if ~ f eq + pushfd +end if + push esi + mov esi, a + call sys_msg_board_str + pop esi +if ~ f eq + popfd +end if +} +; \end{diamond}[29.09.2006]