Loading x86_64 images in multiboot was disabled on the ground that since
multiboot actually boots 64bit kernels in 32bit mode, the binary would
have to be 32bit.

https://lists.gnu.org/archive/html/qemu-devel/2010-08/msg00913.html

But making the binary 32bit makes using debugging tools such as gdb
unnecessarily complex since they don't understand what architecture the
kernel actually is.  Letting qemu load x86_64 images and boot them in 32bit
mode is completely fine, works, and is what the multiboot standard actually
expects.

This notably fixes loading gnumach in x86_64 mode.

Signed-off-by: Samuel Thibault <[email protected]>
---
 hw/i386/multiboot.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
index d544b62afb..004d5185fb 100644
--- a/hw/i386/multiboot.c
+++ b/hw/i386/multiboot.c
@@ -196,11 +196,6 @@ int load_multiboot(X86MachineState *x86ms,
         int kernel_size;
         fclose(f);
 
-        if (((struct elf64_hdr*)header)->e_machine == EM_X86_64) {
-            error_report("Cannot load x86-64 image, give a 32bit one.");
-            exit(1);
-        }
-
         kernel_size = load_elf(kernel_filename, NULL, NULL, NULL, &elf_entry,
                                &elf_low, &elf_high, NULL,
                                ELFDATA2LSB, I386_ELF_MACHINE, 0, 0);
-- 
2.53.0


Reply via email to