From 6f7428a7e4ffa4beb7551207725f069cd3c5c29f Mon Sep 17 00:00:00 2001 From: "Mihail Semenyako (mike.dld)" Date: Thu, 22 Mar 2007 01:09:49 +0000 Subject: [PATCH] Changes to make __REV__ constant at any place in kernel Output SVN revision number in boot screen git-svn-id: svn://kolibrios.org@426 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/boot/bootcode.inc | 36 ++++++++++++- kernel/trunk/kernel.asm | 17 +++--- kernel/trunk/kernel16.inc | 6 ++- kernel/trunk/kernel32.inc | 85 ----------------------------- kernel/trunk/macros.inc | 97 ++++++++++++++++++++++++++++++++++ 5 files changed, 145 insertions(+), 96 deletions(-) create mode 100644 kernel/trunk/macros.inc diff --git a/kernel/trunk/boot/bootcode.inc b/kernel/trunk/boot/bootcode.inc index 3be9227980..f99049fb37 100644 --- a/kernel/trunk/boot/bootcode.inc +++ b/kernel/trunk/boot/bootcode.inc @@ -156,6 +156,20 @@ printplain: popa ret +uint2str_16: + cmp ax,cx + jb @f + xor dx,dx + div cx + push dx + call uint2str_16 + pop ax + @@: cmp al,10 + sbb al,$69 + das + stosb + ret + ; Now int 16 is used for keyboard support. ; This is shorter, simpler and more reliable. if 0 @@ -532,7 +546,6 @@ wait_loop: ; variant 2 mov [si + 7], al _setcursor 0, 3 call printplain - _setcursor d80x25_top_num,0 ; ------------------ mov ax, 0x5304 ; Disconnect interface @@ -561,6 +574,26 @@ wait_loop: ; variant 2 apm_end: ; ----------------------------------------- +; --------------- REVISION ---------------- + push ds + pop es + mov di,svn_num_buf - 0x10000 + mov ax,__REV__ + mov cx,10 + call uint2str_16 + mov ax,' ' + stosw + sub di,svn_num_buf - 0x10000 + mov dx,80 - 1 - msg_svn.len + sub dx,di + call setcursor + mov si,msg_svn - 0x10000 + call printplain + mov si,svn_num_buf - 0x10000 + call printplain + _setcursor d80x25_top_num,0 +; ----------------------------------------- + ; DISPLAY VESA INFORMATION push 0 @@ -1298,3 +1331,4 @@ setgr: gmok2: push ds pop es + diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index d09ca13001..59ebba8732 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -10,15 +10,11 @@ ;; Compile with last version FASM ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -_REV_ = 0 -macro $Revision a { - match =: Num =$,a \{ - if _REV_ < Num - _REV_ = Num - end if - \} -} + +include 'macros.inc' + $Revision$ + include "proc32.inc" include "kglobals.inc" include "lang.inc" @@ -5112,4 +5108,7 @@ endofcode: IncludeUGlobals uglobals_size = $ - endofcode diff16 "end of kernel code",0,$ -diff10 "revision",0,_REV_ + +__REV__ = __REV + +diff10 "revision",0,__REV__ diff --git a/kernel/trunk/kernel16.inc b/kernel/trunk/kernel16.inc index 948a24243d..1e497bfb5a 100644 --- a/kernel/trunk/kernel16.inc +++ b/kernel/trunk/kernel16.inc @@ -16,6 +16,10 @@ $Revision$ ;% +include +msg_svn db " SVN ",0 +msg_svn.len = $ - msg_svn +svn_num_buf rb 12 + ;!!! if lang eq en include "boot/booteng.inc" ; english system boot messages @@ -29,7 +33,7 @@ include "boot/bootge.inc" ; german system boot messages end if if lang eq et include "boot/et.inc" ; Estonian font -else +else if lang eq ru include "boot/ru.inc" ; Russian font end if diff --git a/kernel/trunk/kernel32.inc b/kernel/trunk/kernel32.inc index 5c9e2e64b3..a95476bb63 100644 --- a/kernel/trunk/kernel32.inc +++ b/kernel/trunk/kernel32.inc @@ -11,91 +11,6 @@ $Revision$ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; 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] - ;struc db [a] { common . db a ; if ~used . ; display 'not used db: ',`.,13,10 diff --git a/kernel/trunk/macros.inc b/kernel/trunk/macros.inc new file mode 100644 index 0000000000..e37b79bcb2 --- /dev/null +++ b/kernel/trunk/macros.inc @@ -0,0 +1,97 @@ + +__REV = 0 + +macro $Revision a { + match =: Num =$,a \{ + if __REV < Num + __REV = Num + end if + \} +} + +$Revision$ + +; 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]