diff --git a/ChangeLog b/ChangeLog index 092bd5e87..f0f4de245 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-11-24 Vladimir Serbinenko + + * grub-core/boot/i386/pc/boot.S: Fix floppy probe. Due to missing + %dx restore the probe worked on non-existant drive. Reorganize the + code a little bit to free 2 bytes necessary for push/pop. + 2013-11-23 Vladimir Serbinenko * grub-core/kern/mips/arc/init.c (grub_machine_get_bootlocation): diff --git a/grub-core/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S index c0880c6b8..5b959b627 100644 --- a/grub-core/boot/i386/pc/boot.S +++ b/grub-core/boot/i386/pc/boot.S @@ -35,6 +35,7 @@ probe_values: .byte 36, 18, 15, 9, 0 LOCAL(floppy_probe): + pushw %dx /* * Perform floppy probe. */ @@ -50,8 +51,8 @@ LOCAL(probe_loop): movb (%si), %cl /* if number of sectors is 0, display error and die */ - cmpb $0, %cl - jne 1f + testb %cl, %cl + jnz 1f /* * Floppy disk probe failure. @@ -318,11 +319,12 @@ LOCAL(chs_mode): int $0x13 jnc LOCAL(final_init) + popw %dx /* * The call failed, so maybe use the floppy probe instead. */ - testb $GRUB_BOOT_MACHINE_BIOS_HD_FLAG, %dl - jz LOCAL(floppy_probe) + testb %dl, %dl + jnb LOCAL(floppy_probe) /* Nope, we definitely have a hard disk, and we're screwed. */ ERR(hd_probe_error_string)