qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@linux.vnet.ibm.com>
To: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 1/2] multiboot: Support arbitrary number of modules.
Date: Thu, 03 Dec 2009 17:24:59 -0600	[thread overview]
Message-ID: <4B1848CB.6060006@linux.vnet.ibm.com> (raw)
In-Reply-To: <20091203221958.GA16039@os.inf.tu-dresden.de>

Adam Lackorzynski wrote:
> multiboot: Support arbitrary number of modules.
>
> Addressed comments by Anthony.
>
> Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
> ---
>  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

  parent reply	other threads:[~2009-12-03 23:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-30 22:25 [Qemu-devel] [PATCH 1/2] multiboot: Fix module loading and setting of mmap Adam Lackorzynski
2009-11-30 22:26 ` [Qemu-devel] [PATCH 2/2] multiboot: Support arbitrary number of modules Adam Lackorzynski
2009-12-01  6:51   ` Alexander Graf
2009-12-03 20:26   ` Anthony Liguori
2009-12-03 22:19     ` [Qemu-devel] [PATCH 1/2] " Adam Lackorzynski
2009-12-03 22:23       ` [Qemu-devel] [PATCH 2/2] multiboot: Separate multiboot loading into separate file Adam Lackorzynski
2009-12-03 23:20         ` Alexander Graf
2009-12-03 23:24       ` Anthony Liguori [this message]
2009-12-06 12:52         ` [Qemu-devel] [PATCH 1/2] multiboot: Support arbitrary number of modules Adam Lackorzynski
2009-12-06 12:53           ` [Qemu-devel] [PATCH 2/2] multiboot: Separate multiboot loading into separate file Adam Lackorzynski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B1848CB.6060006@linux.vnet.ibm.com \
    --to=aliguori@linux.vnet.ibm.com \
    --cc=adam@os.inf.tu-dresden.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).