Subject: mbr seems to check MBR_MAGIC against wrong location
To: None <port-i386@netbsd.org>
From: Yuichiro Goto <goto@acr.kanazawa-it.ac.jp>
List: port-i386
Date: 05/06/2005 10:17:11
Hi,

I recently read src/sys/arch/i386/stand/mbr/mbr.S, and I have had a
question.

When the mbr code checks extended partition chain, it always checks
MBR_MAGIC against
itself, that is LOADADDR + MBR_MAGIC_OFFSET, but not newly loaded
sector into BOOTADDR. I think
BOOTADDR + MBR_MAGIC_OFFSET is correct location to check.

Yuichiro Goto

Index: mbr.S
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/mbr/mbr.S,v
retrieving revision 1.12
diff -u -r1.12 mbr.S
--- mbr.S       12 Sep 2004 08:41:47 -0000      1.12
+++ mbr.S       30 Apr 2005 01:57:24 -0000
@@ -217,7 +217,7 @@
        push    %dx                     /* save drive */
        int     $0x13
        jc      wait_key                /* abort menu on read fail */
-       cmpw    $MBR_MAGIC, LOADADDR + MBR_MAGIC_OFFSET
+       cmpw    $MBR_MAGIC, BOOTADDR + MBR_MAGIC_OFFSET
        movw    $nametab - LOADADDR + BOOTADDR, %bx
        je      next_extended
 #endif