Fix some compilation problems

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-09-01 09:44:32 +02:00
parent c84a9b54ad
commit 07329a9ac9
6 changed files with 34 additions and 17 deletions

View file

@ -365,6 +365,7 @@ script = {
i386_efi = util/i386/efi/grub-install.in; i386_efi = util/i386/efi/grub-install.in;
x86_64_efi = util/i386/efi/grub-install.in; x86_64_efi = util/i386/efi/grub-install.in;
ia64_efi = util/grub-install.in;
i386_ieee1275 = util/ieee1275/grub-install.in; i386_ieee1275 = util/ieee1275/grub-install.in;
powerpc_ieee1275 = util/ieee1275/grub-install.in; powerpc_ieee1275 = util/ieee1275/grub-install.in;

View file

@ -22,12 +22,15 @@
#include <grub/normal.h> #include <grub/normal.h>
#include <grub/efi/api.h> #include <grub/efi/api.h>
#include <grub/efi/efi.h> #include <grub/efi/efi.h>
#include <grub/command.h>
#define ADD_MEMORY_DESCRIPTOR(desc, size) \ #define ADD_MEMORY_DESCRIPTOR(desc, size) \
((grub_efi_memory_descriptor_t *) ((char *) (desc) + (size))) ((grub_efi_memory_descriptor_t *) ((char *) (desc) + (size)))
static grub_err_t static grub_err_t
grub_cmd_memmap (struct grub_arg_list *state, int argc, char **args) grub_cmd_memmap (grub_command_t cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)),
char **args __attribute__ ((unused)))
{ {
grub_efi_uintn_t map_size; grub_efi_uintn_t map_size;
grub_efi_memory_descriptor_t *memory_map; grub_efi_memory_descriptor_t *memory_map;
@ -80,22 +83,22 @@ grub_cmd_memmap (struct grub_arg_list *state, int argc, char **args)
grub_printf ("Unk %02x ", desc->type); grub_printf ("Unk %02x ", desc->type);
grub_printf (" %016llx-%016llx %08lx", grub_printf (" %016llx-%016llx %08lx",
desc->physical_start, (unsigned long long) desc->physical_start,
desc->physical_start + (desc->num_pages << 12) - 1, (unsigned long long) desc->physical_start + (desc->num_pages << 12) - 1,
desc->num_pages); (unsigned long) desc->num_pages);
size = desc->num_pages << (12 - 10); size = desc->num_pages << (12 - 10);
if (size < 1024) if (size < 1024)
grub_printf (" %4uKB", size); grub_printf (" %4uKB", (unsigned) size);
else else
{ {
size /= 1024; size /= 1024;
if (size < 1024) if (size < 1024)
grub_printf (" %4uMB", size); grub_printf (" %4uMB", (unsigned) size);
else else
{ {
size /= 1024; size /= 1024;
grub_printf (" %4uGB", size); grub_printf (" %4uGB", (unsigned) size);
} }
} }
@ -129,15 +132,15 @@ grub_cmd_memmap (struct grub_arg_list *state, int argc, char **args)
return 0; return 0;
} }
static grub_command_t cmd;
GRUB_MOD_INIT(memmap) GRUB_MOD_INIT(memmap)
{ {
(void)mod; /* To stop warning. */ cmd = grub_register_command ("memmap", grub_cmd_memmap,
grub_register_extcmd ("memmap", grub_cmd_memmap, GRUB_COMMAND_FLAG_BOTH, "", "Display memory map.");
"memmap",
"Display memory map.", NULL);
} }
GRUB_MOD_FINI(memmap) GRUB_MOD_FINI(memmap)
{ {
grub_unregister_extcmd ("memmap"); grub_unregister_command (cmd);
} }

View file

@ -37,6 +37,10 @@
#define GRUB_MODULES_MACHINE_READONLY #define GRUB_MODULES_MACHINE_READONLY
#endif #endif
#ifdef __ia64__
#include <grub/machine/misc.h>
#endif
grub_dl_t grub_dl_head = 0; grub_dl_t grub_dl_head = 0;
@ -545,6 +549,7 @@ grub_dl_load_core (void *addr, grub_size_t size)
return mod; return mod;
} }
#ifdef __ia64__
void void
grub_init_module (const char *name, grub_init_module (const char *name,
void (*init)(grub_dl_t), void (*fini)(void)) void (*init)(grub_dl_t), void (*fini)(void))
@ -555,7 +560,7 @@ grub_init_module (const char *name,
if (! mod) if (! mod)
return; return;
mod->name = name; mod->name = (char *) name;
mod->ref_count = 1; mod->ref_count = 1;
mod->dep = 0; mod->dep = 0;
mod->segment = 0; mod->segment = 0;
@ -567,6 +572,7 @@ grub_init_module (const char *name,
/* Can't fail. */ /* Can't fail. */
grub_dl_add (mod); grub_dl_add (mod);
} }
#endif
/* Load a module from the file FILENAME. */ /* Load a module from the file FILENAME. */
grub_dl_t grub_dl_t
@ -686,6 +692,7 @@ grub_dl_unload (grub_dl_t mod)
return 1; return 1;
} }
#ifdef __ia64__
/* Unload unneeded modules. */ /* Unload unneeded modules. */
void void
grub_dl_unload_unneeded (void) grub_dl_unload_unneeded (void)
@ -705,3 +712,4 @@ grub_dl_unload_unneeded (void)
p = p->next; p = p->next;
} }
} }
#endif

View file

@ -34,9 +34,9 @@
#ifndef GRUB_MOD_INIT #ifndef GRUB_MOD_INIT
#define GRUB_MOD_INIT(name) \ #define GRUB_MOD_INIT(name) \
static void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ ((used)); \ static void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ ((used)); \
void grub_module_##name##_init (grub_dl_t); \ void grub_##name##_init (grub_dl_t); \
void \ void \
grub_module_##name##_init (grub_dl_t mod) { grub_mod_init (mod); } \ grub_##name##_init (grub_dl_t mod) { grub_mod_init (mod); } \
static void \ static void \
grub_mod_init (grub_dl_t mod __attribute__ ((unused))) grub_mod_init (grub_dl_t mod __attribute__ ((unused)))
#endif #endif
@ -44,9 +44,9 @@ grub_mod_init (grub_dl_t mod __attribute__ ((unused)))
#ifndef GRUB_MOD_FINI #ifndef GRUB_MOD_FINI
#define GRUB_MOD_FINI(name) \ #define GRUB_MOD_FINI(name) \
static void grub_mod_fini (void) __attribute__ ((used)); \ static void grub_mod_fini (void) __attribute__ ((used)); \
void grub_module_##name##_fini (void); \ void grub_##name##_fini (void); \
void \ void \
grub_module_##name##_fini (void) { grub_mod_fini (); } \ grub_##name##_fini (void) { grub_mod_fini (); } \
static void \ static void \
grub_mod_fini (void) grub_mod_fini (void)
#endif #endif

View file

@ -0,0 +1 @@
#include <grub/efi/memory.h>

View file

@ -19,5 +19,9 @@
void EXPORT_FUNC (__ia64_trampoline) (void); void EXPORT_FUNC (__ia64_trampoline) (void);
void EXPORT_FUNC (grub_init_modules) (void); void EXPORT_FUNC (grub_init_modules) (void);
void
grub_init_module (const char *name,
void (*init)(grub_dl_t), void (*fini)(void));
extern unsigned long EXPORT_VAR (__gp); extern unsigned long EXPORT_VAR (__gp);