From b8c15b400ad50af55678defe7c488262f21ac5fc Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 26 May 2009 09:14:41 -0700 Subject: [PATCH] isohdpfx: don't clear %ds before parsing partiting info The partition information is pointed to by ds:si; although ds will *usually* be 0 it isn't guaranteed (in particular, it may very well be 0x40 or 0x60); therefore, move the partition parsing up before the reset of %ds and %es. As a side benefit, we get to use push again... Also, fix the ordering of the two halves of the GPT LBA! Signed-off-by: H. Peter Anvin --- mbr/isohdpfx.S | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/mbr/isohdpfx.S b/mbr/isohdpfx.S index 31a792e..375c846 100644 --- a/mbr/isohdpfx.S +++ b/mbr/isohdpfx.S @@ -67,19 +67,12 @@ bootsec: _start: cli - xorw %bx, %bx - movw %bx, %ds - movw %bx, %ss - movw $partoffset, %sp - pushw %es /* -12: es:di -> $PnP header */ - pushw %di - movw %bx, %es + xorw %bp, %bp + movw %bp, %ss + movw $stack, %sp sti cld - ADJUST_DRIVE - pushw %dx /* -14: dl -> drive number */ - /* Check to see if we have a partition table entry */ xorl %ebx, %ebx xorl %ecx, %ecx @@ -94,8 +87,8 @@ _start: jne 2f /* We have GPT partition information */ - movl (36+16)(%si), %ecx - movl (32+16)(%si), %ebx + movl (32+16)(%si), %ecx + movl (36+16)(%si), %ebx jmp 1f /* We have non-GPT partition information */ @@ -104,8 +97,16 @@ _start: #endif 1: /* We have no partition information */ - movl %ecx, (partoffset) /* -4: partoffset_hi */ - movl %ebx, (partoffset+4) /* -0: partoffset_lo */ + pushl %ebx /* -4: partoffset_hi */ + pushl %ecx /* -8: partoffset_lo */ + pushw %es /* -10: es:di -> $PnP header */ + pushw %di /* -12: es:di -> $PnP header */ + + movw %bp, %ds + movw %bp, %es + + ADJUST_DRIVE + pushw %dx /* -14: dl -> drive number */ /* Copy down to 0:0x600 */ movw $0x7c00, %si -- 2.7.4