From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGL2y-0006Yn-4g for qemu-devel@nongnu.org; Thu, 03 Dec 2009 18:25:16 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGL2t-0006VW-64 for qemu-devel@nongnu.org; Thu, 03 Dec 2009 18:25:15 -0500 Received: from [199.232.76.173] (port=43295 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGL2s-0006VM-Pl for qemu-devel@nongnu.org; Thu, 03 Dec 2009 18:25:10 -0500 Received: from e6.ny.us.ibm.com ([32.97.182.146]:52661) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NGL2s-0007qV-LB for qemu-devel@nongnu.org; Thu, 03 Dec 2009 18:25:10 -0500 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by e6.ny.us.ibm.com (8.14.3/8.13.1) with ESMTP id nB3NKOk6024369 for ; Thu, 3 Dec 2009 18:20:24 -0500 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id nB3NP0uV132138 for ; Thu, 3 Dec 2009 18:25:00 -0500 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id nB3DHdkG031079 for ; Thu, 3 Dec 2009 08:17:39 -0500 Message-ID: <4B1848CB.6060006@linux.vnet.ibm.com> Date: Thu, 03 Dec 2009 17:24:59 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <20091130222544.GA21068@os.inf.tu-dresden.de> <20091130222650.GB21068@os.inf.tu-dresden.de> <4B181F09.2070704@codemonkey.ws> <20091203221958.GA16039@os.inf.tu-dresden.de> In-Reply-To: <20091203221958.GA16039@os.inf.tu-dresden.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 1/2] multiboot: Support arbitrary number of modules. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Adam Lackorzynski Cc: qemu-devel@nongnu.org Adam Lackorzynski wrote: > multiboot: Support arbitrary number of modules. > > Addressed comments by Anthony. > > Signed-off-by: Adam Lackorzynski > --- > hw/pc.c | 260 ++++++++++++++++++++++++++++++++++++++------------------------ > 1 files changed, 159 insertions(+), 101 deletions(-) > > diff --git a/hw/pc.c b/hw/pc.c > index 8c1b7ea..47d7796 100644 > --- a/hw/pc.c > +++ b/hw/pc.c > @@ -51,6 +51,12 @@ > /* Show multiboot debug output */ > //#define DEBUG_MULTIBOOT > > +#ifdef DEBUG_MULTIBOOT > +#define mb_debug(a...) fprintf(stderr, ## a) > +#else > +#define mb_debug(a...) > +#endif > + > #define BIOS_FILENAME "bios.bin" > > #define PC_MAX_BIOS_SIZE (4 * 1024 * 1024) > @@ -512,6 +518,77 @@ static long get_file_size(FILE *f) > #error multiboot struct needs to fit in 16 bit real mode > #endif > > +enum { > + /* Multiboot info */ > + MBI_FLAGS = 0, > + MBI_MEM_LOWER = 4, > + MBI_MEM_UPPER = 8, > + MBI_BOOT_DEVICE = 12, > + MBI_CMDLINE = 16, > + MBI_MODS_COUNT = 20, > + MBI_MODS_ADDR = 24, > + MBI_MMAP_ADDR = 48, > + > + MBI_SIZE = 88, > + > + /* Multiboot modules */ > + MB_MOD_START = 0, > + MB_MOD_END = 4, > + MB_MOD_CMDLINE = 8, > + > + MB_MOD_SIZE = 16, > + > + /* Region offsets */ > + ADDR_E820_MAP = MULTIBOOT_STRUCT_ADDR + 0, > + ADDR_MBI = ADDR_E820_MAP + 0x500, > + > + /* Multiboot flags */ > + MULTIBOOT_FLAGS_MEMORY = 1 << 0, > + MULTIBOOT_FLAGS_BOOT_DEVICE = 1 << 1, > + MULTIBOOT_FLAGS_CMDLINE = 1 << 2, > + MULTIBOOT_FLAGS_MODULES = 1 << 3, > + MULTIBOOT_FLAGS_MMAP = 1 << 6, > +}; > + > +struct MultibootState { > + void *mb_buf; /* buffer holding kernel, cmdlines and mb_infos */ > + uint32_t mb_buf_phys; /* address in target */ > + int mb_buf_size; /* size of mb_buf in bytes */ > + int mb_mods_avail; /* available slots for mb modules infos */ > + int mb_mods_count; /* currently used slots of mb modules */ > + int offset_mbinfo; /* offset of mb-info's in bytes */ > + int offset_cmdlines; /* offset in buffer for cmdlines */ > + int offset_mods; /* offset of modules in bytes */ > +}; > Should be typedef struct MultibootState. See CODING_STYLE. Also, shouldn't these offsets be something other than int? Does multiboot always load in 32-bit mode (never 64-bit mode?). mb_buf_phys should not be a u32. It should be a target address type. -- Regards, Anthony Liguori