mbr: Make sure the MBR code starts with the byte 0x33
authorH. Peter Anvin <hpa@zytor.com>
Thu, 23 Dec 2010 20:02:52 +0000 (12:02 -0800)
committerH. Peter Anvin <hpa@zytor.com>
Thu, 23 Dec 2010 20:02:52 +0000 (12:02 -0800)
Apparently some BIOSes (including some Acer Travelmate machines)
require an MBR to start with 0x33; apparently Micro$oft MBRs start
with 33 C0, an alternate coding of the "xorw %ax,%ax" instruction.  As
such, follow suit to work on these braindead BIOSes.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
mbr/altmbr.S
mbr/gptmbr.S
mbr/isohdpfx.S
mbr/mbr.S

index 794ab62..1b60905 100644 (file)
@@ -49,8 +49,8 @@ bootsec:
        .text
        .globl  _start
 _start:
+       .byte   0x33, 0xc0      /* xorw %ax, %ax */
        cli
-       xorw    %ax, %ax
        movw    %ax, %ds
        movw    %ax, %ss
        movw    $stack, %sp
index 8ed4cf4..ae0549f 100644 (file)
@@ -55,8 +55,8 @@ bootsec:
        .text
        .globl  _start
 _start:
+       .byte   0x33, 0xc0      /* xorw %ax, %ax */
        cli
-       xorw    %ax, %ax
        movw    %ax, %ds
        movw    %ax, %ss
        movw    $stack, %sp
index 0bf807e..2784fb8 100644 (file)
@@ -65,9 +65,8 @@ bootsec:
        .text
        .globl  _start
 _start:
-
+       .byte   0x33, 0xed      /* xorw %bp, %bp */
        cli
-       xorw    %bp, %bp
        movw    %bp, %ss
        movw    $stack, %sp
        sti
index 7caf4fc..b71cfb7 100644 (file)
--- a/mbr/mbr.S
+++ b/mbr/mbr.S
@@ -49,8 +49,8 @@ bootsec:
        .text
        .globl  _start
 _start:
+       .byte   0x33, 0xc0      /* xorw %ax, %ax */
        cli
-       xorw    %ax, %ax
        movw    %ax, %ds
        movw    %ax, %ss
        movw    $stack, %sp