From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MHFaQ-0002BL-39 for qemu-devel@nongnu.org; Thu, 18 Jun 2009 07:15:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MHFaL-00029E-Dk for qemu-devel@nongnu.org; Thu, 18 Jun 2009 07:15:17 -0400 Received: from [199.232.76.173] (port=36861 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MHFaL-000297-83 for qemu-devel@nongnu.org; Thu, 18 Jun 2009 07:15:13 -0400 Received: from mx2.redhat.com ([66.187.237.31]:52424) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MHFaJ-0008PQ-T9 for qemu-devel@nongnu.org; Thu, 18 Jun 2009 07:15:13 -0400 Date: Thu, 18 Jun 2009 14:15:03 +0300 From: Gleb Natapov Subject: Re: [Qemu-devel] [PATCH 0/4] Add multiboot support (x86) v2 Message-ID: <20090618111503.GC20289@redhat.com> References: <1245256873-8010-1-git-send-email-agraf@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1245256873-8010-1-git-send-email-agraf@suse.de> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: kwolf@redhat.com, rene@exactcode.de, qemu-devel@nongnu.org On Wed, Jun 17, 2009 at 06:41:09PM +0200, Alexander Graf wrote: > This patch implements support for Multiboot on x86 for -kernel. > Multiboot is a "new" approach to get rid of different bootloaders, providing > a unified interface for the kernel. It supports command line options and > kernel modules. > > The two probably best known projects using multiboot are Xen and GNU Hurd. > > This implementation should be mostly feature-complete. It is missing VBE > extensions, but as no system uses them currently it does not really hurt. > > To use multiboot, specify the kernel as -kernel option. Modules should be given > as -initrd options, seperated by a comma (,). -append also works. > > Please bear in mind that grub also does gzip decompression, which qemu does > not do yet. To run existing images, please ungzip them first. > > The guest multiboot loader code is implemented as option rom using int 19. > Parts of the work are based on efforts by Rene Rebe, who originally ported > my code to int 19. > > Also, Kevin Wolf helped a lot whenever I had a new version of this patch > around. > With this small patch it also works for me in KVM diff --git a/pc-bios/multiboot/multiboot.S b/pc-bios/multiboot/multiboot.S index 5a2acba..943c381 100644 --- a/pc-bios/multiboot/multiboot.S +++ b/pc-bios/multiboot/multiboot.S @@ -156,9 +156,6 @@ mmap_store_entry: mmap_done: real_to_prot: - /* get us to protected mode now */ - movl $1, %eax - movl %eax, %cr0 /* Load the GDT before going into protected mode */ xor %bx, %bx @@ -166,12 +163,9 @@ real_to_prot: lgdt: addr32 data32 lgdt (gdt_desc) - /* the LJMP sets CS for us and gets us to 32-bit */ -ljmp: - addr32 data32 ljmp *(prot_jump) - -prot_mode: -.code32 + /* get us to protected mode now */ + movl $1, %eax + movl %eax, %cr0 /* initialize all other segments */ movl $0x10, %eax @@ -181,6 +175,12 @@ prot_mode: movl %eax, %fs movl %eax, %gs + /* the LJMP sets CS for us and gets us to 32-bit */ +ljmp: + addr32 data32 ljmp *(prot_jump) + +prot_mode: +.code32 /* Jump off to the kernel */ read_fw FW_CFG_KERNEL_ADDR mov_pj: -- Gleb.