]> git.proxmox.com Git - qemu.git/commitdiff
Fix multiboot compilation
authorAlexander Graf <agraf@suse.de>
Tue, 1 Jun 2010 23:56:50 +0000 (01:56 +0200)
committerAurelien Jarno <aurelien@aurel32.net>
Wed, 9 Jun 2010 10:36:11 +0000 (12:36 +0200)
Commit dd4239d6574ca41c94fc0d0f77ddc728510ffc57 broke multiboot. It replaced the
instruction "rep insb (%dx), %es:(%edi)" by the binary output of
"addr32 rep insb (%dx), %es:(%di)".

Linuxboot calls the respective helper function in a code16 section. So the
original instruction was automatically translated to its "addr32" equivalent.
For multiboot, we're running in code32 so gcc didn't add the "addr32" which
breaks the instruction.

This patch splits that helper function in one which uses addr32 and one which
does not, so everyone's happy.

The good news is that nobody probably cared so far. The bundled multiboot.bin
binary was built before the change and is thus correct.

Please also put this patch into -stable.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 590bf491a49670843ee902c47f7ab1de5e9acd06)

pc-bios/optionrom/linuxboot.S
pc-bios/optionrom/optionrom.h

index 8aebe51ee592cdaaaada57bb64864b153d1c4c50..c10936344dd887106cd28e24357cd9055d43a759 100644 (file)
@@ -106,10 +106,10 @@ copy_kernel:
        /* We're now running in 16-bit CS, but 32-bit ES! */
 
        /* Load kernel and initrd */
-       read_fw_blob(FW_CFG_KERNEL)
-       read_fw_blob(FW_CFG_INITRD)
-       read_fw_blob(FW_CFG_CMDLINE)
-       read_fw_blob(FW_CFG_SETUP)
+       read_fw_blob_addr32(FW_CFG_KERNEL)
+       read_fw_blob_addr32(FW_CFG_INITRD)
+       read_fw_blob_addr32(FW_CFG_CMDLINE)
+       read_fw_blob_addr32(FW_CFG_SETUP)
 
        /* And now jump into Linux! */
        mov             $0, %eax
index 4dcb90645c53ec5467e18b9288ca560eb3221bc2..fbdd48a021352042586618118f742e9213acfd69 100644 (file)
        bswap           %eax
 .endm
 
-/*
- * Read a blob from the fw_cfg device.
- * Requires _ADDR, _SIZE and _DATA values for the parameter.
- *
- * Clobbers:   %eax, %edx, %es, %ecx, %edi
- */
-#define read_fw_blob(var)                              \
+#define read_fw_blob_pre(var)                          \
        read_fw         var ## _ADDR;                   \
        mov             %eax, %edi;                     \
        read_fw         var ## _SIZE;                   \
        mov             $BIOS_CFG_IOPORT_CFG, %edx;     \
        outw            %ax, (%dx);                     \
        mov             $BIOS_CFG_IOPORT_DATA, %dx;     \
-       cld;                                            \
+       cld
+
+/*
+ * Read a blob from the fw_cfg device.
+ * Requires _ADDR, _SIZE and _DATA values for the parameter.
+ *
+ * Clobbers:   %eax, %edx, %es, %ecx, %edi
+ */
+#define read_fw_blob(var)                              \
+       read_fw_blob_pre(var);                          \
        /* old as(1) doesn't like this insn so emit the bytes instead: \
        rep insb        (%dx), %es:(%edi);              \
        */                                              \
+       .dc.b           0xf3,0x6c
+
+/*
+ * Read a blob from the fw_cfg device in forced addr32 mode.
+ * Requires _ADDR, _SIZE and _DATA values for the parameter.
+ *
+ * Clobbers:   %eax, %edx, %es, %ecx, %edi
+ */
+#define read_fw_blob_addr32(var)                               \
+       read_fw_blob_pre(var);                          \
+       /* old as(1) doesn't like this insn so emit the bytes instead: \
+       addr32 rep insb (%dx), %es:(%edi);              \
+       */                                              \
        .dc.b           0x67,0xf3,0x6c
 
 #define OPTION_ROM_START                                       \