From 289d77c6733182088953a02b9c09776272b04203 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 11 Jul 2007 16:51:46 -0700 Subject: [PATCH] MBR: Don't clobber %eax before entering CBIOS code --- mbr/mbr.S | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mbr/mbr.S b/mbr/mbr.S index 9e89b37..b9729eb 100644 --- a/mbr/mbr.S +++ b/mbr/mbr.S @@ -80,8 +80,10 @@ next: shrw %cx /* Bit 0 = fixed disk subset */ jnc 1f - /* We have EBIOS; patch in jump to skip over read_sector_cbios */ - movw $0xeb+((read_common-read_sector_cbios-2)<< 8), (read_sector_cbios) + /* We have EBIOS; patch in the following code at + read_sector_cbios: movb $0x42, %ah ; jmp read_common */ + movl $0xeb42b4+((read_common-read_sector_cbios-4) << 24), \ + (read_sector_cbios) 1: popw %dx @@ -120,9 +122,9 @@ read_sector: pushw $1 /* Sector count */ pushw $16 /* Size of packet */ movw %sp, %si - movb $0x42, %ah /* This chunk is skipped if we have ebios */ + /* Do not clobber %eax before this chunk! */ read_sector_cbios: divl (secpercyl) shlb $6, %ah -- 2.7.4