NEWS: document changes in 4.07
[profile/ivi/syslinux.git] / mbr / mbr.S
index e0d42d6..b71cfb7 100644 (file)
--- a/mbr/mbr.S
+++ b/mbr/mbr.S
@@ -1,6 +1,7 @@
 /* -----------------------------------------------------------------------
  *
- *   Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ *   Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
+ *   Copyright 2009 Intel Corporation; author: H. Peter Anvin
  *
  *   Permission is hereby granted, free of charge, to any person
  *   obtaining a copy of this software and associated documentation
@@ -25,6 +26,8 @@
  *
  * ----------------------------------------------------------------------- */
 
+#include "adjust.h"
+
        .code16
        .text
 
@@ -34,7 +37,8 @@ driveno               = (stack-6)
 sectors                = (stack-8)
 secpercyl      = (stack-12)
 
-BIOS_page = 0x462
+BIOS_kbdflags  = 0x417
+BIOS_page      = 0x462
 
        /* gas/ld has issues with doing this as absolute addresses... */
        .section ".bootsec", "a", @nobits
@@ -45,15 +49,14 @@ bootsec:
        .text
        .globl  _start
 _start:
+       .byte   0x33, 0xc0      /* xorw %ax, %ax */
        cli
-       xorw    %ax, %ax
        movw    %ax, %ds
        movw    %ax, %ss
        movw    $stack, %sp
        movw    %sp, %si
        pushw   %es             /* es:di -> $PnP header */
        pushw   %di
-       pushw   %dx             /* dl -> drive number */
        movw    %ax, %es
        sti
        cld
@@ -64,8 +67,11 @@ _start:
        rep; movsw
 
        ljmpw   $0, $next
-
 next:
+
+       ADJUST_DRIVE
+       pushw   %dx             /* dl -> drive number */
+
        /* Check to see if we have EBIOS */
        pushw   %dx             /* drive number */
        movb    $0x41, %ah      /* %al == 0 already */
@@ -144,7 +150,7 @@ read_sector_cbios:
 read_common:
        movb    (driveno), %dl
        int     $0x13
-       addw    $16, %sp        /* Drop DAPA */
+       leaw    16(%si), %sp    /* Drop DAPA */
        popal
        ret