[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

possible bug in i386 boot.S floppy probing code

From: Mirko Parthey
Subject: possible bug in i386 boot.S floppy probing code
Date: Tue, 26 Oct 2010 15:08:30 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hello all,

while reading through grub-core/boot/i386/pc/boot.S in the Bazaar version
of Grub 2, I noticed that the floppy probing code calls
int $0x13, %ah===$0x02  /* disk read sector */
without initializing the %es register, and with %bx holding a value
that was likely meant to go into %es. (boot.S:465)

My proposed change is included below. The two additional instructions have been
copied from further above in boot.S, where the same BIOS function is
used correctly. The resulting machine code is enlarged by 4 bytes, but
apparently still fits within the 512-byte limit.

Please note that I found this by inspection, not by observing undesired
behaviour.  The patch passes "make" and "make check", but I'm not sure if the
code will actually be exercised by "make check".
I hope you find it useful.


=== modified file 'grub-core/boot/i386/pc/boot.S'
--- grub-core/boot/i386/pc/boot.S       2010-09-19 22:06:45 +0000
+++ grub-core/boot/i386/pc/boot.S       2010-10-26 09:51:29 +0000
@@ -459,6 +459,8 @@
        /* perform read */
        movw    $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx
+       movw    %bx, %es
+       xorw    %bx, %bx
        movw    $0x201, %ax
        movb    $0, %ch
        movb    $0, %dh

reply via email to

[Prev in Thread] Current Thread [Next in Thread]