All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Support for multiboot images in elf64 (EM_X86_64) format
@ 2012-02-04 17:38 Goswin von Brederlow
  2012-02-06 12:38 ` Stefan Hajnoczi
  0 siblings, 1 reply; 10+ messages in thread
From: Goswin von Brederlow @ 2012-02-04 17:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: goswin-v-b

Hi,

starting your own toy kernel is a fun thing to do and there are many
tutorials out there on how to do it. Unfortunately when one wants to
write a kernel in 64bit it becomes much harder because one can't    
compile 64bit code as elf32 image and converting a elf64 image to
elf32 format is a major hassle and looses debug information and symbols.

So I looked into why kvm does not load an multiboot image in elf64 format
and what would be neccessary to support this. And the answere is that
all it needs is to remove the error message. Kvm alredy supports loading
a multiboot image in elf64 format perfectly. There is no need to force the
user to convert their toy kernel from elf64 to elf32 format at all.

MfG
	Goswin
--
Description: Allow 64bit elf binaries in multiboot format
 This patch allows 64bit elf files with multiboot header to be loaded.
 The entry point will still be called in 32bit mode and the kernel
 must switch to 64bit mode on its own. The image and all modules must
 also be located in the lower 2GB of ram. All the restrictions of a
 32bit image still apply.
Author: Goswin von Brederlow <goswin-v-b@web.de>
Last-Updated: 2011-04-08
---

--- qemu-kvm-0.14.0+dfsg.orig/hw/multiboot.c
+++ qemu-kvm-0.14.0+dfsg/hw/multiboot.c
@@ -173,8 +173,7 @@ int load_multiboot(void *fw_cfg,
         fclose(f);
 
         if (((struct elf64_hdr*)header)->e_machine == EM_X86_64) {
-            fprintf(stderr, "Cannot load x86-64 image, give a 32bit one.\n");
-            exit(1);
+	    mb_debug("qemu: 64bit elf, I hope you know what you are doing\n");
         }
 
         kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-02-09 16:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-04 17:38 [Qemu-devel] Support for multiboot images in elf64 (EM_X86_64) format Goswin von Brederlow
2012-02-06 12:38 ` Stefan Hajnoczi
2012-02-08  9:53   ` Goswin von Brederlow
2012-02-08 11:30     ` Kevin Wolf
2012-02-08 12:06     ` Stefan Hajnoczi
2012-02-09  0:35       ` Paul Brook
2012-02-09 13:07         ` Goswin von Brederlow
2012-02-09 13:36           ` Paul Brook
2012-02-09 15:38             ` Goswin von Brederlow
2012-02-09 16:01               ` Paul Brook

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.