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;
x86_64_efi = util/i386/efi/grub-install.in;
ia64_efi = util/grub-install.in;
i386_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/efi/api.h>
#include <grub/efi/efi.h>
#include <grub/command.h>
#define ADD_MEMORY_DESCRIPTOR(desc, size) \
((grub_efi_memory_descriptor_t *) ((char *) (desc) + (size)))
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_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 (" %016llx-%016llx %08lx",
desc->physical_start,
desc->physical_start + (desc->num_pages << 12) - 1,
desc->num_pages);
(unsigned long long) desc->physical_start,
(unsigned long long) desc->physical_start + (desc->num_pages << 12) - 1,
(unsigned long) desc->num_pages);
size = desc->num_pages << (12 - 10);
if (size < 1024)
grub_printf (" %4uKB", size);
grub_printf (" %4uKB", (unsigned) size);
else
{
size /= 1024;
if (size < 1024)
grub_printf (" %4uMB", size);
grub_printf (" %4uMB", (unsigned) size);
else
{
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;
}
static grub_command_t cmd;
GRUB_MOD_INIT(memmap)
{
(void)mod; /* To stop warning. */
grub_register_extcmd ("memmap", grub_cmd_memmap, GRUB_COMMAND_FLAG_BOTH,
"memmap",
"Display memory map.", NULL);
cmd = grub_register_command ("memmap", grub_cmd_memmap,
"", "Display memory map.");
}
GRUB_MOD_FINI(memmap)
{
grub_unregister_extcmd ("memmap");
grub_unregister_command (cmd);
}

View file

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

View file

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