grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] decouple mmap parsing and implement Multiboot mmap in the lo


From: Marco Gerards
Subject: Re: [PATCH] decouple mmap parsing and implement Multiboot mmap in the loader
Date: Wed, 13 Aug 2008 19:52:59 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Hi,

Robert Millan <address@hidden> writes:

> And here we go *AGAIN*, this time not forgetting to include all files in the
> patch.

[...]

> Index: include/grub/i386/pc/init.h
> ===================================================================
> --- include/grub/i386/pc/init.h       (revision 1802)
> +++ include/grub/i386/pc/init.h       (working copy)
> @@ -1,6 +1,6 @@
>  /*
>   *  GRUB  --  GRand Unified Bootloader
> - *  Copyright (C) 2002,2004,2005,2007  Free Software Foundation, Inc.
> + *  Copyright (C) 2002,2004,2005,2007,2008  Free Software Foundation, Inc.
>   *
>   *  GRUB is free software: you can redistribute it and/or modify
>   *  it under the terms of the GNU General Public License as published by
> @@ -21,6 +21,8 @@
>  
>  #include <grub/types.h>
>  #include <grub/symbol.h>
> +#include <grub/multiboot.h>  /* For struct grub_mmap_entry, which is also
> +                                needed by Multiboot.  */

Isn't it better to split the header file?  This seems like a hack.
  
>  /* Get the memory size in KB. If EXTENDED is zero, return conventional
>     memory, otherwise return extended memory.  */
> @@ -30,19 +32,18 @@
>     in 1KB parts, and upper 16 bits are above 16MB in 64KB parts.  */
>  grub_uint32_t grub_get_eisa_mmap (void);
>  
> -struct grub_machine_mmap_entry
> -{
> -  grub_uint32_t size;
> -  grub_uint64_t addr;
> -  grub_uint64_t len;
> -  grub_uint32_t type;
> -} __attribute__((packed));
> +/* Multiboot mmaps have been defined to match with the E820 definition.  */
> +#define GRUB_MACHINE_MEMORY_AVAILABLE        GRUB_MMAP_MEMORY_AVAILABLE
> +#define GRUB_MACHINE_MEMORY_RESERVED GRUB_MMAP_MEMORY_RESERVED
>  
>  /* Get a memory map entry. Return next continuation value. Zero means
>     the end.  */
> -grub_uint32_t EXPORT_FUNC(grub_get_mmap_entry) (struct 
> grub_machine_mmap_entry *entry,
> +grub_uint32_t EXPORT_FUNC(grub_get_mmap_entry) (struct grub_mmap_entry 
> *entry,
>                                  grub_uint32_t cont);
>  
> +void EXPORT_FUNC(grub_mmap_iterate)
> +     (int (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
> +
>  /* Turn on/off Gate A20.  */
>  void grub_gate_a20 (int on);
>  
> Index: include/grub/i386/coreboot/memory.h
> ===================================================================
> --- include/grub/i386/coreboot/memory.h       (revision 1802)
> +++ include/grub/i386/coreboot/memory.h       (working copy)
> @@ -25,7 +25,6 @@
>  
>  #ifndef ASM_FILE
>  #include <grub/types.h>
> -#include <grub/err.h>
>  #endif
>  
>  #define GRUB_MEMORY_MACHINE_LOWER_USABLE             0x9fc00         /* 640 
> kiB - 1 kiB */
> @@ -55,13 +54,13 @@
>  {
>    grub_uint64_t addr;
>    grub_uint64_t size;
> -#define GRUB_LINUXBIOS_MEMORY_AVAILABLE      1
> +#define GRUB_MACHINE_MEMORY_AVAILABLE                1
>    grub_uint32_t type;
>  };
>  typedef struct grub_linuxbios_mem_region *mem_region_t;
>  
> -grub_err_t EXPORT_FUNC(grub_available_iterate)
> -     (int (*hook) (mem_region_t));
> +void EXPORT_FUNC(grub_mmap_iterate)
> +     (int (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
>  
>  #endif
>  
> Index: include/grub/multiboot.h
> ===================================================================
> --- include/grub/multiboot.h  (revision 1802)
> +++ include/grub/multiboot.h  (working copy)
> @@ -1,7 +1,7 @@
>  /* multiboot.h - multiboot header file with grub definitions. */
>  /*
>   *  GRUB  --  GRand Unified Bootloader
> - *  Copyright (C) 2003,2007  Free Software Foundation, Inc.
> + *  Copyright (C) 2003,2007,2008  Free Software Foundation, Inc.
>   *
>   *  GRUB is free software: you can redistribute it and/or modify
>   *  it under the terms of the GNU General Public License as published by
> @@ -101,6 +101,16 @@
>    grub_uint16_t vbe_interface_len;
>  };
>  
> +struct grub_mmap_entry
> +{
> +  grub_uint32_t size;
> +  grub_uint64_t addr;
> +  grub_uint64_t len;
> +#define GRUB_MMAP_MEMORY_AVAILABLE   1
> +#define GRUB_MMAP_MEMORY_RESERVED    2
> +  grub_uint32_t type;
> +} __attribute__((packed));
> +
>  struct grub_mod_list
>  {
>    /* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
> Index: loader/i386/pc/multiboot.c
> ===================================================================
> --- loader/i386/pc/multiboot.c        (revision 1802)
> +++ loader/i386/pc/multiboot.c        (working copy)
> @@ -78,14 +78,60 @@
>        grub_free ((void *) mbi->cmdline);
>        grub_free (mbi);
>      }
> -
> -
> +  

Hm? :-)

--
Marco





reply via email to

[Prev in Thread] Current Thread [Next in Thread]