multiboot: Fix module loading and setting of mmap.
authorAdam Lackorzynski <adam@os.inf.tu-dresden.de>
Mon, 30 Nov 2009 22:25:44 +0000 (23:25 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Thu, 3 Dec 2009 21:25:58 +0000 (15:25 -0600)
Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/pc.c
pc-bios/multiboot.bin
pc-bios/optionrom/multiboot.S

diff --git a/hw/pc.c b/hw/pc.c
index 97964b27ebd487de863e782541d4fbf73d8c8a54..dac01ce57515c90080b45fd13c0b9421b5889f60 100644 (file)
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -666,7 +666,7 @@ static int load_multiboot(void *fw_cfg,
 
             /* append module data at the end of last module */
             mb_kernel_data = qemu_realloc(mb_kernel_data,
-                                          mh_load_addr - mb_mod_end);
+                                          mb_mod_end - mh_load_addr);
             load_image(initrd_filename,
                        mb_kernel_data + mb_mod_start - mh_load_addr);
 
index 59737c3c6798f83c1b35534d7865c79ba9ca3bc8..d7da6e04ad6d71d26f577d9d6a019719bcce8766 100644 (file)
Binary files a/pc-bios/multiboot.bin and b/pc-bios/multiboot.bin differ
index be5c9fcf36ffb6b8b6edc5981b0ace8acf362d49..913183739cee764cec43ad24f6ae77fe2fb97d65 100644 (file)
@@ -62,6 +62,9 @@ run_multiboot:
        add             %eax, %ebx
        movl            %ebx, %gs:GS_GDT_DESC + 2
 
+       xor             %eax, %eax
+       mov             %eax, %es
+
        /* Read the bootinfo struct into RAM */
        read_fw_blob(FW_CFG_INITRD)
 
@@ -71,7 +74,7 @@ run_multiboot:
        mov             %ax, %fs
 
        /* ES = mmap_addr */
-       mov             %eax, %fs:0x48
+       mov             %fs:48, %eax
        shr             $4, %eax
        mov             %ax, %es