Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386/stand/mbr Save 2 more bytes (by adjusting the ...



details:   https://anonhg.NetBSD.org/src/rev/4b9d18321896
branches:  trunk
changeset: 569783:4b9d18321896
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sun Sep 05 21:42:43 2004 +0000

description:
Save 2 more bytes (by adjusting the ERR_NO_LBA setup).
Use up all the space by adding a short banner message.
'Fn diskn' for bootsel and 'NetBSB MBR boot' for the non-bootsel code.

diffstat:

 sys/arch/i386/stand/mbr/mbr.S |  47 ++++++++++++++++++++++++++++--------------
 1 files changed, 31 insertions(+), 16 deletions(-)

diffs (123 lines):

diff -r 947cf1588888 -r 4b9d18321896 sys/arch/i386/stand/mbr/mbr.S
--- a/sys/arch/i386/stand/mbr/mbr.S     Sun Sep 05 21:32:30 2004 +0000
+++ b/sys/arch/i386/stand/mbr/mbr.S     Sun Sep 05 21:42:43 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mbr.S,v 1.10 2004/09/01 20:31:20 dsl Exp $     */
+/*     $NetBSD: mbr.S,v 1.11 2004/09/05 21:42:43 dsl Exp $     */
 
 /*
  * Copyright (c) 1999-2004 The NetBSD Foundation, Inc. 
@@ -47,6 +47,7 @@
  * TERSE_ERROR - terse error messages
  * NO_CHS      - all reads are LBA
  * NO_LBA_CHECK        - no check if bios supports LBA reads
+ * NO_BANNER    - do not output 'banner'
  */
 
 #ifdef BOOT_EXTENDED
@@ -54,6 +55,10 @@
 #define BOOTSEL        1
 #endif
 
+#ifdef BOOTSEL
+#define TERSE_ERROR 1
+#endif
+
 #include <machine/asm.h>
 #include <sys/bootblock.h>
 
@@ -107,10 +112,10 @@
        movw    $start, %di
        movw    $(bss_start - start)/2, %cx
        rep
-       movsw
+       movsw                           /* relocate code */
        mov     $(bss_end - bss_start + 1)/2, %cx
        rep
-       stosw
+       stosw                           /* zero bss */
        ljmp    $0, $mbr                /* leap into copy of code */
 
 /*
@@ -125,6 +130,11 @@
        push    %dx                     /* save drive number */
        push    %dx                     /* twice - for err_msg loop */
 
+#ifndef NO_BANNER
+       mov     $banner, %si
+       call    message_crlf
+#endif
+
 /*
  * Walk through the selector (name) table printing used entries.
  */
@@ -182,9 +192,7 @@
 #endif
 #undef CONST
        mov     %bx, %si
-       call    message                 /* prompt */
-       movw    $crlf, %si
-       call    message
+       call    message_crlf                    /* prompt */
 #endif
 4:
        add     $0x10, %bp
@@ -317,13 +325,10 @@
        movw    $errtxt, %si
        call    message
 #else
-       push    %ax
        movw    $errtxt, %si
        call    message
-       pop     %si
-       call    message
-       movw    $crlf, %si
-       call    message
+       mov     %ax, %si
+       call    message_crlf
 #endif
        pop     %dx                     /* drive we errored on */
        xor     %ax,%ax                 /* only need %ah = 0 */
@@ -405,13 +410,12 @@
        pop     %dx
        push    %dx
        int     $0x13
-       jc      1f                      /* no int13 extensions */
+       set_err(ERR_NO_LBA)
+       jc      err_msg                 /* no int13 extensions */
        cmpw    $0xaa55, %bx
-       jnz     1f
+       jnz     err_msg
        testb   $1, %cl
-       jnz     boot_lba
-1:     set_err(ERR_NO_LBA)
-       jmp     err_msg
+       jz      err_msg
 #endif /* NO_LBA_CHECK */
 #endif /* NO_CHS */
 
@@ -488,6 +492,14 @@
 errcod: .byte  0
 crlf:  .asciz  "\r\n"
 
+#ifndef NO_BANNER
+#ifdef BOOTSEL
+banner:        .asciz  "Fn: diskn"
+#else
+banner:        .asciz  "NetBSD MBR boot"
+#endif
+#endif
+
 #ifdef BOOTSEL
 prefix:        .asciz  "0: "
 #endif
@@ -510,6 +522,9 @@
  * Clearly this could be done with a linker script.
  */
 
+message_crlf:
+       call    message
+       movw    $crlf, %si
 #include <message.S>
 #if 0
 #include <dump_eax.S>



Home | Main Index | Thread Index | Old Index