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 Adjust the way references to the unr...



details:   https://anonhg.NetBSD.org/src/rev/79ad605ed498
branches:  trunk
changeset: 749133:79ad605ed498
user:      dsl <dsl%NetBSD.org@localhost>
date:      Wed Nov 18 20:51:22 2009 +0000

description:
Adjust the way references to the unrelocated addresses are done so
that the address doesn't have to be passed in.
Adjust #ifdef so that only one item is checked - at it is the one used.

diffstat:

 sys/arch/i386/stand/mbr/mbr.S |  25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)

diffs (109 lines):

diff -r 2e99dd3e2261 -r 79ad605ed498 sys/arch/i386/stand/mbr/mbr.S
--- a/sys/arch/i386/stand/mbr/mbr.S     Wed Nov 18 20:33:39 2009 +0000
+++ b/sys/arch/i386/stand/mbr/mbr.S     Wed Nov 18 20:51:22 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mbr.S,v 1.20 2008/11/28 18:18:16 dsl Exp $     */
+/*     $NetBSD: mbr.S,v 1.21 2009/11/18 20:51:22 dsl Exp $     */
 
 /*
  * Copyright (c) 1999-2004 The NetBSD Foundation, Inc. 
@@ -63,6 +63,8 @@
 #if !defined(COM_FREQ)
 #define COM_FREQ 1843200
 #endif
+#else
+#undef COM_BAUD
 #endif
 
 #ifdef BOOTSEL
@@ -72,8 +74,7 @@
 #include <machine/asm.h>
 #include <sys/bootblock.h>
 
-#define BOOTADDR       0x7c00
-#define LOADADDR       0x0600          /* address were are linked to */
+#define BOOTADDR       0x7c00          /* where we get loaded to */
 
 #define TABENTRYSIZE   (MBR_BS_PARTNAMESIZE + 1)
 #define NAMETABSIZE    (MBR_PART_COUNT * TABENTRYSIZE)
@@ -130,7 +131,7 @@
        mov     %ax, %es
        mov     %ax, %ds
        movw    $mbr, %di
-       mov     $mbr - LOADADDR + BOOTADDR, %si
+       mov     $BOOTADDR + (mbr - start), %si
        push    %ax                     /* zero for %cs of lret */
        push    %di
        movw    $(bss_start - mbr), %cx
@@ -153,7 +154,7 @@
        push    %dx                     /* save drive number */
        push    %dx                     /* twice - for err_msg loop */
 
-#if defined(COM_PORT) && defined(COM_BAUD)
+#if defined(COM_BAUD)
        mov     $com_args, %si
        mov     $num_com_args, %cl      /* %ch is zero from above */
        mov     COM_PORT_VAL, %dx
@@ -258,7 +259,7 @@
        pop     %dx                     /* recover drive # */
        push    %dx                     /* save drive */
        int     $0x13
-       movw    $nametab - LOADADDR + BOOTADDR, %bx
+       movw    $BOOTADDR + (nametab - start), %bx
        jnc     next_extended           /* abort menu on read fail */
 #endif
 
@@ -284,7 +285,7 @@
        int     $0x1a
        mov     %dx, %di                /* start time to di */
 3:
-#ifdef COM_PORT
+#ifdef COM_PORT_VAL
        mov     COM_PORT_VAL, %dx
        push    %dx
        add     $5, %dx
@@ -391,7 +392,7 @@
        pop     %dx                     /* original drive number */
        push    %dx
        push    %dx
-#ifdef COM_PORT
+#ifdef COM_PORT_VAL
        jmp     wait_key                /* Read with timeout (again) */
 #else
        jmp     get_key                 /* Blocking read */
@@ -514,7 +515,7 @@
 */
        movl    %ebp, %esi
        pop     %dx                     /* recover drive # */
-       jmp     start - LOADADDR + BOOTADDR
+       jmp     BOOTADDR
 
 
 #ifndef NO_CHS
@@ -552,7 +553,7 @@
 
 #ifndef NO_BANNER
 #ifdef BOOTSEL
-#ifdef COM_PORT
+#ifdef COM_PORT_VAL
 banner:        .asciz  "a: disk"
 #else
 banner:        .asciz  "Fn: diskn"
@@ -578,7 +579,7 @@
 #endif
 #endif
 
-#if defined(COM_PORT) && defined(COM_BAUD)
+#if defined(COM_BAUD)
 #define COM_DIVISOR (((COM_FREQ / COM_BAUD) + 8) / 16)
 com_args:
        .byte   0x80                    /* divisor latch enable */
@@ -601,7 +602,7 @@
 message_crlf:
        call    message
        movw    $crlf, %si
-#ifdef COM_PORT
+#ifdef COM_PORT_VAL
 message:
        pusha
 message_1:



Home | Main Index | Thread Index | Old Index