diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/Makefile.in grub-1.94/Makefile.in *** grub-1.94.orig/Makefile.in Mon May 29 01:01:43 2006 --- grub-1.94/Makefile.in Fri Aug 25 13:45:38 2006 *************** *** 76,82 **** ### General variables. RMKFILES = $(addprefix conf/,common.rmk i386-pc.rmk powerpc-ieee1275.rmk \ ! sparc64-ieee1275.rmk i386-efi.rmk) MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES)) DATA = $(pkgdata_IMAGES) $(pkgdata_MODULES) $(pkgdata_PROGRAMS) \ --- 76,82 ---- ### General variables. RMKFILES = $(addprefix conf/,common.rmk i386-pc.rmk powerpc-ieee1275.rmk \ ! sparc64-ieee1275.rmk i386-efi.rmk ia64-efi.rmk) MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES)) DATA = $(pkgdata_IMAGES) $(pkgdata_MODULES) $(pkgdata_PROGRAMS) \ diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/commands/blocklist.c grub-1.94/commands/blocklist.c *** grub-1.94.orig/commands/blocklist.c Sat May 27 23:09:25 2006 --- grub-1.94/commands/blocklist.c Thu Aug 31 09:00:31 2006 *************** *** 99,105 **** } ! GRUB_MOD_INIT(blocklist) { (void) mod; /* To stop warning. */ grub_register_command ("blocklist", grub_cmd_blocklist, --- 99,106 ---- } ! static void ! grub_blocklist_init (grub_dl_t mod) { (void) mod; /* To stop warning. */ grub_register_command ("blocklist", grub_cmd_blocklist, *************** *** 108,114 **** "Print a block list.", 0); } ! GRUB_MOD_FINI(blocklist) { grub_unregister_command ("blocklist"); } --- 109,118 ---- "Print a block list.", 0); } ! static void ! grub_blocklist_fini (void) { grub_unregister_command ("blocklist"); } + + GRUB_MODULE(blocklist, grub_blocklist_init, grub_blocklist_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/commands/boot.c grub-1.94/commands/boot.c *** grub-1.94.orig/commands/boot.c Sun Nov 13 16:47:08 2005 --- grub-1.94/commands/boot.c Thu Aug 31 09:00:10 2006 *************** *** 38,51 **** ! GRUB_MOD_INIT(boot) { (void) mod; /* To stop warning. */ grub_register_command ("boot", grub_cmd_boot, GRUB_COMMAND_FLAG_BOTH, "boot", "Boot an operating system.", 0); } ! GRUB_MOD_FINI(boot) { grub_unregister_command ("boot"); } --- 38,55 ---- ! static void ! grub_boot_init (grub_dl_t mod) { (void) mod; /* To stop warning. */ grub_register_command ("boot", grub_cmd_boot, GRUB_COMMAND_FLAG_BOTH, "boot", "Boot an operating system.", 0); } ! static void ! grub_boot_fini (void) { grub_unregister_command ("boot"); } + + GRUB_MODULE(boot, grub_boot_init, grub_boot_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/commands/cat.c grub-1.94/commands/cat.c *** grub-1.94.orig/commands/cat.c Sun Nov 13 16:47:08 2005 --- grub-1.94/commands/cat.c Thu Aug 31 09:00:37 2006 *************** *** 70,83 **** } ! GRUB_MOD_INIT(cat) { (void) mod; /* To stop warning. */ grub_register_command ("cat", grub_cmd_cat, GRUB_COMMAND_FLAG_BOTH, "cat FILE", "Show the contents of a file.", 0); } ! GRUB_MOD_FINI(cat) { grub_unregister_command ("cat"); } --- 70,87 ---- } ! static void ! grub_cat_init (grub_dl_t mod) { (void) mod; /* To stop warning. */ grub_register_command ("cat", grub_cmd_cat, GRUB_COMMAND_FLAG_BOTH, "cat FILE", "Show the contents of a file.", 0); } ! static void ! grub_cat_fini (void) { grub_unregister_command ("cat"); } + + GRUB_MODULE(cat, grub_cat_init, grub_cat_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/commands/cmp.c grub-1.94/commands/cmp.c *** grub-1.94.orig/commands/cmp.c Sun Nov 13 16:47:08 2005 --- grub-1.94/commands/cmp.c Thu Aug 31 09:00:42 2006 *************** *** 102,115 **** } ! GRUB_MOD_INIT(cmp) { (void) mod; /* To stop warning. */ grub_register_command ("cmp", grub_cmd_cmp, GRUB_COMMAND_FLAG_BOTH, "cmp FILE1 FILE2", "Compare two files.", 0); } ! GRUB_MOD_FINI(cmp) { grub_unregister_command ("cmp"); } --- 102,119 ---- } ! static void ! grub_cmp_init (grub_dl_t mod) { (void) mod; /* To stop warning. */ grub_register_command ("cmp", grub_cmd_cmp, GRUB_COMMAND_FLAG_BOTH, "cmp FILE1 FILE2", "Compare two files.", 0); } ! static void ! grub_cmp_fini (void) { grub_unregister_command ("cmp"); } + + GRUB_MODULE(cmp, grub_cmp_init, grub_cmp_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/commands/configfile.c grub-1.94/commands/configfile.c *** grub-1.94.orig/commands/configfile.c Sun Apr 30 22:48:05 2006 --- grub-1.94/commands/configfile.c Thu Aug 31 09:00:49 2006 *************** *** 54,60 **** } ! GRUB_MOD_INIT(configfile) { (void) mod; /* To stop warning. */ grub_register_command ("configfile", grub_cmd_configfile, --- 54,61 ---- } ! static void ! grub_configfile_init (grub_dl_t mod) { (void) mod; /* To stop warning. */ grub_register_command ("configfile", grub_cmd_configfile, *************** *** 70,78 **** 0); } ! GRUB_MOD_FINI(configfile) { grub_unregister_command ("configfile"); grub_unregister_command ("source"); grub_unregister_command ("."); } --- 71,82 ---- 0); } ! static void ! grub_configfile_fini (void) { grub_unregister_command ("configfile"); grub_unregister_command ("source"); grub_unregister_command ("."); } + + GRUB_MODULE(configfile, grub_configfile_init, grub_configfile_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/commands/efi/memmap.c grub-1.94/commands/efi/memmap.c *** grub-1.94.orig/commands/efi/memmap.c Thu Jan 1 01:00:00 1970 --- grub-1.94/commands/efi/memmap.c Fri Sep 1 08:01:01 2006 *************** *** 0 **** --- 1,143 ---- + /* memmap.c - Display memory map. */ + /* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2003,2005 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + #include + #include + #include + #include + #include + #include + + #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_efi_uintn_t map_size; + grub_efi_memory_descriptor_t *memory_map; + grub_efi_memory_descriptor_t *memory_map_end; + grub_efi_memory_descriptor_t *desc; + grub_efi_uintn_t desc_size; + + if (grub_efi_get_memory_map (&map_size, NULL, NULL, &desc_size, 0) < 0) + return 0; + + memory_map = grub_malloc (map_size); + if (memory_map == NULL) + return 0; + + if (grub_efi_get_memory_map (&map_size, memory_map, NULL, &desc_size, 0) < 0) + goto fail; + + grub_printf + ("Type Physical start - end #Pages Attributes" + " Size\n"); + memory_map_end = ADD_MEMORY_DESCRIPTOR(memory_map, map_size); + for (desc = memory_map; + desc < memory_map_end; + desc = ADD_MEMORY_DESCRIPTOR (desc, desc_size)) + { + grub_efi_uintn_t size; + grub_efi_uint64_t attr; + static const char types_str[][9] = + { + "reserved", + "ldr-code", + "ldr-data", + "BS-code ", + "BS-data ", + "RT-code ", + "RT-data ", + "conv-mem", + "unusable", + "ACPI-rec", + "ACPI-nvs", + "MMIO ", + "IO-ports", + "PAL-code" + }; + if (desc->type < sizeof (types_str) / sizeof (types_str[0])) + grub_printf ("%s ", types_str[desc->type]); + else + 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); + attr = desc->attribute; + if (attr & GRUB_EFI_MEMORY_RUNTIME) + grub_printf (" RT"); + if (attr & GRUB_EFI_MEMORY_UC) + grub_printf (" UC"); + if (attr & GRUB_EFI_MEMORY_WC) + grub_printf (" WC"); + if (attr & GRUB_EFI_MEMORY_WT) + grub_printf (" WT"); + if (attr & GRUB_EFI_MEMORY_WB) + grub_printf (" WB"); + if (attr & GRUB_EFI_MEMORY_UCE) + grub_printf (" UCE"); + if (attr & GRUB_EFI_MEMORY_WP) + grub_printf (" WP"); + if (attr & GRUB_EFI_MEMORY_RP) + grub_printf (" RP"); + if (attr & GRUB_EFI_MEMORY_XP) + grub_printf (" XP"); + + size = desc->num_pages << (12 - 10); + if (size < 1024) + grub_printf (" %uKB", size); + else + { + size /= 1024; + if (size < 1024) + grub_printf (" %uMB", size); + else + { + size /= 1024; + grub_printf (" %uGB", size); + } + } + grub_printf ("\n"); + } + + fail: + grub_free (memory_map); + return 0; + } + + static void + grub_memmap_init (grub_dl_t mod) + { + (void)mod; /* To stop warning. */ + grub_register_command ("memmap", grub_cmd_memmap, GRUB_COMMAND_FLAG_BOTH, + "memmap", + "Display memory map.", NULL); + } + + static void + grub_memmap_fini (void) + { + grub_unregister_command ("memmap"); + } + + GRUB_MODULE(memmap, grub_memmap_init, grub_memmap_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/commands/help.c grub-1.94/commands/help.c *** grub-1.94.orig/commands/help.c Sun Nov 13 16:47:08 2005 --- grub-1.94/commands/help.c Thu Aug 31 09:00:55 2006 *************** *** 94,107 **** ! GRUB_MOD_INIT(help) { (void)mod; /* To stop warning. */ grub_register_command ("help", grub_cmd_help, GRUB_COMMAND_FLAG_CMDLINE, "help [PATTERN ...]", "Show a help message.", 0); } ! GRUB_MOD_FINI(help) { grub_unregister_command ("help"); } --- 94,111 ---- ! static void ! grub_help_init (grub_dl_t mod) { (void)mod; /* To stop warning. */ grub_register_command ("help", grub_cmd_help, GRUB_COMMAND_FLAG_CMDLINE, "help [PATTERN ...]", "Show a help message.", 0); } ! static void ! grub_help_fini (void) { grub_unregister_command ("help"); } + + GRUB_MODULE(help, grub_help_init, grub_help_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/commands/ls.c grub-1.94/commands/ls.c *** grub-1.94.orig/commands/ls.c Sun Nov 13 16:47:08 2005 --- grub-1.94/commands/ls.c Thu Aug 31 13:48:30 2006 *************** *** 157,163 **** grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument"); goto fail; } ! if (! *path) { if (grub_errno == GRUB_ERR_UNKNOWN_FS) --- 157,163 ---- grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument"); goto fail; } ! if (! *path) { if (grub_errno == GRUB_ERR_UNKNOWN_FS) *************** *** 228,234 **** return 0; } ! GRUB_MOD_INIT(ls) { (void)mod; /* To stop warning. */ grub_register_command ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH, --- 228,235 ---- return 0; } ! static void ! grub_ls_init (grub_dl_t mod) { (void)mod; /* To stop warning. */ grub_register_command ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH, *************** *** 236,242 **** "List devices and files.", options); } ! GRUB_MOD_FINI(ls) { grub_unregister_command ("ls"); } --- 237,246 ---- "List devices and files.", options); } ! static void ! grub_ls_fini (void) { grub_unregister_command ("ls"); } + + GRUB_MODULE(ls, grub_ls_init, grub_ls_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/commands/search.c grub-1.94/commands/search.c *** grub-1.94.orig/commands/search.c Sun Nov 13 16:47:08 2005 --- grub-1.94/commands/search.c Thu Aug 31 09:01:08 2006 *************** *** 148,154 **** return grub_errno; } ! GRUB_MOD_INIT(search) { (void) mod; /* To stop warning. */ grub_register_command ("search", grub_cmd_search, GRUB_COMMAND_FLAG_BOTH, --- 148,155 ---- return grub_errno; } ! static void ! grub_search_init (grub_dl_t mod) { (void) mod; /* To stop warning. */ grub_register_command ("search", grub_cmd_search, GRUB_COMMAND_FLAG_BOTH, *************** *** 160,166 **** options); } ! GRUB_MOD_FINI(search) { grub_unregister_command ("search"); } --- 161,170 ---- options); } ! static void ! grub_search_fini (void) { grub_unregister_command ("search"); } + + GRUB_MODULE(search, grub_search_init, grub_search_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/commands/terminal.c grub-1.94/commands/terminal.c *** grub-1.94.orig/commands/terminal.c Sun Nov 13 16:47:08 2005 --- grub-1.94/commands/terminal.c Thu Aug 31 09:00:19 2006 *************** *** 71,84 **** } ! GRUB_MOD_INIT(terminal) { (void)mod; /* To stop warning. */ grub_register_command ("terminal", grub_cmd_terminal, GRUB_COMMAND_FLAG_BOTH, "terminal [TERM...]", "Select a terminal.", 0); } ! GRUB_MOD_FINI(terminal) { grub_unregister_command ("terminal"); } --- 71,88 ---- } ! static void ! grub_terminal_init (grub_dl_t mod) { (void)mod; /* To stop warning. */ grub_register_command ("terminal", grub_cmd_terminal, GRUB_COMMAND_FLAG_BOTH, "terminal [TERM...]", "Select a terminal.", 0); } ! static void ! grub_terminal_fini (void) { grub_unregister_command ("terminal"); } + + GRUB_MODULE(terminal, grub_terminal_init, grub_terminal_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/commands/test.c grub-1.94/commands/test.c *** grub-1.94.orig/commands/test.c Sun Nov 13 16:47:08 2005 --- grub-1.94/commands/test.c Thu Aug 31 09:01:15 2006 *************** *** 55,61 **** ! GRUB_MOD_INIT(test) { (void)mod; /* To stop warning. */ grub_register_command ("[", grub_cmd_test, GRUB_COMMAND_FLAG_CMDLINE, --- 55,62 ---- ! static void ! grub_test_init (grub_dl_t mod) { (void)mod; /* To stop warning. */ grub_register_command ("[", grub_cmd_test, GRUB_COMMAND_FLAG_CMDLINE, *************** *** 64,71 **** "test EXPRESSION", "Evaluate an expression", 0); } ! GRUB_MOD_FINI(test) { grub_unregister_command ("["); grub_unregister_command ("test"); } --- 65,75 ---- "test EXPRESSION", "Evaluate an expression", 0); } ! static void ! grub_test_fini (void) { grub_unregister_command ("["); grub_unregister_command ("test"); } + + GRUB_MODULE(test, grub_test_init, grub_test_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/commands/videotest.c grub-1.94/commands/videotest.c *** grub-1.94.orig/commands/videotest.c Tue Mar 14 20:08:33 2006 --- grub-1.94/commands/videotest.c Thu Aug 31 09:01:28 2006 *************** *** 114,120 **** return grub_errno; } ! GRUB_MOD_INIT(videotest) { grub_register_command ("videotest", grub_cmd_videotest, --- 114,121 ---- return grub_errno; } ! static void ! grub_videotest_init (grub_dl_t mod) { grub_register_command ("videotest", grub_cmd_videotest, *************** *** 124,130 **** 0); } ! GRUB_MOD_FINI(videotest) { grub_unregister_command ("videotest"); } --- 125,134 ---- 0); } ! static void ! grub_videotest_fini (void) { grub_unregister_command ("videotest"); } + + GRUB_MODULE(videotest, grub_videotest_init, grub_videotest_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/conf/ia64-efi.rmk grub-1.94/conf/ia64-efi.rmk *** grub-1.94.orig/conf/ia64-efi.rmk Thu Jan 1 01:00:00 1970 --- grub-1.94/conf/ia64-efi.rmk Mon Sep 4 07:46:21 2006 *************** *** 0 **** --- 1,141 ---- + # -*- makefile -*- + + COMMON_ASFLAGS = -nostdinc -fno-builtin + COMMON_CFLAGS = -fno-builtin -fpic + COMMON_LDFLAGS = -melf_64 -nostdlib + + # Utilities. + #bin_UTILITIES = grub-mkimage + #sbin_UTILITIES = grub-emu + + # Scripts. + sbin_SCRIPTS = grub-install + + # For grub-install. + grub_install_SOURCES = util/ia64/efi/grub-install.in + + # For grub-mkimage. + #grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \ + # util/resolve.c + + # For grub-setup. + #grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \ + # util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \ + # kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \ + # fs/sfs.c kern/parser.c kern/partition.c partmap/pc.c \ + # fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \ + # kern/fs.c kern/env.c fs/fshelp.c + + # For grub-mkdevicemap. + #grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c + + # For grub-probefs. + #grub_probefs_SOURCES = util/i386/pc/grub-probefs.c \ + # util/i386/pc/biosdisk.c util/misc.c util/i386/pc/getroot.c \ + # kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c \ + # fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c \ + # fs/minix.c fs/hfs.c fs/jfs.c kern/fs.c kern/env.c fs/fshelp.c \ + # fs/xfs.c fs/affs.c fs/sfs.c fs/hfsplus.c + + # For grub-emu. + grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ + commands/configfile.c commands/help.c \ + commands/terminal.c commands/ls.c commands/test.c \ + commands/search.c commands/blocklist.c \ + disk/loopback.c \ + fs/affs.c fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c \ + fs/jfs.c fs/minix.c fs/sfs.c fs/ufs.c fs/xfs.c fs/hfsplus.c \ + io/gzio.c \ + kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c \ + normal/execute.c kern/file.c kern/fs.c normal/lexer.c \ + kern/loader.c kern/main.c kern/misc.c kern/parser.c \ + grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ + normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ + normal/completion.c normal/main.c \ + normal/menu.c normal/menu_entry.c normal/misc.c normal/script.c \ + partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \ + partmap/acorn.c partmap/gpt.c \ + util/console.c util/grub-emu.c util/misc.c \ + util/i386/pc/misc.c grub_emu_init.c + + grub_emu_LDFLAGS = $(LIBCURSES) + + # Scripts. + #sbin_SCRIPTS = grub-install + + # For grub-install. + #grub_install_SOURCES = util/efi/pc/grub-install.in + + # Modules. + pkgdata_MODULES = kernel.mod normal.mod _chain.mod chain.mod \ + _linux.mod linux.mod memmap.mod + + # For kernel.mod. + kernel_mod_EXPORTS = no + kernel_mod_SOURCES = kern/ia64/startup.S kern/ia64/reloc_ia64.S \ + kern/ia64/umodsi3.S kern/ia64/umoddi3.S \ + kern/ia64/udivdi3.S kern/ia64/divdi3.S \ + kern/ia64/divsi3.S kern/ia64/modsi3.S kern/ia64/udivsi3.S \ + kern/ia64/trampoline.S \ + kern/main.c kern/device.c \ + kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \ + kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \ + kern/i386/dl.c kern/ia64/efi/init.c kern/parser.c kern/partition.c \ + kern/env.c symlist.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c \ + term/efi/console.c disk/efi/efidisk.c + kernel_mod_HEADERS = arg.h boot.h device.h disk.h dl.h elf.h env.h err.h \ + file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h partition.h \ + pc_partition.h rescue.h symbol.h term.h types.h cache.h \ + i386/efi/time.h efi/efi.h efi/time.h efi/disk.h ia64/libgcc.h + kernel_mod_CFLAGS = $(COMMON_CFLAGS) + kernel_mod_ASFLAGS = $(COMMON_ASFLAGS) + kernel_mod_LDFLAGS = $(COMMON_LDFLAGS) + + MOSTLYCLEANFILES += symlist.c + MOSTLYCLEANFILES += symlist.c kernel_syms.lst + DEFSYMFILES += kernel_syms.lst + + symlist.c: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h gensymlist.sh + /bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1) + + kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h genkernsyms.sh + /bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1) + + # For normal.mod. + normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \ + normal/completion.c normal/execute.c \ + normal/function.c normal/lexer.c normal/main.c normal/menu.c \ + normal/menu_entry.c normal/misc.c grub_script.tab.c \ + normal/script.c \ + normal/ia64/setjmp.S normal/ia64/longjmp.S + + normal_mod_CFLAGS = $(COMMON_CFLAGS) + normal_mod_ASFLAGS = $(COMMON_ASFLAGS) + normal_mod_LDFLAGS = $(COMMON_LDFLAGS) + + # For _chain.mod. + _chain_mod_SOURCES = loader/efi/chainloader.c + _chain_mod_CFLAGS = $(COMMON_CFLAGS) + _chain_mod_LDFLAGS = $(COMMON_LDFLAGS) + + # For chain.mod. + chain_mod_SOURCES = loader/efi/chainloader_normal.c + chain_mod_CFLAGS = $(COMMON_CFLAGS) + chain_mod_LDFLAGS = $(COMMON_LDFLAGS) + + # For _linux.mod. + _linux_mod_SOURCES = loader/ia64/linux.c + _linux_mod_CFLAGS = $(COMMON_CFLAGS) + _linux_mod_LDFLAGS = $(COMMON_LDFLAGS) + + # For linux.mod. + linux_mod_SOURCES = loader/ia64/linux_normal.c + linux_mod_CFLAGS = $(COMMON_CFLAGS) + linux_mod_LDFLAGS = $(COMMON_LDFLAGS) + + # For memmap.mod. + memmap_mod_SOURCES = commands/efi/memmap.c + memmap_mod_CFLAGS = $(COMMON_CFLAGS) + memmap_mod_LDFLAGS = $(COMMON_LDFLAGS) + + include $(srcdir)/conf/common.mk diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/configure grub-1.94/configure *** grub-1.94.orig/configure Sun Jun 4 14:41:00 2006 --- grub-1.94/configure Thu Aug 31 14:05:51 2006 *************** *** 1440,1447 **** powerpc) ;; powerpc64) target_cpu=powerpc target_m32=1;; sparc64) ;; ! *) { { echo "$as_me:$LINENO: error: unsupported CPU type" >&5 ! echo "$as_me: error: unsupported CPU type" >&2;} { (exit 1); exit 1; }; } ;; esac --- 1440,1448 ---- powerpc) ;; powerpc64) target_cpu=powerpc target_m32=1;; sparc64) ;; ! ia64) ;; ! *) { { echo "$as_me:$LINENO: error: unsupported CPU type $target_cpu" >&5 ! echo "$as_me: error: unsupported CPU type $target_cpu" >&2;} { (exit 1); exit 1; }; } ;; esac *************** *** 1460,1465 **** --- 1461,1467 ---- i386-*) platform=pc ;; powerpc-*) platform=ieee1275 ;; sparc64-*) platform=ieee1275 ;; + ia64*) platform=efi ;; *) { { echo "$as_me:$LINENO: error: unsupported machine type" >&5 echo "$as_me: error: unsupported machine type" >&2;} { (exit 1); exit 1; }; } ;; *************** *** 1474,1479 **** --- 1476,1482 ---- i386-pc) ;; powerpc-ieee1275) ;; sparc64-ieee1275) ;; + ia64-efi) ;; *) { { echo "$as_me:$LINENO: error: unsupported machine type" >&5 echo "$as_me: error: unsupported machine type" >&2;} { (exit 1); exit 1; }; } ;; diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/configure.ac grub-1.94/configure.ac *** grub-1.94.orig/configure.ac Sun Jun 4 14:39:23 2006 --- grub-1.94/configure.ac Fri Aug 25 13:33:35 2006 *************** *** 50,56 **** powerpc) ;; powerpc64) target_cpu=powerpc target_m32=1;; sparc64) ;; ! *) AC_MSG_ERROR([unsupported CPU type]) ;; esac # Specify the platform (such as firmware). --- 50,57 ---- powerpc) ;; powerpc64) target_cpu=powerpc target_m32=1;; sparc64) ;; ! ia64) ;; ! *) AC_MSG_ERROR([unsupported CPU type $target_cpu]) ;; esac # Specify the platform (such as firmware). *************** *** 65,70 **** --- 66,72 ---- i386-*) platform=pc ;; powerpc-*) platform=ieee1275 ;; sparc64-*) platform=ieee1275 ;; + ia64*) platform=efi ;; *) AC_MSG_ERROR([unsupported machine type]) ;; esac else *************** *** 77,82 **** --- 79,85 ---- i386-pc) ;; powerpc-ieee1275) ;; sparc64-ieee1275) ;; + ia64-efi) ;; *) AC_MSG_ERROR([unsupported machine type]) ;; esac diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/disk/efi/efidisk.c grub-1.94/disk/efi/efidisk.c *** grub-1.94.orig/disk/efi/efidisk.c Sun Apr 30 23:09:37 2006 --- grub-1.94/disk/efi/efidisk.c Mon Sep 4 09:19:26 2006 *************** *** 146,151 **** --- 146,152 ---- /* Find handles which support the disk io interface. */ handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL, &disk_io_guid, 0, &num_handles); + if (! handles) return 0; *************** *** 305,311 **** name_devices (struct grub_efidisk_data *devices) { struct grub_efidisk_data *d; ! /* First, identify devices by media device paths. */ for (d = devices; d; d = d->next) { --- 306,312 ---- name_devices (struct grub_efidisk_data *devices) { struct grub_efidisk_data *d; ! /* First, identify devices by media device paths. */ for (d = devices; d; d = d->next) { *************** *** 427,433 **** devices = make_devices (); if (! devices) return; - name_devices (devices); free_devices (devices); } --- 428,433 ---- diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/disk/loopback.c grub-1.94/disk/loopback.c *** grub-1.94.orig/disk/loopback.c Sun Nov 13 16:47:09 2005 --- grub-1.94/disk/loopback.c Thu Aug 31 09:01:44 2006 *************** *** 241,247 **** ! GRUB_MOD_INIT(loop) { (void)mod; /* To stop warning. */ grub_register_command ("loopback", grub_cmd_loopback, GRUB_COMMAND_FLAG_BOTH, --- 241,248 ---- ! static void ! grub_loop_init (grub_dl_t mod) { (void)mod; /* To stop warning. */ grub_register_command ("loopback", grub_cmd_loopback, GRUB_COMMAND_FLAG_BOTH, *************** *** 250,258 **** grub_disk_dev_register (&grub_loopback_dev); } ! GRUB_MOD_FINI(loop) { grub_unregister_command ("loopback"); grub_disk_dev_unregister (&grub_loopback_dev); } --- 251,262 ---- grub_disk_dev_register (&grub_loopback_dev); } ! static void ! grub_loop_fini (void) { grub_unregister_command ("loopback"); grub_disk_dev_unregister (&grub_loopback_dev); } + + GRUB_MODULE(loop, grub_loop_init, grub_loop_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/font/manager.c grub-1.94/font/manager.c *** grub-1.94.orig/font/manager.c Fri Mar 31 15:32:52 2006 --- grub-1.94/font/manager.c Thu Aug 31 09:03:52 2006 *************** *** 249,262 **** return 0; } ! GRUB_MOD_INIT(font_manager) { grub_register_command ("font", font_command, GRUB_COMMAND_FLAG_BOTH, "font FILE...", "Specify one or more font files to display.", 0); } ! GRUB_MOD_FINI(font_manager) { grub_unregister_command ("font"); } --- 249,266 ---- return 0; } ! static void ! grub_font_manager_init (grub_dl_t mod) { grub_register_command ("font", font_command, GRUB_COMMAND_FLAG_BOTH, "font FILE...", "Specify one or more font files to display.", 0); } ! static void ! grub_font_manager_fini (void) { grub_unregister_command ("font"); } + + GRUB_MODULE(font_manager, grub_font_manager_init, grub_font_manager_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/fs/affs.c grub-1.94/fs/affs.c *** grub-1.94.orig/fs/affs.c Wed Apr 26 23:58:35 2006 --- grub-1.94/fs/affs.c Thu Aug 31 08:58:17 2006 *************** *** 553,559 **** .next = 0 }; ! GRUB_MOD_INIT(affs) { grub_fs_register (&grub_affs_fs); #ifndef GRUB_UTIL --- 553,560 ---- .next = 0 }; ! static void ! grub_affs_init (grub_dl_t mod) { grub_fs_register (&grub_affs_fs); #ifndef GRUB_UTIL *************** *** 561,568 **** #endif } ! GRUB_MOD_FINI(affs) { grub_fs_unregister (&grub_affs_fs); } --- 562,572 ---- #endif } ! static void ! grub_affs_fini (void) { grub_fs_unregister (&grub_affs_fs); } + + GRUB_MODULE(affs, grub_affs_init, grub_affs_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/fs/ext2.c grub-1.94/fs/ext2.c *** grub-1.94.orig/fs/ext2.c Sun Nov 13 16:47:09 2005 --- grub-1.94/fs/ext2.c Thu Aug 31 08:56:18 2006 *************** *** 170,178 **** struct grub_fshelp_node diropen; }; - #ifndef GRUB_UTIL static grub_dl_t my_mod; - #endif /* Read into BLKGRP the blockgroup descriptor of blockgroup GROUP of the mounted filesystem DATA. */ --- 170,176 ---- *************** *** 479,487 **** struct grub_ext2_data *data; struct grub_fshelp_node *fdiro = 0; - #ifndef GRUB_UTIL grub_dl_ref (my_mod); - #endif data = grub_ext2_mount (file->device->disk); if (!data) --- 477,483 ---- *************** *** 513,521 **** grub_free (fdiro); grub_free (data); - #ifndef GRUB_UTIL grub_dl_unref (my_mod); - #endif return grub_errno; } --- 509,515 ---- *************** *** 525,533 **** { grub_free (file->data); - #ifndef GRUB_UTIL grub_dl_unref (my_mod); - #endif return GRUB_ERR_NONE; } --- 519,525 ---- *************** *** 569,577 **** return 0; } - #ifndef GRUB_UTIL grub_dl_ref (my_mod); - #endif data = grub_ext2_mount (device->disk); if (!data) --- 561,567 ---- *************** *** 589,597 **** grub_free (fdiro); grub_free (data); - #ifndef GRUB_UTIL grub_dl_unref (my_mod); - #endif return grub_errno; } --- 579,585 ---- *************** *** 602,610 **** struct grub_ext2_data *data; grub_disk_t disk = device->disk; - #ifndef GRUB_UTIL grub_dl_ref (my_mod); - #endif data = grub_ext2_mount (disk); if (data) --- 590,596 ---- *************** *** 612,620 **** else *label = 0; - #ifndef GRUB_UTIL grub_dl_unref (my_mod); - #endif grub_free (data); --- 598,604 ---- *************** *** 633,647 **** .next = 0 }; ! GRUB_MOD_INIT(ext2) { grub_fs_register (&grub_ext2_fs); - #ifndef GRUB_UTIL my_mod = mod; - #endif } ! GRUB_MOD_FINI(ext2) { grub_fs_unregister (&grub_ext2_fs); } --- 617,633 ---- .next = 0 }; ! static void ! grub_ext2_init (grub_dl_t mod) { grub_fs_register (&grub_ext2_fs); my_mod = mod; } ! static void ! grub_ext2_fini (void) { grub_fs_unregister (&grub_ext2_fs); } + + GRUB_MODULE(ext2, grub_ext2_init, grub_ext2_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/fs/fat.c grub-1.94/fs/fat.c *** grub-1.94.orig/fs/fat.c Wed Apr 26 23:58:35 2006 --- grub-1.94/fs/fat.c Fri Sep 1 11:50:12 2006 *************** *** 125,133 **** grub_uint32_t cur_cluster; }; - #ifndef GRUB_UTIL static grub_dl_t my_mod; - #endif static int fat_log2 (unsigned x) --- 125,131 ---- *************** *** 322,328 **** /* This is a special case. FAT12 and FAT16 doesn't have the root directory in clusters. */ ! if (data->file_cluster == ~0UL) { size = (data->num_root_sectors << GRUB_DISK_SECTOR_BITS) - offset; if (size > len) --- 320,326 ---- /* This is a special case. FAT12 and FAT16 doesn't have the root directory in clusters. */ ! if (data->file_cluster == (grub_uint32_t)~0UL) { size = (data->num_root_sectors << GRUB_DISK_SECTOR_BITS) - offset; if (size > len) *************** *** 449,455 **** int checksum = -1; grub_ssize_t offset = -sizeof(dir); int call_hook; ! if (! (data->attr & GRUB_FAT_ATTR_DIRECTORY)) { grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory"); --- 447,453 ---- int checksum = -1; grub_ssize_t offset = -sizeof(dir); int call_hook; ! if (! (data->attr & GRUB_FAT_ATTR_DIRECTORY)) { grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory"); *************** *** 488,494 **** grub_free (dirname); return 0; } ! while (1) { unsigned i; --- 486,492 ---- grub_free (dirname); return 0; } ! while (1) { unsigned i; *************** *** 542,548 **** /* This is a workaround for Japanese. */ if (dir.name[0] == 0x05) dir.name[0] = 0xe5; ! if (checksum != -1 && slot == 0) { grub_uint8_t sum; --- 540,546 ---- /* This is a workaround for Japanese. */ if (dir.name[0] == 0x05) dir.name[0] = 0xe5; ! if (checksum != -1 && slot == 0) { grub_uint8_t sum; *************** *** 569,575 **** continue; } ! if (grub_strcmp (dirname, filename) == 0) { if (call_hook) hook (filename, dir.attr & GRUB_FAT_ATTR_DIRECTORY); --- 567,573 ---- continue; } ! if (grub_strcasecmp (dirname, filename) == 0) { if (call_hook) hook (filename, dir.attr & GRUB_FAT_ATTR_DIRECTORY); *************** *** 602,608 **** if (hook (filename, dir.attr & GRUB_FAT_ATTR_DIRECTORY)) break; } ! else if (grub_strcmp (dirname, filename) == 0) { if (call_hook) hook (filename, dir.attr & GRUB_FAT_ATTR_DIRECTORY); --- 600,606 ---- if (hook (filename, dir.attr & GRUB_FAT_ATTR_DIRECTORY)) break; } ! else if (grub_strcasecmp (dirname, filename) == 0) { if (call_hook) hook (filename, dir.attr & GRUB_FAT_ATTR_DIRECTORY); *************** *** 633,641 **** char *dirname = 0; char *p; - #ifndef GRUB_UTIL grub_dl_ref (my_mod); - #endif data = grub_fat_mount (disk); if (! data) --- 631,637 ---- *************** *** 664,672 **** grub_free (dirname); grub_free (data); - #ifndef GRUB_UTIL grub_dl_unref (my_mod); - #endif return grub_errno; } --- 660,666 ---- *************** *** 677,685 **** struct grub_fat_data *data = 0; char *p = (char *) name; - #ifndef GRUB_UTIL grub_dl_ref (my_mod); - #endif data = grub_fat_mount (file->device->disk); if (! data) --- 671,677 ---- *************** *** 708,716 **** grub_free (data); - #ifndef GRUB_UTIL grub_dl_unref (my_mod); - #endif return grub_errno; } --- 700,706 ---- *************** *** 727,735 **** { grub_free (file->data); - #ifndef GRUB_UTIL grub_dl_unref (my_mod); - #endif return grub_errno; } --- 717,723 ---- *************** *** 742,750 **** grub_ssize_t offset = -sizeof(struct grub_fat_dir_entry); - #ifndef GRUB_UTIL grub_dl_ref (my_mod); - #endif data = grub_fat_mount (disk); if (! data) --- 730,736 ---- *************** *** 789,797 **** fail: - #ifndef GRUB_UTIL grub_dl_unref (my_mod); - #endif grub_free (data); --- 775,781 ---- *************** *** 809,824 **** .next = 0 }; ! GRUB_MOD_INIT(fat) { grub_fs_register (&grub_fat_fs); - #ifndef GRUB_UTIL my_mod = mod; - #endif } ! GRUB_MOD_FINI(fat) { grub_fs_unregister (&grub_fat_fs); } --- 793,809 ---- .next = 0 }; ! static void ! grub_fat_init (grub_dl_t mod) { grub_fs_register (&grub_fat_fs); my_mod = mod; } ! static void ! grub_fat_fini (void) { grub_fs_unregister (&grub_fat_fs); } + GRUB_MODULE(fat,grub_fat_init,grub_fat_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/fs/hfs.c grub-1.94/fs/hfs.c *** grub-1.94.orig/fs/hfs.c Wed Apr 26 23:58:35 2006 --- grub-1.94/fs/hfs.c Thu Aug 31 08:57:16 2006 *************** *** 150,158 **** int datalen; }; - #ifndef GRUB_UTIL static grub_dl_t my_mod; - #endif static int grub_hfs_find_node (struct grub_hfs_data *, char *, grub_uint32_t, int, char *, int); --- 150,156 ---- *************** *** 729,737 **** struct grub_hfs_data *data; struct grub_hfs_filerec frec; - #ifndef GRUB_UTIL grub_dl_ref (my_mod); - #endif data = grub_hfs_mount (device->disk); if (!data) --- 727,733 ---- *************** *** 752,760 **** fail: grub_free (data); - #ifndef GRUB_UTIL grub_dl_unref (my_mod); - #endif return grub_errno; } --- 748,754 ---- *************** *** 767,784 **** struct grub_hfs_data *data; struct grub_hfs_filerec frec; - #ifndef GRUB_UTIL grub_dl_ref (my_mod); - #endif data = grub_hfs_mount (file->device->disk); if (grub_hfs_find_dir (data, name, &frec, 0)) { grub_free (data); ! #ifndef GRUB_UTIL ! grub_dl_unref (my_mod); ! #endif return grub_errno; } --- 761,774 ---- struct grub_hfs_data *data; struct grub_hfs_filerec frec; grub_dl_ref (my_mod); data = grub_hfs_mount (file->device->disk); if (grub_hfs_find_dir (data, name, &frec, 0)) { grub_free (data); ! grub_dl_unref (my_mod); return grub_errno; } *************** *** 786,794 **** { grub_free (data); grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a file"); - #ifndef GRUB_UTIL grub_dl_unref (my_mod); - #endif return grub_errno; } --- 776,782 ---- *************** *** 818,826 **** { grub_free (file->data); - #ifndef GRUB_UTIL grub_dl_unref (my_mod); - #endif return 0; } --- 806,812 ---- *************** *** 856,870 **** .next = 0 }; ! GRUB_MOD_INIT(hfs) { grub_fs_register (&grub_hfs_fs); - #ifndef GRUB_UTIL my_mod = mod; - #endif } ! GRUB_MOD_FINI(hfs) { grub_fs_unregister (&grub_hfs_fs); } --- 842,858 ---- .next = 0 }; ! static void ! grub_hfs_init (grub_dl_t mod) { grub_fs_register (&grub_hfs_fs); my_mod = mod; } ! static void ! grub_hfs_fini (void) { grub_fs_unregister (&grub_hfs_fs); } + + GRUB_MODULE(hfs, grub_hfs_init, grub_hfs_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/fs/hfsplus.c grub-1.94/fs/hfsplus.c *** grub-1.94.orig/fs/hfsplus.c Sun May 28 05:20:17 2006 --- grub-1.94/fs/hfsplus.c Thu Aug 31 08:58:34 2006 *************** *** 955,961 **** .next = 0 }; ! GRUB_MOD_INIT(hfsplus) { grub_fs_register (&grub_hfsplus_fs); #ifndef GRUB_UTIL --- 955,962 ---- .next = 0 }; ! static void ! grub_hfsplus_init (grub_dl_t mod) { grub_fs_register (&grub_hfsplus_fs); #ifndef GRUB_UTIL *************** *** 963,969 **** #endif } ! GRUB_MOD_FINI(hfsplus) { grub_fs_unregister (&grub_hfsplus_fs); } --- 964,973 ---- #endif } ! static void ! grub_hfsplus_fini (void) { grub_fs_unregister (&grub_hfsplus_fs); } + + GRUB_MODULE(hfsplus, grub_hfsplus_init, grub_hfsplus_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/fs/iso9660.c grub-1.94/fs/iso9660.c *** grub-1.94.orig/fs/iso9660.c Sun Nov 13 16:47:09 2005 --- grub-1.94/fs/iso9660.c Thu Aug 31 08:57:59 2006 *************** *** 764,770 **** .next = 0 }; ! GRUB_MOD_INIT(iso9660) { grub_fs_register (&grub_iso9660_fs); #ifndef GRUB_UTIL --- 764,771 ---- .next = 0 }; ! static void ! grub_iso9660_init (grub_dl_t mod) { grub_fs_register (&grub_iso9660_fs); #ifndef GRUB_UTIL *************** *** 772,778 **** #endif } ! GRUB_MOD_FINI(iso9660) { grub_fs_unregister (&grub_iso9660_fs); } --- 773,782 ---- #endif } ! static void ! grub_iso9660_fini (void) { grub_fs_unregister (&grub_iso9660_fs); } + + GRUB_MODULE(iso9660, grub_iso9660_init, grub_iso9660_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/fs/jfs.c grub-1.94/fs/jfs.c *** grub-1.94.orig/fs/jfs.c Wed Apr 26 23:58:35 2006 --- grub-1.94/fs/jfs.c Thu Aug 31 08:57:51 2006 *************** *** 230,238 **** } __attribute__ ((packed)); - #ifndef GRUB_UTIL static grub_dl_t my_mod; - #endif static grub_err_t grub_jfs_lookup_symlink (struct grub_jfs_data *data, int ino); --- 230,236 ---- *************** *** 732,740 **** struct grub_jfs_data *data = 0; struct grub_jfs_diropen *diro = 0; - #ifndef GRUB_UTIL grub_dl_ref (my_mod); - #endif data = grub_jfs_mount (device->disk); if (!data) --- 730,736 ---- *************** *** 770,778 **** grub_jfs_closedir (diro); grub_free (data); - #ifndef GRUB_UTIL grub_dl_unref (my_mod); - #endif return grub_errno; } --- 766,772 ---- *************** *** 784,792 **** { struct grub_jfs_data *data; - #ifndef GRUB_UTIL grub_dl_ref (my_mod); - #endif data = grub_jfs_mount (file->device->disk); if (!data) --- 778,784 ---- *************** *** 811,819 **** fail: - #ifndef GRUB_UTIL grub_dl_unref (my_mod); - #endif grub_free (data); --- 803,809 ---- *************** *** 836,844 **** { grub_free (file->data); - #ifndef GRUB_UTIL grub_dl_unref (my_mod); - #endif return GRUB_ERR_NONE; } --- 826,832 ---- *************** *** 870,884 **** .next = 0 }; ! GRUB_MOD_INIT(jfs) { grub_fs_register (&grub_jfs_fs); - #ifndef GRUB_UTIL my_mod = mod; - #endif } ! GRUB_MOD_FINI(jfs) { grub_fs_unregister (&grub_jfs_fs); } --- 858,874 ---- .next = 0 }; ! static void ! grub_jfs_init (grub_dl_t mod) { grub_fs_register (&grub_jfs_fs); my_mod = mod; } ! static void ! grub_jfs_fini (void) { grub_fs_unregister (&grub_jfs_fs); } + + GRUB_MODULE(jfs, grub_jfs_init, grub_jfs_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/fs/minix.c grub-1.94/fs/minix.c *** grub-1.94.orig/fs/minix.c Sun Nov 13 16:47:09 2005 --- grub-1.94/fs/minix.c Thu Aug 31 08:56:39 2006 *************** *** 113,121 **** int filename_size; }; - #ifndef GRUB_UTIL static grub_dl_t my_mod; - #endif static grub_err_t grub_minix_find_file (struct grub_minix_data *data, const char *path); --- 113,119 ---- *************** *** 597,611 **** .next = 0 }; ! GRUB_MOD_INIT(minix) { grub_fs_register (&grub_minix_fs); - #ifndef GRUB_UTIL my_mod = mod; - #endif } ! GRUB_MOD_FINI(minix) { grub_fs_unregister (&grub_minix_fs); } --- 595,611 ---- .next = 0 }; ! static void ! grub_minix_init (grub_dl_t mod) { grub_fs_register (&grub_minix_fs); my_mod = mod; } ! static void ! grub_minix_fini (void) { grub_fs_unregister (&grub_minix_fs); } + + GRUB_MODULE(minix, grub_minix_init, grub_minix_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/fs/sfs.c grub-1.94/fs/sfs.c *** grub-1.94.orig/fs/sfs.c Wed Apr 26 23:58:35 2006 --- grub-1.94/fs/sfs.c Thu Aug 31 08:58:25 2006 *************** *** 605,611 **** .next = 0 }; ! GRUB_MOD_INIT(sfs) { grub_fs_register (&grub_sfs_fs); #ifndef GRUB_UTIL --- 605,612 ---- .next = 0 }; ! static void ! grub_sfs_init (grub_dl_t mod) { grub_fs_register (&grub_sfs_fs); #ifndef GRUB_UTIL *************** *** 613,619 **** #endif } ! GRUB_MOD_FINI(sfs) { grub_fs_unregister (&grub_sfs_fs); } --- 614,623 ---- #endif } ! static void ! grub_sfs_fini (void) { grub_fs_unregister (&grub_sfs_fs); } + + GRUB_MODULE(sfs, grub_sfs_init, grub_sfs_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/fs/ufs.c grub-1.94/fs/ufs.c *** grub-1.94.orig/fs/ufs.c Wed Apr 26 23:58:35 2006 --- grub-1.94/fs/ufs.c Thu Aug 31 08:55:42 2006 *************** *** 185,193 **** int linknest; }; - #ifndef GRUB_UTIL static grub_dl_t my_mod; ! #endif /* Forward declaration. */ static grub_err_t grub_ufs_find_file (struct grub_ufs_data *data, --- 185,192 ---- int linknest; }; static grub_dl_t my_mod; ! /* Forward declaration. */ static grub_err_t grub_ufs_find_file (struct grub_ufs_data *data, *************** *** 668,683 **** .next = 0 }; ! GRUB_MOD_INIT(ufs) { grub_fs_register (&grub_ufs_fs); - #ifndef GRUB_UTIL my_mod = mod; - #endif } ! GRUB_MOD_FINI(ufs) { grub_fs_unregister (&grub_ufs_fs); } --- 667,684 ---- .next = 0 }; ! static void ! grub_ufs_init (grub_dl_t mod) { grub_fs_register (&grub_ufs_fs); my_mod = mod; } ! static void ! grub_ufs_fini (void) { grub_fs_unregister (&grub_ufs_fs); } + + GRUB_MODULE(ufs, grub_ufs_init, grub_ufs_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/fs/xfs.c grub-1.94/fs/xfs.c *** grub-1.94.orig/fs/xfs.c Wed Apr 26 23:58:35 2006 --- grub-1.94/fs/xfs.c Thu Aug 31 08:58:08 2006 *************** *** 689,695 **** .next = 0 }; ! GRUB_MOD_INIT(xfs) { grub_fs_register (&grub_xfs_fs); #ifndef GRUB_UTIL --- 689,696 ---- .next = 0 }; ! static void ! grub_xfs_init (grub_dl_t mod) { grub_fs_register (&grub_xfs_fs); #ifndef GRUB_UTIL *************** *** 697,704 **** #endif } ! GRUB_MOD_FINI(xfs) { grub_fs_unregister (&grub_xfs_fs); } --- 698,708 ---- #endif } ! static void ! grub_xfs_fini (void) { grub_fs_unregister (&grub_xfs_fs); } + + GRUB_MODULE(xfs, grub_xfs_init, grub_xfs_fini); Binary files grub-1.94.orig/grub.efi and grub-1.94/grub.efi differ Binary files grub-1.94.orig/grub.so and grub-1.94/grub.so differ diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/hello/hello.c grub-1.94/hello/hello.c *** grub-1.94.orig/hello/hello.c Sun Nov 13 16:47:09 2005 --- grub-1.94/hello/hello.c Thu Aug 31 08:59:58 2006 *************** *** 35,48 **** return 0; } ! GRUB_MOD_INIT(hello) { (void)mod; /* To stop warning. */ grub_register_command ("hello", grub_cmd_hello, GRUB_COMMAND_FLAG_BOTH, "hello", "Say hello", 0); } ! GRUB_MOD_FINI(hello) { grub_unregister_command ("hello"); } --- 35,52 ---- return 0; } ! static void ! grub_hello_init (grub_dl_t mod) { (void)mod; /* To stop warning. */ grub_register_command ("hello", grub_cmd_hello, GRUB_COMMAND_FLAG_BOTH, "hello", "Say hello", 0); } ! static void ! grub_hello_fini (void) { grub_unregister_command ("hello"); } + + GRUB_MODULE(hello, grub_hello_init, grub_hello_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/include/grub/dl.h grub-1.94/include/grub/dl.h *** grub-1.94.orig/include/grub/dl.h Sun Nov 27 13:21:12 2005 --- grub-1.94/include/grub/dl.h Thu Aug 31 11:22:39 2006 *************** *** 25,51 **** #include #include - #define GRUB_MOD_INIT(name) \ - static void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ ((used)); \ - void grub_##name##_init (void); \ - void \ - grub_##name##_init (void) { grub_mod_init (0); } \ - static void \ - grub_mod_init (grub_dl_t mod __attribute__ ((unused))) - - #define GRUB_MOD_FINI(name) \ - static void grub_mod_fini (void) __attribute__ ((used)); \ - void grub_##name##_fini (void); \ - void \ - grub_##name##_fini (void) { grub_mod_fini (); } \ - static void \ - grub_mod_fini (void) - #define GRUB_MOD_NAME(name) \ ! __asm__ (".section .modname,\"S\"\n.string \"" #name "\"\n.previous") #define GRUB_MOD_DEP(name) \ ! __asm__ (".section .moddeps,\"S\"\n.string \"" #name "\"\n.previous") struct grub_dl_segment { --- 25,37 ---- #include #include #define GRUB_MOD_NAME(name) \ ! static const char grub_module_name_##name[] \ ! __attribute__((section(".modname"), __used__)) = #name #define GRUB_MOD_DEP(name) \ ! static const char grub_module_depend_##name[] \ ! __attribute__((section(".moddeps"), __used__)) = #name struct grub_dl_segment { *************** *** 76,81 **** --- 62,71 ---- }; typedef struct grub_dl *grub_dl_t; + #define GRUB_MODULE(name,init,fini) \ + struct grub_dl grub_##name##_module = \ + { #name, 0, 0, 0, init, fini } + grub_err_t EXPORT_FUNC(grub_dl_check_header) (void *ehdr, grub_size_t size); grub_dl_t EXPORT_FUNC(grub_dl_load_file) (const char *filename); grub_dl_t EXPORT_FUNC(grub_dl_load) (const char *name); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/include/grub/efi/api.h grub-1.94/include/grub/efi/api.h *** grub-1.94.orig/include/grub/efi/api.h Sat May 27 23:09:25 2006 --- grub-1.94/include/grub/efi/api.h Wed Aug 30 11:39:49 2006 *************** *** 167,173 **** typedef grub_efi_intn_t grub_efi_status_t; #define GRUB_EFI_ERROR_CODE(value) \ ! ((1 << (sizeof (grub_efi_status_t) * 8 - 1)) | (value)) #define GRUB_EFI_WARNING_CODE(value) (value) --- 167,173 ---- typedef grub_efi_intn_t grub_efi_status_t; #define GRUB_EFI_ERROR_CODE(value) \ ! ((1L << (sizeof (grub_efi_status_t) * 8 - 1)) | (value)) #define GRUB_EFI_WARNING_CODE(value) (value) diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/include/grub/ia64/efi/console.h grub-1.94/include/grub/ia64/efi/console.h *** grub-1.94.orig/include/grub/ia64/efi/console.h Thu Jan 1 01:00:00 1970 --- grub-1.94/include/grub/ia64/efi/console.h Tue Aug 29 11:48:00 2006 *************** *** 0 **** --- 1,26 ---- + /* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + + #ifndef GRUB_MACHINE_CONSOLE_HEADER + #define GRUB_MACHINE_CONSOLE_HEADER 1 + + #include + + #endif /* ! GRUB_MACHINE_CONSOLE_HEADER */ diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/include/grub/ia64/efi/kernel.h grub-1.94/include/grub/ia64/efi/kernel.h *** grub-1.94.orig/include/grub/ia64/efi/kernel.h Thu Jan 1 01:00:00 1970 --- grub-1.94/include/grub/ia64/efi/kernel.h Fri Aug 25 13:51:40 2006 *************** *** 0 **** --- 1,28 ---- + /* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2002,2003 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + #ifndef GRUB_MACHINE_KERNEL_HEADER + #define GRUB_MACHINE_KERNEL_HEADER 1 + + /* The prefix which points to the directory where GRUB modules and its + configuration file are located. */ + extern char grub_prefix[]; + + #endif /* ! GRUB_MACHINE_KERNEL_HEADER */ + diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/include/grub/ia64/efi/loader.h grub-1.94/include/grub/ia64/efi/loader.h *** grub-1.94.orig/include/grub/ia64/efi/loader.h Thu Jan 1 01:00:00 1970 --- grub-1.94/include/grub/ia64/efi/loader.h Tue Sep 5 09:36:11 2006 *************** *** 0 **** --- 1,31 ---- + /* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2002,2003,2004,2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + #ifndef GRUB_LOADER_MACHINE_HEADER + #define GRUB_LOADER_MACHINE_HEADER 1 + + /* It is necessary to export these functions, because normal mode commands + reuse rescue mode commands. */ + void grub_rescue_cmd_linux (int argc, char *argv[]); + void grub_rescue_cmd_initrd (int argc, char *argv[]); + void grub_rescue_cmd_module (int argc, char *argv[]); + void grub_rescue_cmd_relocate (int argc, char *argv[]); + void grub_rescue_cmd_fpswa (int argc, char *argv[]); + + #endif /* ! GRUB_LOADER_MACHINE_HEADER */ diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/include/grub/ia64/efi/time.h grub-1.94/include/grub/ia64/efi/time.h *** grub-1.94.orig/include/grub/ia64/efi/time.h Thu Jan 1 01:00:00 1970 --- grub-1.94/include/grub/ia64/efi/time.h Fri Aug 25 13:51:40 2006 *************** *** 0 **** --- 1,26 ---- + /* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + + #ifndef GRUB_MACHINE_TIME_HEADER + #define GRUB_MACHINE_TIME_HEADER 1 + + #include + + #endif /* ! GRUB_MACHINE_TIME_HEADER */ diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/include/grub/ia64/libgcc.h grub-1.94/include/grub/ia64/libgcc.h *** grub-1.94.orig/include/grub/ia64/libgcc.h Thu Jan 1 01:00:00 1970 --- grub-1.94/include/grub/ia64/libgcc.h Thu Aug 31 09:33:35 2006 *************** *** 0 **** --- 1,35 ---- + /* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2004 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + void EXPORT_FUNC (__divdi3) (void); + + void EXPORT_FUNC (__divsi3) (void); + void EXPORT_FUNC (__modsi3) (void); + void EXPORT_FUNC (__udivsi3) (void); + void EXPORT_FUNC (__umodsi3) (void); + + void EXPORT_FUNC (memset) (void); + void EXPORT_FUNC (grub_longjmp) (void); + void EXPORT_FUNC (grub_setjmp) (void); + void EXPORT_FUNC (__ia64_trampoline) (void); + void EXPORT_FUNC (grub_init_modules) (void); + + extern unsigned long EXPORT_VAR (__gp); + extern unsigned long EXPORT_VAR (_DYNAMIC); + extern unsigned long EXPORT_VAR (ImageBase); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/include/grub/ia64/setjmp.h grub-1.94/include/grub/ia64/setjmp.h *** grub-1.94.orig/include/grub/ia64/setjmp.h Thu Jan 1 01:00:00 1970 --- grub-1.94/include/grub/ia64/setjmp.h Thu Aug 31 11:09:12 2006 *************** *** 0 **** --- 1,25 ---- + /* Define the machine-dependent type `jmp_buf'. Linux/IA-64 version. + Copyright (C) 1999, 2000 Free Software Foundation, Inc. + Contributed by David Mosberger-Tang . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + + /* User code must not depend on the internal representation of jmp_buf. */ + + #define _JBLEN 70 + + /* the __jmp_buf element type should be __float80 per ABI... */ + typedef long grub_jmp_buf[_JBLEN] __attribute__ ((aligned (16))); /* guarantees 128-bit alignment! */ diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/include/grub/ia64/types.h grub-1.94/include/grub/ia64/types.h *** grub-1.94.orig/include/grub/ia64/types.h Thu Jan 1 01:00:00 1970 --- grub-1.94/include/grub/ia64/types.h Fri Aug 25 13:50:46 2006 *************** *** 0 **** --- 1,33 ---- + /* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2002,2004,2006 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + #ifndef GRUB_TYPES_CPU_HEADER + #define GRUB_TYPES_CPU_HEADER 1 + + /* The size of void *. */ + #define GRUB_TARGET_SIZEOF_VOID_P 8 + + /* The size of long. */ + #define GRUB_TARGET_SIZEOF_LONG 8 + + /* ia64 is little-endian (usually). */ + #undef GRUB_TARGET_WORDS_BIGENDIAN + + + #endif /* ! GRUB_TYPES_CPU_HEADER */ diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/include/grub/misc.h grub-1.94/include/grub/misc.h *** grub-1.94.orig/include/grub/misc.h Sun Apr 23 15:37:36 2006 --- grub-1.94/include/grub/misc.h Fri Sep 1 11:49:45 2006 *************** *** 45,50 **** --- 45,51 ---- int EXPORT_FUNC(grub_strcmp) (const char *s1, const char *s2); int EXPORT_FUNC(grub_strncmp) (const char *s1, const char *s2, grub_size_t n); int EXPORT_FUNC(grub_strncasecmp) (const char *s1, const char *s2, int c); + int EXPORT_FUNC(grub_strcasecmp) (const char *s1, const char *s2); char *EXPORT_FUNC(grub_strchr) (const char *s, int c); char *EXPORT_FUNC(grub_strrchr) (const char *s, int c); int EXPORT_FUNC(grub_strword) (const char *s, const char *w); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/kern/dl.c grub-1.94/kern/dl.c *** grub-1.94.orig/kern/dl.c Mon May 29 01:01:43 2006 --- grub-1.94/kern/dl.c Thu Aug 31 09:36:19 2006 *************** *** 580,585 **** --- 580,599 ---- return mod; } + void + grub_init_module (grub_dl_t mod) + { + mod->ref_count = 1; + + grub_dprintf ("modules", "relocating to %p\n", mod); + + grub_dprintf ("modules", "module name: %s\n", mod->name); + grub_dprintf ("modules", "init function: %p\n", mod->init); + grub_dl_call_init (mod); + + grub_dl_add (mod); + } + /* Load a module from the file FILENAME. */ grub_dl_t grub_dl_load_file (const char *filename) diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/kern/efi/efi.c grub-1.94/kern/efi/efi.c *** grub-1.94.orig/kern/efi/efi.c Sat May 27 23:09:25 2006 --- grub-1.94/kern/efi/efi.c Wed Aug 30 11:36:33 2006 *************** *** 67,79 **** grub_efi_handle_t *buffer; grub_efi_uintn_t buffer_size = 8 * sizeof (grub_efi_handle_t); buffer = grub_malloc (buffer_size); if (! buffer) return 0; ! b = grub_efi_system_table->boot_services; status = b->locate_handle (search_type, protocol, search_key, &buffer_size, buffer); if (status == GRUB_EFI_BUFFER_TOO_SMALL) { grub_free (buffer); --- 67,82 ---- grub_efi_handle_t *buffer; grub_efi_uintn_t buffer_size = 8 * sizeof (grub_efi_handle_t); + *num_handles = 0; + buffer = grub_malloc (buffer_size); if (! buffer) return 0; ! b = grub_efi_system_table->boot_services; status = b->locate_handle (search_type, protocol, search_key, &buffer_size, buffer); + if (status == GRUB_EFI_BUFFER_TOO_SMALL) { grub_free (buffer); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/kern/ia64/asmmacro.h grub-1.94/kern/ia64/asmmacro.h *** grub-1.94.orig/kern/ia64/asmmacro.h Thu Jan 1 01:00:00 1970 --- grub-1.94/kern/ia64/asmmacro.h Tue Aug 29 08:06:00 2006 *************** *** 0 **** --- 1,117 ---- + #ifndef _ASM_IA64_ASMMACRO_H + #define _ASM_IA64_ASMMACRO_H + + /* + * Copyright (C) 2000-2001, 2003-2004 Hewlett-Packard Co + * David Mosberger-Tang + */ + + #define ENTRY(name) \ + .align 32; \ + .proc name; \ + name: + + #define ENTRY_MIN_ALIGN(name) \ + .align 16; \ + .proc name; \ + name: + + #define GLOBAL_ENTRY(name) \ + .global name; \ + ENTRY(name) + + #define END(name) \ + .endp name + + /* + * Helper macros to make unwind directives more readable: + */ + + /* prologue_gr: */ + #define ASM_UNW_PRLG_RP 0x8 + #define ASM_UNW_PRLG_PFS 0x4 + #define ASM_UNW_PRLG_PSP 0x2 + #define ASM_UNW_PRLG_PR 0x1 + #define ASM_UNW_PRLG_GRSAVE(ninputs) (32+(ninputs)) + + /* + * Helper macros for accessing user memory. + */ + + .section "__ex_table", "a" // declare section & section attributes + .previous + + # define EX(y,x...) \ + .xdata4 "__ex_table", 99f-., y-.; \ + [99:] x + # define EXCLR(y,x...) \ + .xdata4 "__ex_table", 99f-., y-.+4; \ + [99:] x + + /* + * Mark instructions that need a load of a virtual address patched to be + * a load of a physical address. We use this either in critical performance + * path (ivt.S - TLB miss processing) or in places where it might not be + * safe to use a "tpa" instruction (mca_asm.S - error recovery). + */ + .section ".data.patch.vtop", "a" // declare section & section attributes + .previous + + #ifdef XEN + #define LOAD_PHYSICAL(pr, reg, obj) \ + [1:](pr)movl reg = obj;; \ + shl reg = reg,4;; \ + shr.u reg = reg,4;; \ + .xdata4 ".data.patch.vtop", 1b-. + #else + #define LOAD_PHYSICAL(pr, reg, obj) \ + [1:](pr)movl reg = obj; \ + .xdata4 ".data.patch.vtop", 1b-. + #endif + + /* + * For now, we always put in the McKinley E9 workaround. On CPUs that don't need it, + * we'll patch out the work-around bundles with NOPs, so their impact is minimal. + */ + #define DO_MCKINLEY_E9_WORKAROUND + + #ifdef DO_MCKINLEY_E9_WORKAROUND + .section ".data.patch.mckinley_e9", "a" + .previous + /* workaround for Itanium 2 Errata 9: */ + # define FSYS_RETURN \ + .xdata4 ".data.patch.mckinley_e9", 1f-.; \ + 1:{ .mib; \ + nop.m 0; \ + mov r16=ar.pfs; \ + br.call.sptk.many b7=2f;; \ + }; \ + 2:{ .mib; \ + nop.m 0; \ + mov ar.pfs=r16; \ + br.ret.sptk.many b6;; \ + } + #else + # define FSYS_RETURN br.ret.sptk.many b6 + #endif + + /* + * Up until early 2004, use of .align within a function caused bad unwind info. + * TEXT_ALIGN(n) expands into ".align n" if a fixed GAS is available or into nothing + * otherwise. + */ + #ifdef HAVE_WORKING_TEXT_ALIGN + # define TEXT_ALIGN(n) .align n + #else + # define TEXT_ALIGN(n) + #endif + + #ifdef HAVE_SERIALIZE_DIRECTIVE + # define dv_serialize_data .serialize.data + # define dv_serialize_instruction .serialize.instruction + #else + # define dv_serialize_data + # define dv_serialize_instruction + #endif + + #endif /* _ASM_IA64_ASMMACRO_H */ diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/kern/ia64/divdi3.S grub-1.94/kern/ia64/divdi3.S *** grub-1.94.orig/kern/ia64/divdi3.S Thu Jan 1 01:00:00 1970 --- grub-1.94/kern/ia64/divdi3.S Tue Aug 29 15:27:25 2006 *************** *** 0 **** --- 1 ---- + #include "idiv64.S" diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/kern/ia64/divsi3.S grub-1.94/kern/ia64/divsi3.S *** grub-1.94.orig/kern/ia64/divsi3.S Thu Jan 1 01:00:00 1970 --- grub-1.94/kern/ia64/divsi3.S Tue Aug 29 11:07:40 2006 *************** *** 0 **** --- 1 ---- + #include "idiv32.S" diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/kern/ia64/efi/init.c grub-1.94/kern/ia64/efi/init.c *** grub-1.94.orig/kern/ia64/efi/init.c Thu Jan 1 01:00:00 1970 --- grub-1.94/kern/ia64/efi/init.c Tue Sep 5 09:20:30 2006 *************** *** 0 **** --- 1,61 ---- + /* init.c - initialize an x86-based EFI system */ + /* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + + #include + #include + #include + #include + #include + #include + #include + #include + + void + grub_machine_init (void) + { + grub_efi_init (); + grub_init_modules (); + } + + void + grub_machine_fini (void) + { + grub_efi_fini (); + } + + void + grub_machine_set_prefix (void) + { + grub_efi_set_prefix (); + } + + void + grub_arch_sync_caches (void *address, grub_size_t len) + { + /* Cache line length is at least 32. */ + grub_uint64_t a = (grub_uint64_t)address & ~0x1f; + + /* Flush data. */ + for (len = (len + 31) & ~0x1f; len > 0; len -= 0x20, a += 0x20) + asm volatile ("fc.i %0" : : "r" (a)); + /* Sync and serialize. Maybe extra. */ + asm volatile (";; sync.i;; srlz.i;;"); + } diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/kern/ia64/elf_ia64_efi.lds grub-1.94/kern/ia64/elf_ia64_efi.lds *** grub-1.94.orig/kern/ia64/elf_ia64_efi.lds Thu Jan 1 01:00:00 1970 --- grub-1.94/kern/ia64/elf_ia64_efi.lds Tue Aug 29 15:17:27 2006 *************** *** 0 **** --- 1,70 ---- + OUTPUT_FORMAT("elf64-ia64-little") + OUTPUT_ARCH(ia64) + ENTRY(_start_plabel) + SECTIONS + { + . = 0; + ImageBase = .; + .hash : { *(.hash) } /* this MUST come first! */ + . = ALIGN(4096); + .text : + { + *(.text) + *(.text.*) + *(.gnu.linkonce.t.*) + } + . = ALIGN(4096); + __gp = ALIGN (8) + 0x200000; + .sdata : + { + *(.got.plt) + *(.got) + *(.srodata) + *(.sdata) + *(.sbss) + *(.scommon) + } + . = ALIGN(4096); + .data : + { + *(.rodata*) + *(.ctors) + *(.data*) + *(.gnu.linkonce.d*) + *(.plabel) /* data whose relocs we want to ignore */ + /* the EFI loader doesn't seem to like a .bss section, so we stick + it all into .data: */ + *(.dynbss) + *(.bss) + *(COMMON) + } + . = ALIGN(4096); + .dynamic : { *(.dynamic) } + . = ALIGN(4096); + .rela : + { + *(.rela.text) + *(.rela.data*) + *(.rela.sdata) + *(.rela.got) + *(.rela.gnu.linkonce.d*) + *(.rela.stab) + *(.rela.ctors) + } + . = ALIGN(4096); + .reloc : /* This is the PECOFF .reloc section! */ + { + *(.reloc) + } + . = ALIGN(4096); + .dynsym : { *(.dynsym) } + . = ALIGN(4096); + .dynstr : { *(.dynstr) } + /DISCARD/ : + { + *(.rela.plabel) + *(.rela.reloc) + *(.IA_64.unwind*) + *(.IA64.unwind*) + } + } diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/kern/ia64/idiv32.S grub-1.94/kern/ia64/idiv32.S *** grub-1.94.orig/kern/ia64/idiv32.S Thu Jan 1 01:00:00 1970 --- grub-1.94/kern/ia64/idiv32.S Tue Aug 29 08:06:08 2006 *************** *** 0 **** --- 1,83 ---- + /* + * Copyright (C) 2000 Hewlett-Packard Co + * Copyright (C) 2000 David Mosberger-Tang + * + * 32-bit integer division. + * + * This code is based on the application note entitled "Divide, Square Root + * and Remainder Algorithms for the IA-64 Architecture". This document + * is available as Intel document number 248725-002 or via the web at + * http://developer.intel.com/software/opensource/numerics/ + * + * For more details on the theory behind these algorithms, see "IA-64 + * and Elementary Functions" by Peter Markstein; HP Professional Books + * (http://www.hp.com/go/retailbooks/) + */ + + #include "asmmacro.h" + + #ifdef MODULO + # define OP mod + #else + # define OP div + #endif + + #ifdef UNSIGNED + # define SGN u + # define EXTEND zxt4 + # define INT_TO_FP(a,b) fcvt.xuf.s1 a=b + # define FP_TO_INT(a,b) fcvt.fxu.trunc.s1 a=b + #else + # define SGN + # define EXTEND sxt4 + # define INT_TO_FP(a,b) fcvt.xf a=b + # define FP_TO_INT(a,b) fcvt.fx.trunc.s1 a=b + #endif + + #define PASTE1(a,b) a##b + #define PASTE(a,b) PASTE1(a,b) + #define NAME PASTE(PASTE(__,SGN),PASTE(OP,si3)) + + GLOBAL_ENTRY(NAME) + .regstk 2,0,0,0 + // Transfer inputs to FP registers. + mov r2 = 0xffdd // r2 = -34 + 65535 (fp reg format bias) + EXTEND in0 = in0 // in0 = a + EXTEND in1 = in1 // in1 = b + ;; + setf.sig f8 = in0 + setf.sig f9 = in1 + #ifdef MODULO + sub in1 = r0, in1 // in1 = -b + #endif + ;; + // Convert the inputs to FP, to avoid FP software-assist faults. + INT_TO_FP(f8, f8) + INT_TO_FP(f9, f9) + ;; + setf.exp f7 = r2 // f7 = 2^-34 + frcpa.s1 f6, p6 = f8, f9 // y0 = frcpa(b) + ;; + (p6) fmpy.s1 f8 = f8, f6 // q0 = a*y0 + (p6) fnma.s1 f6 = f9, f6, f1 // e0 = -b*y0 + 1 + ;; + #ifdef MODULO + setf.sig f9 = in1 // f9 = -b + #endif + (p6) fma.s1 f8 = f6, f8, f8 // q1 = e0*q0 + q0 + (p6) fma.s1 f6 = f6, f6, f7 // e1 = e0*e0 + 2^-34 + ;; + #ifdef MODULO + setf.sig f7 = in0 + #endif + (p6) fma.s1 f6 = f6, f8, f8 // q2 = e1*q1 + q1 + ;; + FP_TO_INT(f6, f6) // q = trunc(q2) + ;; + #ifdef MODULO + xma.l f6 = f6, f9, f7 // r = q*(-b) + a + ;; + #endif + getf.sig r8 = f6 // transfer result to result register + br.ret.sptk.many rp + END(NAME) diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/kern/ia64/idiv64.S grub-1.94/kern/ia64/idiv64.S *** grub-1.94.orig/kern/ia64/idiv64.S Thu Jan 1 01:00:00 1970 --- grub-1.94/kern/ia64/idiv64.S Tue Aug 29 08:07:34 2006 *************** *** 0 **** --- 1,80 ---- + /* + * Copyright (C) 1999-2000 Hewlett-Packard Co + * Copyright (C) 1999-2000 David Mosberger-Tang + * + * 64-bit integer division. + * + * This code is based on the application note entitled "Divide, Square Root + * and Remainder Algorithms for the IA-64 Architecture". This document + * is available as Intel document number 248725-002 or via the web at + * http://developer.intel.com/software/opensource/numerics/ + * + * For more details on the theory behind these algorithms, see "IA-64 + * and Elementary Functions" by Peter Markstein; HP Professional Books + * (http://www.hp.com/go/retailbooks/) + */ + + #include "asmmacro.h" + + #ifdef MODULO + # define OP mod + #else + # define OP div + #endif + + #ifdef UNSIGNED + # define SGN u + # define INT_TO_FP(a,b) fcvt.xuf.s1 a=b + # define FP_TO_INT(a,b) fcvt.fxu.trunc.s1 a=b + #else + # define SGN + # define INT_TO_FP(a,b) fcvt.xf a=b + # define FP_TO_INT(a,b) fcvt.fx.trunc.s1 a=b + #endif + + #define PASTE1(a,b) a##b + #define PASTE(a,b) PASTE1(a,b) + #define NAME PASTE(PASTE(__,SGN),PASTE(OP,di3)) + + GLOBAL_ENTRY(NAME) + .regstk 2,0,0,0 + // Transfer inputs to FP registers. + setf.sig f8 = in0 + setf.sig f9 = in1 + ;; + // Convert the inputs to FP, to avoid FP software-assist faults. + INT_TO_FP(f8, f8) + INT_TO_FP(f9, f9) + ;; + frcpa.s1 f11, p6 = f8, f9 // y0 = frcpa(b) + ;; + (p6) fmpy.s1 f7 = f8, f11 // q0 = a*y0 + (p6) fnma.s1 f6 = f9, f11, f1 // e0 = -b*y0 + 1 + ;; + (p6) fma.s1 f10 = f7, f6, f7 // q1 = q0*e0 + q0 + (p6) fmpy.s1 f7 = f6, f6 // e1 = e0*e0 + ;; + #ifdef MODULO + sub in1 = r0, in1 // in1 = -b + #endif + (p6) fma.s1 f10 = f10, f7, f10 // q2 = q1*e1 + q1 + (p6) fma.s1 f6 = f11, f6, f11 // y1 = y0*e0 + y0 + ;; + (p6) fma.s1 f6 = f6, f7, f6 // y2 = y1*e1 + y1 + (p6) fnma.s1 f7 = f9, f10, f8 // r = -b*q2 + a + ;; + #ifdef MODULO + setf.sig f8 = in0 // f8 = a + setf.sig f9 = in1 // f9 = -b + #endif + (p6) fma.s1 f11 = f7, f6, f10 // q3 = r*y2 + q2 + ;; + FP_TO_INT(f11, f11) // q = trunc(q3) + ;; + #ifdef MODULO + xma.l f11 = f11, f9, f8 // r = q*(-b) + a + ;; + #endif + getf.sig r8 = f11 // transfer result to result register + br.ret.sptk.many rp + END(NAME) diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/kern/ia64/modsi3.S grub-1.94/kern/ia64/modsi3.S *** grub-1.94.orig/kern/ia64/modsi3.S Thu Jan 1 01:00:00 1970 --- grub-1.94/kern/ia64/modsi3.S Tue Aug 29 11:08:02 2006 *************** *** 0 **** --- 1,2 ---- + #define MODULO 1 + #include "idiv32.S" diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/kern/ia64/reloc_ia64.S grub-1.94/kern/ia64/reloc_ia64.S *** grub-1.94.orig/kern/ia64/reloc_ia64.S Thu Jan 1 01:00:00 1970 --- grub-1.94/kern/ia64/reloc_ia64.S Tue Aug 29 15:10:01 2006 *************** *** 0 **** --- 1,212 ---- + /* reloc_ia64.S - position independent IA-64 ELF shared object relocator + Copyright (C) 1999 Hewlett-Packard Co. + Contributed by David Mosberger . + + This file is part of GNU-EFI, the GNU EFI development environment. + + GNU EFI is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GNU EFI is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU EFI; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + + /* + * This is written in assembly because the entire code needs to be position + * independent. Note that the compiler does not generate code that's position + * independent by itself because it relies on the global offset table being + * relocated. + */ + .text + .psr abi64 + .psr lsb + .lsb + + /* + * This constant determines how many R_IA64_FPTR64LSB relocations we + * can deal with. If you get EFI_BUFFER_TOO_SMALL errors, you may + * need to increase this number. + */ + #define MAX_FUNCTION_DESCRIPTORS 750 + + #define ST_VALUE_OFF 8 /* offset of st_value in elf sym */ + + #define EFI_SUCCESS 0 + #define EFI_LOAD_ERROR 1 + #define EFI_BUFFER_TOO_SMALL 5 + + #define DT_NULL 0 /* Marks end of dynamic section */ + #define DT_RELA 7 /* Address of Rela relocs */ + #define DT_RELASZ 8 /* Total size of Rela relocs */ + #define DT_RELAENT 9 /* Size of one Rela reloc */ + #define DT_SYMTAB 6 /* Address of symbol table */ + #define DT_SYMENT 11 /* Size of one symbol table entry */ + + #define R_IA64_NONE 0 + #define R_IA64_REL64MSB 0x6e + #define R_IA64_REL64LSB 0x6f + #define R_IA64_DIR64MSB 0x26 + #define R_IA64_DIR64LSB 0x27 + #define R_IA64_FPTR64MSB 0x46 + #define R_IA64_FPTR64LSB 0x47 + + #define ldbase in0 /* load address (address of .text) */ + #define dyn in1 /* address of _DYNAMIC */ + + #define d_tag r16 + #define d_val r17 + #define rela r18 + #define relasz r19 + #define relaent r20 + #define addr r21 + #define r_info r22 + #define r_offset r23 + #define r_addend r24 + #define r_type r25 + #define r_sym r25 /* alias of r_type ! */ + #define fptr r26 + #define fptr_limit r27 + #define symtab f8 + #define syment f9 + #define ftmp f10 + + #define target r16 + #define val r17 + + #define NLOC 0 + + #define Pnull p6 + #define Prela p7 + #define Prelasz p8 + #define Prelaent p9 + #define Psymtab p10 + #define Psyment p11 + + #define Pnone p6 + #define Prel p7 + #define Pfptr p8 + + #define Pmore p6 + + #define Poom p6 /* out-of-memory */ + + .global _relocate + .proc _relocate + _relocate: + alloc r2=ar.pfs,2,0,0,0 + movl fptr = @gprel(fptr_mem_base) + ;; + add fptr = fptr, gp + movl fptr_limit = @gprel(fptr_mem_limit) + ;; + add fptr_limit = fptr_limit, gp + + search_dynamic: + ld8 d_tag = [dyn],8 + ;; + ld8 d_val = [dyn],8 + cmp.eq Pnull,p0 = DT_NULL,d_tag + (Pnull) br.cond.sptk.few apply_relocs + cmp.eq Prela,p0 = DT_RELA,d_tag + cmp.eq Prelasz,p0 = DT_RELASZ,d_tag + cmp.eq Psymtab,p0 = DT_SYMTAB,d_tag + cmp.eq Psyment,p0 = DT_SYMENT,d_tag + cmp.eq Prelaent,p0 = DT_RELAENT,d_tag + ;; + (Prela) add rela = d_val, ldbase + (Prelasz) mov relasz = d_val + (Prelaent) mov relaent = d_val + (Psymtab) add val = d_val, ldbase + (Psyment) setf.sig syment = d_val + ;; + (Psymtab) setf.sig symtab = val + br.sptk.few search_dynamic + + apply_loop: + ld8 r_offset = [rela] + add addr = 8,rela + sub relasz = relasz,relaent + ;; + + ld8 r_info = [addr],8 + ;; + ld8 r_addend = [addr] + add target = ldbase, r_offset + + add rela = rela,relaent + extr.u r_type = r_info, 0, 32 + ;; + cmp.eq Pnone,p0 = R_IA64_NONE,r_type + cmp.eq Prel,p0 = R_IA64_REL64LSB,r_type + cmp.eq Pfptr,p0 = R_IA64_FPTR64LSB,r_type + (Prel) br.cond.sptk.few apply_REL64 + ;; + cmp.eq Prel,p0 = R_IA64_DIR64LSB,r_type // treat DIR64 just like REL64 + + (Pnone) br.cond.sptk.few apply_relocs + (Prel) br.cond.sptk.few apply_REL64 + (Pfptr) br.cond.sptk.few apply_FPTR64 + + mov r8 = EFI_LOAD_ERROR + br.ret.sptk.few rp + + apply_relocs: + cmp.ltu Pmore,p0=0,relasz + (Pmore) br.cond.sptk.few apply_loop + + mov r8 = EFI_SUCCESS + br.ret.sptk.few rp + + apply_REL64: + ld8 val = [target] + ;; + add val = val,ldbase + ;; + st8 [target] = val + br.cond.sptk.few apply_relocs + + // FPTR relocs are a bit more interesting: we need to lookup + // the symbol's value in symtab, allocate 16 bytes of memory, + // store the value in [target] in the first and the gp in the + // second dword. + apply_FPTR64: + st8 [target] = fptr + extr.u r_sym = r_info,32,32 + add target = 8,fptr + ;; + + setf.sig ftmp = r_sym + mov r8=EFI_BUFFER_TOO_SMALL + ;; + cmp.geu Poom,p0 = fptr,fptr_limit + + xma.lu ftmp = ftmp,syment,symtab + (Poom) br.ret.sptk.few rp + ;; + getf.sig addr = ftmp + st8 [target] = gp + ;; + add addr = ST_VALUE_OFF, addr + ;; + ld8 val = [addr] + ;; + add val = val,ldbase + ;; + st8 [fptr] = val,16 + br.cond.sptk.few apply_relocs + + .endp _relocate + + .data + .align 16 + fptr_mem_base: + .space MAX_FUNCTION_DESCRIPTORS*16 + fptr_mem_limit: diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/kern/ia64/startup.S grub-1.94/kern/ia64/startup.S *** grub-1.94.orig/kern/ia64/startup.S Thu Jan 1 01:00:00 1970 --- grub-1.94/kern/ia64/startup.S Tue Aug 29 15:45:05 2006 *************** *** 0 **** --- 1,81 ---- + /* crt0-efi-ia64.S - IA-64 EFI startup code. + Copyright (C) 1999 Hewlett-Packard Co. + Contributed by David Mosberger . + + This file is part of GNU-EFI, the GNU EFI development environment. + + GNU EFI is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GNU EFI is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU EFI; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + + .text + .psr abi64 + .psr lsb + .lsb + + .global _start + .proc _start + _start: + alloc loc0=ar.pfs,2,2,2,0 + mov loc1=rp + movl out0=@gprel(ImageBase) // out0 <- ImageBase (ldbase) + ;; + add out0=out0,gp + movl out1=@gprel(_DYNAMIC) // out1 <- _DYNAMIC + ;; // avoid WAW on CFM + add out1=out1,gp + br.call.sptk.few rp=_relocate + .Lret0: + cmp.ne p6,p0=r0,r8 // r8 == EFI_SUCCESS? + (p6) br.cond.sptk.few .exit // no -> + + .Lret1: + + movl out0=@gprel(grub_efi_image_handle) + ;; + add out0=out0,gp + movl out1=@gprel(grub_efi_system_table) + ;; + add out1=out1,gp + st8 [out0]=in0 + ;; + st8 [out1]=in1 + br.call.sptk.few rp=grub_main + .Lret2: + .exit: + mov ar.pfs=loc0 + mov rp=loc1 + ;; + br.ret.sptk.few rp + + .endp _start + + // PE32+ wants a PLABEL, not the code address of the entry point: + + .align 16 + .global _start_plabel + .section .plabel, "a" + _start_plabel: + data8 _start + data8 __gp + + // hand-craft a .reloc section for the plabel: + + #define IMAGE_REL_BASED_DIR64 10 + + .section .reloc, "a" + data4 _start_plabel // Page RVA + data4 12 // Block Size (2*4+2*2) + data2 (IMAGE_REL_BASED_DIR64<<12) + 0 // reloc for plabel's entry point + data2 (IMAGE_REL_BASED_DIR64<<12) + 8 // reloc for plabel's global pointer diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/kern/ia64/trampoline.S grub-1.94/kern/ia64/trampoline.S *** grub-1.94.orig/kern/ia64/trampoline.S Thu Jan 1 01:00:00 1970 --- grub-1.94/kern/ia64/trampoline.S Wed Aug 30 08:25:32 2006 *************** *** 0 **** --- 1,15 ---- + .text + .psr abi64 + .psr lsb + .lsb + + .proc __ia64_trampoline + .global __ia64_trampoline + __ia64_trampoline: + ld8 r2=[r1],8;; + ld8 r15=[r1] + ld8 r3=[r2],8;; + ld8 r1=[r2] + mov b6=r3 + br.many b6 + .endp __ia64_trampoline diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/kern/ia64/udivdi3.S grub-1.94/kern/ia64/udivdi3.S *** grub-1.94.orig/kern/ia64/udivdi3.S Thu Jan 1 01:00:00 1970 --- grub-1.94/kern/ia64/udivdi3.S Tue Aug 29 08:07:53 2006 *************** *** 0 **** --- 1,2 ---- + #define UNSIGNED 1 + #include "idiv64.S" diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/kern/ia64/udivsi3.S grub-1.94/kern/ia64/udivsi3.S *** grub-1.94.orig/kern/ia64/udivsi3.S Thu Jan 1 01:00:00 1970 --- grub-1.94/kern/ia64/udivsi3.S Tue Aug 29 08:04:04 2006 *************** *** 0 **** --- 1,2 ---- + #define UNSIGNED 1 + #include "idiv32.S" diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/kern/ia64/umoddi3.S grub-1.94/kern/ia64/umoddi3.S *** grub-1.94.orig/kern/ia64/umoddi3.S Thu Jan 1 01:00:00 1970 --- grub-1.94/kern/ia64/umoddi3.S Tue Aug 29 08:07:02 2006 *************** *** 0 **** --- 1,3 ---- + #define UNSIGNED 1 + #define MODULO 1 + #include "idiv64.S" diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/kern/ia64/umodsi3.S grub-1.94/kern/ia64/umodsi3.S *** grub-1.94.orig/kern/ia64/umodsi3.S Thu Jan 1 01:00:00 1970 --- grub-1.94/kern/ia64/umodsi3.S Tue Aug 29 08:08:37 2006 *************** *** 0 **** --- 1,3 ---- + #define UNSIGNED 1 + #define MODULO 1 + #include "idiv32.S" diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/kern/misc.c grub-1.94/kern/misc.c *** grub-1.94.orig/kern/misc.c Wed Apr 26 01:47:48 2006 --- grub-1.94/kern/misc.c Fri Sep 1 11:30:03 2006 *************** *** 193,198 **** --- 193,218 ---- } int + grub_strcasecmp (const char *s1, const char *s2) + { + char c1, c2; + + while (*s1 && *s2) + { + c1 = grub_tolower (*s1); + c2 = grub_tolower (*s2); + if (c1 != c2) + return (int) c1 - (int) c2; + + s1++; + s2++; + } + + /* One of these is 0! */ + return (int) *s1 - (int) *s2; + } + + int grub_strncmp (const char *s1, const char *s2, grub_size_t n) { if (n == 0) *************** *** 350,356 **** /* Guess the base, if not specified. The prefix `0x' means 16, and the prefix `0' means 8. */ ! if (str[0] == '0') { if (str[1] == 'x') { --- 370,376 ---- /* Guess the base, if not specified. The prefix `0x' means 16, and the prefix `0' means 8. */ ! if (base == 0 && str[0] == '0') { if (str[1] == 'x') { *************** *** 626,632 **** unsigned int format2 = 3; char zerofill = ' '; int rightfill = 0; ! int n; int longfmt = 0; int longlongfmt = 0; --- 646,652 ---- unsigned int format2 = 3; char zerofill = ' '; int rightfill = 0; ! long int n; int longfmt = 0; int longlongfmt = 0; diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/loader/efi/chainloader.c grub-1.94/loader/efi/chainloader.c *** grub-1.94.orig/loader/efi/chainloader.c Sun Apr 30 23:09:37 2006 --- grub-1.94/loader/efi/chainloader.c Thu Aug 31 08:48:52 2006 *************** *** 301,307 **** static const char loader_name[] = "chainloader"; ! GRUB_MOD_INIT(chainloader) { grub_rescue_register_command (loader_name, grub_rescue_cmd_chainloader, --- 301,308 ---- static const char loader_name[] = "chainloader"; ! static void ! grub_chainloader_init (grub_dl_t mod) { grub_rescue_register_command (loader_name, grub_rescue_cmd_chainloader, *************** *** 309,315 **** my_mod = mod; } ! GRUB_MOD_FINI(chainloader) { grub_rescue_unregister_command (loader_name); } --- 310,319 ---- my_mod = mod; } ! static void ! grub_chainloader_fini (void) { grub_rescue_unregister_command (loader_name); } + + GRUB_MODULE(chainloader,grub_chainloader_init,grub_chainloader_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/loader/efi/chainloader_normal.c grub-1.94/loader/efi/chainloader_normal.c *** grub-1.94.orig/loader/efi/chainloader_normal.c Sun Apr 30 23:09:37 2006 --- grub-1.94/loader/efi/chainloader_normal.c Thu Aug 31 08:52:01 2006 *************** *** 34,40 **** return grub_errno; } ! GRUB_MOD_INIT(chainloader_normal) { (void) mod; /* To stop warning. */ grub_register_command ("chainloader", chainloader_command, --- 34,41 ---- return grub_errno; } ! static void ! grub_chainloader_normal_init (grub_dl_t mod) { (void) mod; /* To stop warning. */ grub_register_command ("chainloader", chainloader_command, *************** *** 43,49 **** "Prepare to boot another boot loader.", 0); } ! GRUB_MOD_FINI(chainloader_normal) { grub_unregister_command ("chainloader"); } --- 44,54 ---- "Prepare to boot another boot loader.", 0); } ! static void ! grub_chainloader_normal_fini (void) { grub_unregister_command ("chainloader"); } + + GRUB_MODULE(chainloader_normal, + grub_chainloader_normal_init,grub_chainloader_normal_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/loader/ia64/linux.c grub-1.94/loader/ia64/linux.c *** grub-1.94.orig/loader/ia64/linux.c Thu Jan 1 01:00:00 1970 --- grub-1.94/loader/ia64/linux.c Tue Sep 5 10:45:31 2006 *************** *** 0 **** --- 1,810 ---- + /* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + /* #include */ + #include + #include + #include + #include + + #define GRUB_ELF_SEARCH 1024 + + #define BOOT_PARAM_SIZE 16384 + + static void *grub_efi_allocate_boot_pages (grub_efi_physical_address_t address, + grub_efi_uintn_t pages); + /* Free pages starting from ADDRESS. */ + static void grub_efi_free_boot_pages (grub_efi_physical_address_t address, + grub_efi_uintn_t pages); + + struct ia64_boot_param { + grub_uint64_t command_line; /* physical address of command line. */ + grub_uint64_t efi_systab; /* physical address of EFI system table */ + grub_uint64_t efi_memmap; /* physical address of EFI memory map */ + grub_uint64_t efi_memmap_size; /* size of EFI memory map */ + grub_uint64_t efi_memdesc_size; /* size of an EFI memory map descriptor */ + grub_uint32_t efi_memdesc_version; /* memory descriptor version */ + struct { + grub_uint16_t num_cols; /* number of columns on console output dev */ + grub_uint16_t num_rows; /* number of rows on console output device */ + grub_uint16_t orig_x; /* cursor's x position */ + grub_uint16_t orig_y; /* cursor's y position */ + } console_info; + grub_uint64_t fpswa; /* physical address of the fpswa interface */ + grub_uint64_t initrd_start; + grub_uint64_t initrd_size; + grub_uint64_t domain_start; /* boot domain address. */ + grub_uint64_t domain_size; /* how big is the boot domain */ + grub_uint64_t modules_chain; + grub_uint64_t modules_nbr; + }; + + struct ia64_boot_module { + grub_uint64_t mod_start; + grub_uint64_t mod_end; + + /* Module command line */ + grub_uint64_t cmdline; + + grub_uint64_t next; + }; + + typedef struct { + grub_uint32_t revision; + grub_uint32_t reserved; + void *fpswa; + } fpswa_interface_t; + static fpswa_interface_t *fpswa; + + #define NEXT_MEMORY_DESCRIPTOR(desc, size) \ + ((grub_efi_memory_descriptor_t *) ((char *) (desc) + (size))) + + static grub_dl_t my_mod; + + static int loaded; + + /* Kernel base and size. */ + static void *kernel_mem; + static grub_efi_uintn_t kernel_pages; + static grub_uint64_t entry; + + /* Initrd base and size. */ + static void *initrd_mem; + static grub_efi_uintn_t initrd_pages; + static grub_efi_uintn_t initrd_size; + + static struct ia64_boot_param *boot_param; + static grub_efi_uintn_t boot_param_pages; + static struct ia64_boot_module *last_module = NULL; + + /* Can linux kernel be relocated ? */ + #define RELOCATE_OFF 0 /* No. */ + #define RELOCATE_ON 1 /* Yes. */ + #define RELOCATE_FORCE 2 /* Always - used to debug. */ + static int relocate = RELOCATE_OFF; + + static inline grub_size_t + page_align (grub_size_t size) + { + return (size + (1 << 12) - 1) & (~((1 << 12) - 1)); + } + + /* Allocate pages. Return the pointer to the first of allocated pages. */ + static void * + grub_efi_allocate_boot_pages (grub_efi_physical_address_t address, + grub_efi_uintn_t pages) + { + grub_efi_allocate_type_t type; + grub_efi_status_t status; + grub_efi_boot_services_t *b; + + if (address == 0) + type = GRUB_EFI_ALLOCATE_ANY_PAGES; + else + type = GRUB_EFI_ALLOCATE_ADDRESS; + + b = grub_efi_system_table->boot_services; + status = b->allocate_pages (type, GRUB_EFI_LOADER_DATA, pages, &address); + if (status != GRUB_EFI_SUCCESS) + return 0; + + if (address == 0) + { + /* Uggh, the address 0 was allocated... This is too annoying, + so reallocate another one. */ + status = b->allocate_pages (type, GRUB_EFI_LOADER_DATA, pages, &address); + grub_efi_free_boot_pages (0, pages); + if (status != GRUB_EFI_SUCCESS) + return 0; + } + + return (void *)address; + } + + /* Free pages starting from ADDRESS. */ + void + grub_efi_free_boot_pages (grub_efi_physical_address_t address, + grub_efi_uintn_t pages) + { + grub_efi_boot_services_t *b; + + b = grub_efi_system_table->boot_services; + b->free_pages (address, pages); + } + + static void + query_fpswa (void) + { + grub_efi_handle_t fpswa_image; + grub_efi_boot_services_t *bs; + grub_efi_status_t status; + grub_efi_uintn_t size; + static grub_efi_guid_t fpswa_protocol = + { 0xc41b6531, 0x97b9, 0x11d3, + {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }; + + if (fpswa != NULL) + return; + + size = sizeof(grub_efi_handle_t); + + bs = grub_efi_system_table->boot_services; + status = bs->locate_handle (GRUB_EFI_BY_PROTOCOL, + &fpswa_protocol, + NULL, &size, &fpswa_image); + if (status != GRUB_EFI_SUCCESS) + { + grub_printf("Could not locate FPSWA driver\n"); + return; + } + status = bs->handle_protocol (fpswa_image, &fpswa_protocol, &fpswa); + if (status != GRUB_EFI_SUCCESS) + { + grub_printf ("Fpswa protocol not able find the interface\n"); + return; + } + } + + /* Find the optimal number of pages for the memory map. Is it better to + move this code to efi/mm.c? */ + static grub_efi_uintn_t + find_mmap_size (void) + { + static grub_efi_uintn_t mmap_size = 0; + + if (mmap_size != 0) + return mmap_size; + + mmap_size = (1 << 12); + while (1) + { + int ret; + grub_efi_memory_descriptor_t *mmap; + grub_efi_uintn_t desc_size; + + mmap = grub_malloc (mmap_size); + if (! mmap) + return 0; + + ret = grub_efi_get_memory_map (&mmap_size, mmap, 0, &desc_size, 0); + grub_free (mmap); + + if (ret < 0) + grub_fatal ("cannot get memory map"); + else if (ret > 0) + break; + + mmap_size += (1 << 12); + } + + /* Increase the size a bit for safety, because GRUB allocates more on + later, and EFI itself may allocate more. */ + mmap_size += (1 << 12); + + return page_align (mmap_size); + } + + static void + free_pages (void) + { + if (kernel_mem) + { + grub_efi_free_boot_pages ((grub_addr_t) kernel_mem, kernel_pages); + kernel_mem = 0; + } + + if (initrd_mem) + { + grub_efi_free_boot_pages ((grub_addr_t) initrd_mem, initrd_pages); + initrd_mem = 0; + } + + if (boot_param) + { + struct ia64_boot_module *mod; + struct ia64_boot_module *next_mod; + + /* Free modules. */ + mod = (struct ia64_boot_module *)boot_param->modules_chain; + while (mod != 0) + { + next_mod = (struct ia64_boot_module *)mod->next; + + grub_efi_free_boot_pages + (mod->mod_start, page_align (mod->mod_end - mod->mod_start) >> 12); + grub_efi_free_boot_pages ((grub_efi_physical_address_t)mod, 1); + + mod = next_mod; + } + + /* Free bootparam. */ + grub_efi_free_boot_pages ((grub_efi_physical_address_t)boot_param, + boot_param_pages); + boot_param = 0; + } + } + + static void * + allocate_pages (grub_uint64_t align, grub_uint64_t size_pages, + grub_uint64_t nobase) + { + grub_uint64_t size; + grub_efi_uintn_t desc_size; + grub_efi_memory_descriptor_t *mmap, *mmap_end; + grub_efi_uintn_t mmap_size, tmp_mmap_size; + grub_efi_memory_descriptor_t *desc; + void *mem = NULL; + + size = size_pages << 12; + + mmap_size = find_mmap_size (); + + /* Read the memory map temporarily, to find free space. */ + mmap = grub_malloc (mmap_size); + if (! mmap) + return 0; + + tmp_mmap_size = mmap_size; + if (grub_efi_get_memory_map (&tmp_mmap_size, mmap, 0, &desc_size, 0) <= 0) + grub_fatal ("cannot get memory map"); + + mmap_end = NEXT_MEMORY_DESCRIPTOR (mmap, tmp_mmap_size); + + /* First, find free pages for the real mode code + and the memory map buffer. */ + for (desc = mmap; + desc < mmap_end; + desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size)) + { + grub_uint64_t start, end; + grub_uint64_t aligned_start; + + if (desc->type != GRUB_EFI_CONVENTIONAL_MEMORY) + continue; + + start = desc->physical_start; + end = start + (desc->num_pages << 12); + /* Align is a power of 2. */ + aligned_start = (start + align - 1) & ~(align - 1); + if (aligned_start + size > end) + continue; + if (aligned_start == nobase) + aligned_start += align; + if (aligned_start + size > end) + continue; + mem = grub_efi_allocate_pages (aligned_start, size_pages); + if (! mem) + grub_fatal ("cannot allocate pages"); + break; + } + + if (! mem) + { + grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate memory"); + goto fail; + } + + grub_free (mmap); + return mem; + + fail: + grub_free (mmap); + free_pages (); + return 0; + } + + static void + set_boot_param_console (void) + { + grub_efi_simple_text_output_interface_t *conout; + grub_efi_uintn_t cols, rows; + + conout = grub_efi_system_table->con_out; + if (conout->query_mode (conout, conout->mode->mode, &cols, &rows) + != GRUB_EFI_SUCCESS) + return; + + grub_dprintf("linux", + "Console info: cols=%lu rows=%lu x=%u y=%u\n", + cols, rows, + conout->mode->cursor_column, conout->mode->cursor_row); + + boot_param->console_info.num_cols = cols; + boot_param->console_info.num_rows = rows; + boot_param->console_info.orig_x = conout->mode->cursor_column; + boot_param->console_info.orig_y = conout->mode->cursor_row; + } + + static grub_err_t + grub_linux_boot (void) + { + grub_efi_uintn_t mmap_size; + grub_efi_uintn_t map_key; + grub_efi_uintn_t desc_size; + grub_efi_uint32_t desc_version; + grub_efi_memory_descriptor_t *mmap_buf; + + /* FPSWA. */ + query_fpswa (); + boot_param->fpswa = (grub_uint64_t)fpswa; + + /* MDT. */ + mmap_size = find_mmap_size (); + mmap_buf = grub_efi_allocate_boot_pages (0, page_align (mmap_size) >> 12); + if (! mmap_buf) + grub_fatal ("cannot allocate memory map"); + if (grub_efi_get_memory_map (&mmap_size, mmap_buf, &map_key, + &desc_size, &desc_version) <= 0) + grub_fatal ("cannot get memory map"); + + boot_param->efi_memmap = (grub_uint64_t)mmap_buf; + boot_param->efi_memmap_size = mmap_size; + boot_param->efi_memdesc_size = desc_size; + boot_param->efi_memdesc_version = desc_version; + + /* Initrd. */ + boot_param->initrd_start = (grub_uint64_t)initrd_mem; + boot_param->initrd_size = (grub_uint64_t)initrd_size; + + set_boot_param_console (); + + if (! grub_efi_exit_boot_services (map_key)) + grub_fatal ("cannot exit boot services"); + + /* See you next boot. */ + asm volatile ("mov r28=%1; br.sptk.few %0" :: "b"(entry),"r"(boot_param)); + + /* Never reach here. */ + return GRUB_ERR_NONE; + } + + static grub_err_t + grub_linux_unload (void) + { + free_pages (); + grub_dl_unref (my_mod); + loaded = 0; + return GRUB_ERR_NONE; + } + + static grub_err_t + grub_load_elf64 (grub_file_t file, void *buffer) + { + Elf64_Ehdr *ehdr = (Elf64_Ehdr *) buffer; + Elf64_Phdr *phdr; + int i; + grub_uint64_t low_addr; + grub_uint64_t high_addr; + grub_uint64_t align; + + if (ehdr->e_ident[EI_CLASS] != ELFCLASS64) + return grub_error (GRUB_ERR_UNKNOWN_OS, "invalid ELF class"); + + if (ehdr->e_ident[EI_MAG0] != ELFMAG0 + || ehdr->e_ident[EI_MAG1] != ELFMAG1 + || ehdr->e_ident[EI_MAG2] != ELFMAG2 + || ehdr->e_ident[EI_MAG3] != ELFMAG3 + || ehdr->e_version != EV_CURRENT + || ehdr->e_ident[EI_DATA] != ELFDATA2LSB + || ehdr->e_machine != EM_IA_64) + return grub_error(GRUB_ERR_UNKNOWN_OS, "no valid ELF header found"); + + if (ehdr->e_type != ET_EXEC) + return grub_error (GRUB_ERR_UNKNOWN_OS, "invalid ELF file type"); + + /* FIXME: Should we support program headers at strange locations? */ + if (ehdr->e_phoff + ehdr->e_phnum * ehdr->e_phentsize > GRUB_ELF_SEARCH) + return grub_error (GRUB_ERR_BAD_OS, "program header at a too high offset"); + + entry = ehdr->e_entry; + + /* Compute low, high and align addresses. */ + low_addr = ~0UL; + high_addr = 0; + align = 0; + for (i = 0; i < ehdr->e_phnum; i++) + { + phdr = (Elf64_Phdr *) ((char *) buffer + ehdr->e_phoff + + i * ehdr->e_phentsize); + if (phdr->p_type == PT_LOAD) + { + if (phdr->p_paddr < low_addr) + low_addr = phdr->p_paddr; + if (phdr->p_paddr + phdr->p_memsz > high_addr) + high_addr = phdr->p_paddr + phdr->p_memsz; + if (phdr->p_align > align) + align = phdr->p_align; + } + } + + if (high_addr == 0) + return grub_error (GRUB_ERR_BAD_OS, "no program entries"); + + kernel_pages = page_align (high_addr - low_addr) >> 12; + + if (relocate != RELOCATE_FORCE) + kernel_mem = grub_efi_allocate_boot_pages (low_addr, kernel_pages); + /* Try to relocate. */ + if (! kernel_mem && relocate != RELOCATE_OFF) + { + kernel_mem = allocate_pages (align, kernel_pages, low_addr); + if (kernel_mem) + grub_printf (" Relocated at %p\n", kernel_mem); + } + if (! kernel_mem) + return grub_error (GRUB_ERR_OUT_OF_MEMORY, + "cannot allocate memory for OS"); + + /* Load every loadable segment in memory. */ + for (i = 0; i < ehdr->e_phnum; i++) + { + phdr = (Elf64_Phdr *) ((char *) buffer + ehdr->e_phoff + + i * ehdr->e_phentsize); + if (phdr->p_type == PT_LOAD) + { + grub_printf (" [paddr=%lx memsz=%lx off=%lx flags=%x]\n", + phdr->p_paddr, phdr->p_memsz, phdr->p_offset, + phdr->p_flags); + + if (grub_file_seek (file, phdr->p_offset) == -1) + return grub_error (GRUB_ERR_BAD_OS, + "invalid offset in program header"); + + if (grub_file_read (file, (void *) ((grub_uint64_t) phdr->p_paddr), + phdr->p_filesz) + != (grub_ssize_t) phdr->p_filesz) + return grub_error (GRUB_ERR_BAD_OS, + "couldn't read segment from file"); + + if (phdr->p_filesz < phdr->p_memsz) + grub_memset (((char *) ((grub_uint64_t) phdr->p_paddr) + + phdr->p_filesz), + 0, + phdr->p_memsz - phdr->p_filesz); + + /* Sync caches if necessary. */ + if (phdr->p_flags & PF_X) + grub_arch_sync_caches ((void *)phdr->p_paddr, phdr->p_memsz); + } + } + loaded = 1; + return 0; + } + + void + grub_rescue_cmd_linux (int argc, char *argv[]) + { + grub_file_t file = 0; + char buffer[GRUB_ELF_SEARCH]; + char *cmdline, *p; + grub_ssize_t len; + int i; + + grub_dl_ref (my_mod); + + grub_loader_unset (); + + if (argc == 0) + { + grub_error (GRUB_ERR_BAD_ARGUMENT, "No kernel specified"); + goto fail; + } + + file = grub_gzfile_open (argv[0], 1); + if (! file) + { + grub_error (GRUB_ERR_BAD_ARGUMENT, "Couldn't open file"); + goto fail; + } + + len = grub_file_read (file, buffer, sizeof (buffer)); + if (len < (grub_ssize_t)sizeof (Elf64_Ehdr)) + { + grub_error (GRUB_ERR_BAD_OS, "File too small"); + goto fail; + } + + grub_printf ("Loading linux: %s\n", argv[0]); + + if (grub_load_elf64 (file, buffer)) + goto fail; + + len = sizeof("BOOT_IMAGE=") + 8; + for (i = 0; i < argc; i++) + len += grub_strlen (argv[i]) + 1; + len += sizeof (struct ia64_boot_param) + 256; /* Room for extensions. */ + boot_param_pages = page_align (len) >> 12; + boot_param = grub_efi_allocate_boot_pages (0, boot_param_pages); + if (boot_param == 0) + { + grub_error (GRUB_ERR_OUT_OF_MEMORY, + "cannot allocate memory for bootparams"); + goto fail; + } + + grub_memset (boot_param, 0, len); + cmdline = ((char *)(boot_param + 1)) + 256; + + /* Build cmdline. */ + p = grub_stpcpy (cmdline, "BOOT_IMAGE"); + for (i = 0; i < argc; i++) + { + *p++ = ' '; + p = grub_stpcpy (p, argv[i]); + } + cmdline[10] = '='; + + boot_param->command_line = (grub_uint64_t)cmdline; + boot_param->efi_systab = (grub_uint64_t)grub_efi_system_table; + + grub_errno = GRUB_ERR_NONE; + + grub_loader_set (grub_linux_boot, grub_linux_unload, 1); + + fail: + if (file) + grub_file_close (file); + + if (grub_errno != GRUB_ERR_NONE) + { + grub_efi_free_boot_pages ((grub_efi_physical_address_t)boot_param, + boot_param_pages); + grub_dl_unref (my_mod); + } + } + + void + grub_rescue_cmd_initrd (int argc, char *argv[]) + { + grub_file_t file = 0; + + if (argc == 0) + { + grub_error (GRUB_ERR_BAD_ARGUMENT, "No module specified"); + goto fail; + } + + if (! loaded) + { + grub_error (GRUB_ERR_BAD_ARGUMENT, "You need to load the kernel first."); + goto fail; + } + + file = grub_gzfile_open (argv[0], 1); + if (! file) + goto fail; + + grub_printf ("Loading initrd: %s\n",argv[0]); + + initrd_size = grub_file_size (file); + initrd_pages = (page_align (initrd_size) >> 12); + initrd_mem = grub_efi_allocate_boot_pages (0, initrd_pages); + if (! initrd_mem) + grub_fatal ("cannot allocate pages"); + + if (grub_file_read (file, initrd_mem, initrd_size) + != (grub_ssize_t)initrd_size) + { + grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file"); + goto fail; + } + + grub_printf (" [addr=0x%lx, size=0x%lx]\n", + (grub_uint64_t)initrd_mem, initrd_size); + + fail: + if (file) + grub_file_close (file); + } + + void + grub_rescue_cmd_module (int argc, char *argv[]) + { + grub_file_t file = 0; + grub_ssize_t size, len = 0; + char *module = 0, *cmdline = 0, *p; + struct ia64_boot_module *mod = NULL; + int i; + + if (argc == 0) + { + grub_error (GRUB_ERR_BAD_ARGUMENT, "No module specified"); + goto fail; + } + + if (!boot_param) + { + grub_error (GRUB_ERR_BAD_ARGUMENT, + "You need to load the multiboot kernel first"); + goto fail; + } + + file = grub_gzfile_open (argv[0], 1); + if (! file) + goto fail; + + size = grub_file_size (file); + module = grub_efi_allocate_boot_pages (0, page_align (size) >> 12); + if (! module) + goto fail; + + if (grub_file_read (file, module, size) != size) + { + grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file"); + goto fail; + } + + len = sizeof (struct ia64_boot_module); + for (i = 0; i < argc; i++) + len += grub_strlen (argv[i]) + 1; + + if (len > 4096) + { + grub_error (GRUB_ERR_OUT_OF_RANGE, "module command line too long"); + goto fail; + } + mod = grub_efi_allocate_boot_pages (0, 1); + if (! mod) + goto fail; + + p = (char *)(mod + 1); + + mod->mod_start = (grub_uint64_t)module; + mod->mod_end = (grub_uint64_t)module + size; + mod->cmdline = (grub_uint64_t)p; + mod->next = 0; + + if (last_module) + last_module->next = (grub_uint64_t)mod; + else + { + last_module = mod; + boot_param->modules_chain = (grub_uint64_t)mod; + } + boot_param->modules_nbr++; + + grub_printf ("Module %s [addr=%llx + %lx]\n", + argv[0], (grub_uint64_t)module, size); + + /* Copy command line. */ + for (i = 0; i < argc; i++) + { + p = grub_stpcpy (p, argv[i]); + *(p++) = ' '; + } + + /* Remove the space after the last word. */ + *(--p) = '\0'; + + + fail: + if (file) + grub_file_close (file); + + if (grub_errno != GRUB_ERR_NONE) + { + grub_free (module); + grub_free (cmdline); + } + } + + void + grub_rescue_cmd_relocate (int argc, char *argv[]) + { + static const char * const vals[] = { "off", "on", "force"}; + unsigned int i; + + if (argc == 0) + { + grub_printf ("relocate is %s\n", vals[relocate]); + } + else if (argc == 1) + { + if (kernel_mem != NULL) + grub_printf ("Warning: kernel already loaded!\n"); + for (i = 0; i < sizeof (vals)/sizeof(vals[0]); i++) + if (grub_strcmp (argv[0], vals[i]) == 0) + { + relocate = i; + return; + } + grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown relocate value"); + } + else + { + grub_error (GRUB_ERR_BAD_ARGUMENT, "accept 0 or 1 argument"); + } + } + + + void + grub_rescue_cmd_fpswa (int argc, char *argv[] __attribute__((unused))) + { + if (argc != 0) + { + grub_error (GRUB_ERR_BAD_ARGUMENT, "Arguments not expected"); + return; + } + query_fpswa (); + if (fpswa == NULL) + grub_printf ("No FPSWA loaded\n"); + else + grub_printf ("FPSWA revision: %x\n", fpswa->revision); + } + + static void + grub_linux_init (grub_dl_t mod) + { + grub_rescue_register_command ("linux", + grub_rescue_cmd_linux, + "load linux"); + grub_rescue_register_command ("initrd", + grub_rescue_cmd_initrd, + "load initrd"); + grub_rescue_register_command ("module", grub_rescue_cmd_module, + "load a multiboot module"); + grub_rescue_register_command ("relocate", grub_rescue_cmd_relocate, + "set relocate feature"); + grub_rescue_register_command ("fpswa", grub_rescue_cmd_fpswa, + "load fpswa"); + my_mod = mod; + } + + static void + grub_linux_fini (void) + { + grub_rescue_unregister_command ("linux"); + grub_rescue_unregister_command ("initrd"); + grub_rescue_unregister_command ("module"); + grub_rescue_unregister_command ("relocate"); + grub_rescue_unregister_command ("fpswa"); + } + + GRUB_MODULE(linux, grub_linux_init, grub_linux_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/loader/ia64/linux_normal.c grub-1.94/loader/ia64/linux_normal.c *** grub-1.94.orig/loader/ia64/linux_normal.c Thu Jan 1 01:00:00 1970 --- grub-1.94/loader/ia64/linux_normal.c Tue Sep 5 09:44:42 2006 *************** *** 0 **** --- 1,112 ---- + /* linux_normal.c - boot linux */ + /* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2004,2005,2006 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + #include + #include + #include + #include + + static grub_err_t + grub_normal_linux_command (struct grub_arg_list *state __attribute__ ((unused)), + int argc, char **args) + { + grub_rescue_cmd_linux (argc, args); + return grub_errno; + } + + + static grub_err_t + grub_normal_initrd_command (struct grub_arg_list *state __attribute__ ((unused)), + int argc, char **args) + { + grub_rescue_cmd_initrd (argc, args); + return grub_errno; + } + + static grub_err_t + grub_normal_cmd_module (struct grub_arg_list *state __attribute__ ((unused)), + int argc, char **args) + { + grub_rescue_cmd_module (argc, args); + return grub_errno; + } + + static grub_err_t + grub_normal_cmd_relocate (struct grub_arg_list *state __attribute__ ((unused)), + int argc, char **args) + { + grub_rescue_cmd_relocate (argc, args); + return grub_errno; + } + + static grub_err_t + grub_normal_cmd_fpswa (struct grub_arg_list *state __attribute__ ((unused)), + int argc, char **args) + { + grub_rescue_cmd_fpswa (argc, args); + return grub_errno; + } + + static void + grub_linux_normal_init (grub_dl_t mod) + { + (void) mod; /* To stop warning. */ + grub_register_command + ("linux", grub_normal_linux_command, + GRUB_COMMAND_FLAG_BOTH | GRUB_COMMAND_FLAG_NO_ARG_PARSE, + "linux FILE [ARGS...]", + "Load a linux kernel.", 0); + + grub_register_command + ("initrd", grub_normal_initrd_command, + GRUB_COMMAND_FLAG_BOTH | GRUB_COMMAND_FLAG_NO_ARG_PARSE, + "initrd FILE", + "Load an initrd.", 0); + + grub_register_command + ("module", grub_normal_cmd_module, + GRUB_COMMAND_FLAG_BOTH | GRUB_COMMAND_FLAG_NO_ARG_PARSE, + "module FILE [ARGS...]", + "Load a Multiboot module.", 0); + + grub_register_command + ("relocate", grub_normal_cmd_relocate, + GRUB_COMMAND_FLAG_BOTH | GRUB_COMMAND_FLAG_NO_ARG_PARSE, + "relocate [on|off|force]", + "Set relocate feature.", 0); + + grub_register_command + ("fpswa", grub_normal_cmd_fpswa, + GRUB_COMMAND_FLAG_BOTH | GRUB_COMMAND_FLAG_NO_ARG_PARSE, + "fpswa", + "Display FPSWA version.", 0); + } + + static void + grub_linux_normal_fini (void) + { + grub_unregister_command ("linux"); + grub_unregister_command ("initrd"); + grub_unregister_command ("normal"); + grub_unregister_command ("relocate"); + grub_unregister_command ("fpswa"); + } + + GRUB_MODULE(linux_normal, grub_linux_normal_init, grub_linux_normal_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/mod.c grub-1.94/mod.c *** grub-1.94.orig/mod.c Thu Jan 1 01:00:00 1970 --- grub-1.94/mod.c Tue Sep 5 10:45:42 2006 *************** *** 0 **** --- 1,28 ---- + /* Dummy modules. */ + extern void grub_init_module (char *); + extern void grub_init_modules (void); + extern char grub_gpt_partition_map_module[]; + extern char grub_fat_module[]; + extern char grub_normal_module[]; + extern char grub_ls_module[]; + extern char grub_cat_module[]; + extern char grub_help_module[]; + extern char grub_linux_module[]; + extern char grub_linux_normal_module[]; + extern char grub_memmap_module[]; + extern char grub_boot_module[]; + extern char grub_chainloader_module[]; + void grub_init_modules (void) + { + grub_init_module(grub_gpt_partition_map_module); + grub_init_module(grub_fat_module); + grub_init_module(grub_normal_module); + grub_init_module(grub_ls_module); + grub_init_module(grub_cat_module); + grub_init_module(grub_help_module); + grub_init_module(grub_linux_module); + grub_init_module(grub_linux_normal_module); + grub_init_module(grub_memmap_module); + grub_init_module(grub_boot_module); + grub_init_module(grub_chainloader_module); + } Binary files grub-1.94.orig/mod.o and grub-1.94/mod.o differ diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/normal/execute.c grub-1.94/normal/execute.c *** grub-1.94.orig/normal/execute.c Sun May 28 23:58:34 2006 --- grub-1.94/normal/execute.c Mon Sep 4 08:00:32 2006 *************** *** 148,154 **** /* Set up the option state. */ state = grub_malloc (sizeof (struct grub_arg_list) * maxargs); grub_memset (state, 0, sizeof (struct grub_arg_list) * maxargs); ! /* Start the command. */ if (! (grubcmd->flags & GRUB_COMMAND_FLAG_NO_ARG_PARSE)) { --- 148,154 ---- /* Set up the option state. */ state = grub_malloc (sizeof (struct grub_arg_list) * maxargs); grub_memset (state, 0, sizeof (struct grub_arg_list) * maxargs); ! /* Start the command. */ if (! (grubcmd->flags & GRUB_COMMAND_FLAG_NO_ARG_PARSE)) { diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/normal/ia64/longjmp.S grub-1.94/normal/ia64/longjmp.S *** grub-1.94.orig/normal/ia64/longjmp.S Thu Jan 1 01:00:00 1970 --- grub-1.94/normal/ia64/longjmp.S Thu Aug 31 11:11:24 2006 *************** *** 0 **** --- 1,162 ---- + /* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Contributed by David Mosberger-Tang . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. + + Note that __sigsetjmp() did NOT flush the register stack. Instead, + we do it here since __longjmp() is usually much less frequently + invoked than __sigsetjmp(). The only difficulty is that __sigsetjmp() + didn't (and wouldn't be able to) save ar.rnat either. This is a problem + because if we're not careful, we could end up loading random NaT bits. + There are two cases: + + (i) ar.bsp < ia64_rse_rnat_addr(jmpbuf.ar_bsp) + ar.rnat contains the desired bits---preserve ar.rnat + across loadrs and write to ar.bspstore + + (ii) ar.bsp >= ia64_rse_rnat_addr(jmpbuf.ar_bsp) + The desired ar.rnat is stored in + ia64_rse_rnat_addr(jmpbuf.ar_bsp). Load those + bits into ar.rnat after setting ar.bspstore. */ + + + + # define pPos p6 /* is rotate count positive? */ + # define pNeg p7 /* is rotate count negative? */ + + + /* __longjmp(__jmp_buf buf, int val) */ + + .text + .global grub_longjmp + .proc grub_longjmp + grub_longjmp: + alloc r8=ar.pfs,2,1,0,0 + mov r27=ar.rsc + add r2=0x98,in0 // r2 <- &jmpbuf.orig_jmp_buf_addr + ;; + ld8 r8=[r2],-16 // r8 <- orig_jmp_buf_addr + mov r10=ar.bsp + and r11=~0x3,r27 // clear ar.rsc.mode + ;; + flushrs // flush dirty regs to backing store (must be first in insn grp) + ld8 r23=[r2],8 // r23 <- jmpbuf.ar_bsp + sub r8=r8,in0 // r8 <- &orig_jmpbuf - &jmpbuf + ;; + ld8 r25=[r2] // r25 <- jmpbuf.ar_unat + extr.u r8=r8,3,6 // r8 <- (&orig_jmpbuf - &jmpbuf)/8 & 0x3f + ;; + cmp.lt pNeg,pPos=r8,r0 + mov r2=in0 + ;; + (pPos) mov r16=r8 + (pNeg) add r16=64,r8 + (pPos) sub r17=64,r8 + (pNeg) sub r17=r0,r8 + ;; + mov ar.rsc=r11 // put RSE in enforced lazy mode + shr.u r8=r25,r16 + add r3=8,in0 // r3 <- &jmpbuf.r1 + shl r9=r25,r17 + ;; + or r25=r8,r9 + ;; + mov r26=ar.rnat + mov ar.unat=r25 // setup ar.unat (NaT bits for r1, r4-r7, and r12) + ;; + ld8.fill.nta sp=[r2],16 // r12 (sp) + ld8.fill.nta gp=[r3],16 // r1 (gp) + dep r11=-1,r23,3,6 // r11 <- ia64_rse_rnat_addr(jmpbuf.ar_bsp) + ;; + ld8.nta r16=[r2],16 // caller's unat + ld8.nta r17=[r3],16 // fpsr + ;; + ld8.fill.nta r4=[r2],16 // r4 + ld8.fill.nta r5=[r3],16 // r5 (gp) + cmp.geu p8,p0=r10,r11 // p8 <- (ar.bsp >= jmpbuf.ar_bsp) + ;; + ld8.fill.nta r6=[r2],16 // r6 + ld8.fill.nta r7=[r3],16 // r7 + ;; + mov ar.unat=r16 // restore caller's unat + mov ar.fpsr=r17 // restore fpsr + ;; + ld8.nta r16=[r2],16 // b0 + ld8.nta r17=[r3],16 // b1 + ;; + (p8) ld8 r26=[r11] // r26 <- *ia64_rse_rnat_addr(jmpbuf.ar_bsp) + mov ar.bspstore=r23 // restore ar.bspstore + ;; + ld8.nta r18=[r2],16 // b2 + ld8.nta r19=[r3],16 // b3 + ;; + ld8.nta r20=[r2],16 // b4 + ld8.nta r21=[r3],16 // b5 + ;; + ld8.nta r11=[r2],16 // ar.pfs + ld8.nta r22=[r3],56 // ar.lc + ;; + ld8.nta r24=[r2],32 // pr + mov b0=r16 + ;; + ldf.fill.nta f2=[r2],32 + ldf.fill.nta f3=[r3],32 + mov b1=r17 + ;; + ldf.fill.nta f4=[r2],32 + ldf.fill.nta f5=[r3],32 + mov b2=r18 + ;; + ldf.fill.nta f16=[r2],32 + ldf.fill.nta f17=[r3],32 + mov b3=r19 + ;; + ldf.fill.nta f18=[r2],32 + ldf.fill.nta f19=[r3],32 + mov b4=r20 + ;; + ldf.fill.nta f20=[r2],32 + ldf.fill.nta f21=[r3],32 + mov b5=r21 + ;; + ldf.fill.nta f22=[r2],32 + ldf.fill.nta f23=[r3],32 + mov ar.lc=r22 + ;; + ldf.fill.nta f24=[r2],32 + ldf.fill.nta f25=[r3],32 + cmp.eq p8,p9=0,in1 + ;; + ldf.fill.nta f26=[r2],32 + ldf.fill.nta f27=[r3],32 + mov ar.pfs=r11 + ;; + ldf.fill.nta f28=[r2],32 + ldf.fill.nta f29=[r3],32 + ;; + ldf.fill.nta f30=[r2] + ldf.fill.nta f31=[r3] + (p8) mov r8=1 + + mov ar.rnat=r26 // restore ar.rnat + ;; + mov ar.rsc=r27 // restore ar.rsc + (p9) mov r8=in1 + + invala // virt. -> phys. regnum mapping may change + mov pr=r24,-1 + br.ret.dptk.few rp + .endp grub_longjmp diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/normal/ia64/setjmp.S grub-1.94/normal/ia64/setjmp.S *** grub-1.94.orig/normal/ia64/setjmp.S Thu Jan 1 01:00:00 1970 --- grub-1.94/normal/ia64/setjmp.S Thu Aug 31 11:09:58 2006 *************** *** 0 **** --- 1,171 ---- + /* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Contributed by David Mosberger-Tang . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. + + The layout of the jmp_buf is as follows. This is subject to change + and user-code should never depend on the particular layout of + jmp_buf! + + + offset: description: + ------- ------------ + 0x000 stack pointer (r12) ; unchangeable (see _JMPBUF_UNWINDS) + 0x008 r1 (gp) + 0x010 caller's unat + 0x018 fpsr + 0x020 r4 + 0x028 r5 + 0x030 r6 + 0x038 r7 + 0x040 rp (b0) + 0x048 b1 + 0x050 b2 + 0x058 b3 + 0x060 b4 + 0x068 b5 + 0x070 ar.pfs + 0x078 ar.lc + 0x080 pr + 0x088 ar.bsp ; unchangeable (see __longjmp.S) + 0x090 ar.unat + 0x098 &__jmp_buf ; address of the jmpbuf (needed to locate NaT bits in unat) + 0x0a0 f2 + 0x0b0 f3 + 0x0c0 f4 + 0x0d0 f5 + 0x0e0 f16 + 0x0f0 f17 + 0x100 f18 + 0x110 f19 + 0x120 f20 + 0x130 f21 + 0x130 f22 + 0x140 f23 + 0x150 f24 + 0x160 f25 + 0x170 f26 + 0x180 f27 + 0x190 f28 + 0x1a0 f29 + 0x1b0 f30 + 0x1c0 f31 */ + + + /* The following two entry points are the traditional entry points: */ + + .text + .global grub_setjmp + .proc grub_setjmp + grub_setjmp: + alloc r8=ar.pfs,2,0,0,0 + mov in1=1 + br.cond.sptk.many __sigsetjmp + .endp grub_setjmp + + /* __sigsetjmp(__jmp_buf buf, int savemask) */ + + .proc __sigsetjmp + __sigsetjmp: + //.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2) + alloc loc1=ar.pfs,2,2,2,0 + mov r16=ar.unat + ;; + mov r17=ar.fpsr + mov r2=in0 + add r3=8,in0 + ;; + st8.spill.nta [r2]=sp,16 // r12 (sp) + st8.spill.nta [r3]=gp,16 // r1 (gp) + ;; + st8.nta [r2]=r16,16 // save caller's unat + st8.nta [r3]=r17,16 // save fpsr + add r8=0xa0,in0 + ;; + st8.spill.nta [r2]=r4,16 // r4 + st8.spill.nta [r3]=r5,16 // r5 + add r9=0xb0,in0 + ;; + stf.spill.nta [r8]=f2,32 + stf.spill.nta [r9]=f3,32 + mov loc0=rp + .body + ;; + stf.spill.nta [r8]=f4,32 + stf.spill.nta [r9]=f5,32 + mov r17=b1 + ;; + stf.spill.nta [r8]=f16,32 + stf.spill.nta [r9]=f17,32 + mov r18=b2 + ;; + stf.spill.nta [r8]=f18,32 + stf.spill.nta [r9]=f19,32 + mov r19=b3 + ;; + stf.spill.nta [r8]=f20,32 + stf.spill.nta [r9]=f21,32 + mov r20=b4 + ;; + stf.spill.nta [r8]=f22,32 + stf.spill.nta [r9]=f23,32 + mov r21=b5 + ;; + stf.spill.nta [r8]=f24,32 + stf.spill.nta [r9]=f25,32 + mov r22=ar.lc + ;; + stf.spill.nta [r8]=f26,32 + stf.spill.nta [r9]=f27,32 + mov r24=pr + ;; + stf.spill.nta [r8]=f28,32 + stf.spill.nta [r9]=f29,32 + ;; + stf.spill.nta [r8]=f30 + stf.spill.nta [r9]=f31 + + st8.spill.nta [r2]=r6,16 // r6 + st8.spill.nta [r3]=r7,16 // r7 + ;; + mov r23=ar.bsp + mov r25=ar.unat + mov out0=in0 + + st8.nta [r2]=loc0,16 // b0 + st8.nta [r3]=r17,16 // b1 + mov out1=in1 + ;; + st8.nta [r2]=r18,16 // b2 + st8.nta [r3]=r19,16 // b3 + ;; + st8.nta [r2]=r20,16 // b4 + st8.nta [r3]=r21,16 // b5 + ;; + st8.nta [r2]=loc1,16 // ar.pfs + st8.nta [r3]=r22,16 // ar.lc + ;; + st8.nta [r2]=r24,16 // pr + st8.nta [r3]=r23,16 // ar.bsp + ;; + st8.nta [r2]=r25 // ar.unat + st8.nta [r3]=in0 // &__jmp_buf + mov r8=0 + mov rp=loc0 + mov ar.pfs=loc1 + br.ret.sptk.many rp + + .endp __sigsetjmp diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/normal/main.c grub-1.94/normal/main.c *** grub-1.94.orig/normal/main.c Sun May 7 20:28:24 2006 --- grub-1.94/normal/main.c Mon Sep 4 09:26:20 2006 *************** *** 168,179 **** grub_err_t getline (char **line) { ! char cmdline[100]; currline++; if (! get_line (file, cmdline, sizeof (cmdline))) return 0; ! *line = grub_strdup (cmdline); if (! *line) return grub_errno; --- 168,179 ---- grub_err_t getline (char **line) { ! char cmdline[256]; currline++; if (! get_line (file, cmdline, sizeof (cmdline))) return 0; ! *line = grub_strdup (cmdline); if (! *line) return grub_errno; *************** *** 181,187 **** return GRUB_ERR_NONE; } ! char cmdline[100]; grub_menu_t newmenu; newmenu = grub_malloc (sizeof (*newmenu)); --- 181,187 ---- return GRUB_ERR_NONE; } ! char cmdline[256]; grub_menu_t newmenu; newmenu = grub_malloc (sizeof (*newmenu)); *************** *** 252,260 **** void grub_normal_init_page (void) { ! grub_cls (); ! grub_printf ("\n\ ! GNU GRUB version %s\n\n", PACKAGE_VERSION); } --- 252,260 ---- void grub_normal_init_page (void) { ! //grub_cls (); ! grub_printf ("\n" ! " GNU GRUB version %s\n\n", PACKAGE_VERSION); } *************** *** 466,472 **** grub_enter_normal_mode (argv[0]); } ! GRUB_MOD_INIT(normal) { /* Normal mode shouldn't be unloaded. */ if (mod) --- 466,473 ---- grub_enter_normal_mode (argv[0]); } ! static void ! grub_normal_init (grub_dl_t mod) { /* Normal mode shouldn't be unloaded. */ if (mod) *************** *** 482,490 **** grub_command_init (); } ! GRUB_MOD_FINI(normal) { grub_set_history (0); grub_rescue_unregister_command ("normal"); } --- 483,493 ---- grub_command_init (); } ! static void ! grub_normal_fini (void) { grub_set_history (0); grub_rescue_unregister_command ("normal"); } + GRUB_MODULE(normal,grub_normal_init,grub_normal_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/partmap/acorn.c grub-1.94/partmap/acorn.c *** grub-1.94.orig/partmap/acorn.c Wed Nov 23 03:44:34 2005 --- grub-1.94/partmap/acorn.c Thu Aug 31 08:59:44 2006 *************** *** 195,206 **** .get_name = acorn_partition_map_get_name }; ! GRUB_MOD_INIT(acorn_partition_map) { grub_partition_map_register (&grub_acorn_partition_map); } ! GRUB_MOD_FINI(acorn_partition_map) { grub_partition_map_unregister (&grub_acorn_partition_map); } --- 195,211 ---- .get_name = acorn_partition_map_get_name }; ! static void ! grub_acorn_partition_map_init (grub_dl_t mod) { grub_partition_map_register (&grub_acorn_partition_map); } ! static void ! grub_acorn_partition_map_fini (void) { grub_partition_map_unregister (&grub_acorn_partition_map); } + + GRUB_MODULE(acorn_partition_map, + grub_acorn_partition_map_init, grub_acorn_partition_map_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/partmap/amiga.c grub-1.94/partmap/amiga.c *** grub-1.94.orig/partmap/amiga.c Sun Nov 13 16:47:09 2005 --- grub-1.94/partmap/amiga.c Thu Aug 31 08:58:47 2006 *************** *** 211,217 **** .get_name = amiga_partition_map_get_name }; ! GRUB_MOD_INIT(amiga_partition_map) { grub_partition_map_register (&grub_amiga_partition_map); #ifndef GRUB_UTIL --- 211,218 ---- .get_name = amiga_partition_map_get_name }; ! static void ! grub_amiga_partition_map_init (grub_dl_t mod) { grub_partition_map_register (&grub_amiga_partition_map); #ifndef GRUB_UTIL *************** *** 219,225 **** #endif } ! GRUB_MOD_FINI(amiga_partition_map) { grub_partition_map_unregister (&grub_amiga_partition_map); } --- 220,230 ---- #endif } ! static void ! grub_amiga_partition_map_fini (void) { grub_partition_map_unregister (&grub_amiga_partition_map); } + + GRUB_MODULE(amiga_partition_map, + grub_amiga_partition_map_init, grub_amiga_partition_map_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/partmap/apple.c grub-1.94/partmap/apple.c *** grub-1.94.orig/partmap/apple.c Tue Jan 3 17:02:18 2006 --- grub-1.94/partmap/apple.c Thu Aug 31 08:59:00 2006 *************** *** 222,228 **** .get_name = apple_partition_map_get_name }; ! GRUB_MOD_INIT(apple_partition_map) { grub_partition_map_register (&grub_apple_partition_map); #ifndef GRUB_UTIL --- 222,229 ---- .get_name = apple_partition_map_get_name }; ! static void ! grub_apple_partition_map_init (grub_dl_t mod) { grub_partition_map_register (&grub_apple_partition_map); #ifndef GRUB_UTIL *************** *** 230,237 **** #endif } ! GRUB_MOD_FINI(apple_partition_map) { grub_partition_map_unregister (&grub_apple_partition_map); } --- 231,242 ---- #endif } ! static void ! grub_apple_partition_map_fini (void) { grub_partition_map_unregister (&grub_apple_partition_map); } + + GRUB_MODULE(apple_partition_map, + grub_apple_partition_map_init, grub_apple_partition_map_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/partmap/gpt.c grub-1.94/partmap/gpt.c *** grub-1.94.orig/partmap/gpt.c Tue Apr 25 22:08:31 2006 --- grub-1.94/partmap/gpt.c Thu Aug 31 08:45:13 2006 *************** *** 62,70 **** static struct grub_partition_map grub_gpt_partition_map; - #ifndef GRUB_UTIL static grub_dl_t my_mod; - #endif --- 62,68 ---- *************** *** 213,227 **** .get_name = gpt_partition_map_get_name }; ! GRUB_MOD_INIT(gpt_partition_map) { grub_partition_map_register (&grub_gpt_partition_map); - #ifndef GRUB_UTIL my_mod = mod; - #endif } ! GRUB_MOD_FINI(gpt_partition_map) { grub_partition_map_unregister (&grub_gpt_partition_map); } --- 211,227 ---- .get_name = gpt_partition_map_get_name }; ! static void ! grub_gpt_init (grub_dl_t mod) { grub_partition_map_register (&grub_gpt_partition_map); my_mod = mod; } ! static void ! grub_gpt_fini (void) { grub_partition_map_unregister (&grub_gpt_partition_map); } + + GRUB_MODULE(gpt_partition_map,grub_gpt_init,grub_gpt_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/partmap/pc.c grub-1.94/partmap/pc.c *** grub-1.94.orig/partmap/pc.c Sat Dec 3 18:54:55 2005 --- grub-1.94/partmap/pc.c Thu Aug 31 08:59:13 2006 *************** *** 300,306 **** .get_name = pc_partition_map_get_name }; ! GRUB_MOD_INIT(pc_partition_map) { grub_partition_map_register (&grub_pc_partition_map); #ifndef GRUB_UTIL --- 300,307 ---- .get_name = pc_partition_map_get_name }; ! static void ! grub_pc_partition_map_init (grub_dl_t mod) { grub_partition_map_register (&grub_pc_partition_map); #ifndef GRUB_UTIL *************** *** 308,314 **** #endif } ! GRUB_MOD_FINI(pc_partition_map) { grub_partition_map_unregister (&grub_pc_partition_map); } --- 309,319 ---- #endif } ! static void ! grub_pc_partition_map_fini (void) { grub_partition_map_unregister (&grub_pc_partition_map); } + + GRUB_MODULE(pc_partition_map, + grub_pc_partition_map_init, grub_pc_partition_map_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/partmap/sun.c grub-1.94/partmap/sun.c *** grub-1.94.orig/partmap/sun.c Sun Nov 13 16:47:09 2005 --- grub-1.94/partmap/sun.c Thu Aug 31 08:59:26 2006 *************** *** 192,198 **** .get_name = sun_partition_map_get_name }; ! GRUB_MOD_INIT(sun_partition_map) { grub_partition_map_register (&grub_sun_partition_map); #ifndef GRUB_UTIL --- 192,199 ---- .get_name = sun_partition_map_get_name }; ! static void ! grub_sun_partition_map_init (grub_dl_t mod) { grub_partition_map_register (&grub_sun_partition_map); #ifndef GRUB_UTIL *************** *** 200,207 **** #endif } ! GRUB_MOD_FINI(sun_partition_map) { grub_partition_map_unregister (&grub_sun_partition_map); } --- 201,212 ---- #endif } ! static void ! grub_sun_partition_map_fini (void) { grub_partition_map_unregister (&grub_sun_partition_map); } + + GRUB_MODULE(sun_partition_map, + grub_sun_partition_map_init, grub_sun_partition_map_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/term/terminfo.c grub-1.94/term/terminfo.c *** grub-1.94.orig/term/terminfo.c Sun Nov 13 16:47:09 2005 --- grub-1.94/term/terminfo.c Thu Aug 31 09:01:56 2006 *************** *** 174,180 **** return grub_terminfo_set_current (args[0]); } ! GRUB_MOD_INIT(terminfo) { (void) mod; /* To stop warning. */ grub_register_command ("terminfo", grub_cmd_terminfo, GRUB_COMMAND_FLAG_BOTH, --- 174,181 ---- return grub_terminfo_set_current (args[0]); } ! static void ! grub_terminfo_init (grub_dl_t mod) { (void) mod; /* To stop warning. */ grub_register_command ("terminfo", grub_cmd_terminfo, GRUB_COMMAND_FLAG_BOTH, *************** *** 182,188 **** grub_terminfo_set_current ("vt100"); } ! GRUB_MOD_FINI(terminfo) { grub_unregister_command ("terminfo"); } --- 183,192 ---- grub_terminfo_set_current ("vt100"); } ! static void ! grub_terminfo_fini (void) { grub_unregister_command ("terminfo"); } + + GRUB_MODULE(terminfo, grub_terminfo_init, grub_terminfo_fini); diff -rcN -x '*~' -x ia64-efi.mk grub-1.94.orig/util/ia64/efi/grub-install.in grub-1.94/util/ia64/efi/grub-install.in *** grub-1.94.orig/util/ia64/efi/grub-install.in Thu Jan 1 01:00:00 1970 --- grub-1.94/util/ia64/efi/grub-install.in Fri Sep 1 08:25:53 2006 *************** *** 0 **** --- 1,228 ---- + #! /bin/sh + + # Install GRUB on your drive. + # Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006 Free Software Foundation, Inc. + # + # This file is free software; you can redistribute it and/or modify it + # under the terms of the GNU General Public License as published by + # the Free Software Foundation; either version 2 of the License, or + # (at your option) any later version. + # + # This program is distributed in the hope that it will be useful, but + # WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # General Public License for more details. + # + # You should have received a copy of the GNU General Public License + # along with this program; if not, write to the Free Software + # Foundation, Inc., 51 Franklin St - Suite 330, Boston, MA 02110, USA. + + # Initialize some variables. + prefix=@prefix@ + exec_prefix=@exec_prefix@ + sbindir=@sbindir@ + bindir=@bindir@ + libdir=@libdir@ + PACKAGE_NAME=@PACKAGE_NAME@ + PACKAGE_TARNAME=@PACKAGE_TARNAME@ + PACKAGE_VERSION=@PACKAGE_VERSION@ + target_cpu=@target_cpu@ + platform=@platform@ + pkglibdir=${libdir}/${PACKAGE_TARNAME}/${target_cpu}-${platform} + + TARGET_CC=@TARGET_CC@ + TARGET_CFLAGS="@TARGET_CFLAGS@" + TARGET_CPPFLAGS="@TARGET_CPPFLAGS@" + TARGET_LDFLAGS="@TARGET_LDFLAGS@" + OBJCOPY=@OBJCOPY@ + + grub_setup=${sbindir}/grub-setup + grub_mkimage=${bindir}/grub-mkimage + grub_mkdevicemap=${sbindir}/grub-mkdevicemap + grub_probefs=${sbindir}/grub-probefs + rootdir= + grub_prefix=/boot/grub + modules= + + install_device= + recheck=no + debug=no + + # Usage: usage + # Print the usage. + usage () { + cat <. + EOF + } + + # Check the arguments. + for option in "$@"; do + case "$option" in + -h | --help) + usage + exit 0 ;; + -v | --version) + echo "grub-install (GNU GRUB ${PACKAGE_VERSION})" + exit 0 ;; + --modules=*) + modules=`echo "$option" | sed 's/--modules=//'` ;; + --root-directory=*) + rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; + --grub-setup=*) + grub_setup=`echo "$option" | sed 's/--grub-setup=//'` ;; + --grub-mkimage=*) + grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; + --grub-mkdevicemap=*) + grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;; + --grub-probefs=*) + grub_probefs=`echo "$option" | sed 's/--grub-probefs=//'` ;; + --pkglibdir=*) + pkglibdir=`echo "$option" | sed 's/--pkglibdir=//'` ;; + --recheck) + recheck=yes ;; + # This is an undocumented feature... + --debug) + debug=yes ;; + -*) + echo "Unrecognized option \`$option'" 1>&2 + usage + exit 1 + ;; + *) + if test "x$install_device" != x; then + echo "More than one install_devices?" 1>&2 + usage + exit 1 + fi + install_device="${option}" ;; + esac + done + + if test "x$install_device" = x; then + echo "install_device not specified." 1>&2 + usage + exit 1 + fi + + # If the debugging feature is enabled, print commands. + if test $debug = yes; then + set -x + fi + + # Initialize these directories here, since ROOTDIR was initialized. + bootdir=${rootdir}/boot/efi + + grubdir=${bootdir}/grub + device_map=${grubdir}/device.map + + # Create the GRUB directory if it is not present. + test -d "$bootdir" || mkdir "$bootdir" || exit 1 + test -d "$grubdir" || mkdir "$grubdir" || exit 1 + + # Copy the GRUB images to the GRUB directory. + if false; then + for file in ${grubdir}/*.mod ${grubdir}/*.lst; do + if test -f $file; then + rm -f $file || exit 1 + fi + done + for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst; do + cp -f $file ${grubdir} || exit 1 + done + fi + + # Create the core image. First, auto-detect the filesystme module. + #fs_module=`$grub_probefs --device-map=${device_map} ${grubdir}` + if test "x$fs_module" = x -a "x$modules" = x; then + echo "Auto-detection of a filesystem module failed." 1>&2 + echo "Please specify the module with the option \`--modules' explicitly." 1>&2 + # exit 1 + fi + + # Typically, _chain and pc are required. + modules="$modules $fs_module _chain" + + modules="kernel gzio gpt fat normal ls cat fshelp help _linux linux memmap boot $modules" + + if true; then + echo "/* Dummy modules. */" > mod.c + list="" + for m in $modules; do + name=`nm ${m}.mod | grep -e " D grub_.*_module$" | sed -e "s/.* D //"` + list="$list $name" + done + echo "extern void grub_init_module (char *);" >> mod.c + echo "extern void grub_init_modules (void);" >> mod.c + for m in $list; do + echo "extern char $m[];" >> mod.c + done + echo "void grub_init_modules (void)" >> mod.c + echo "{" >> mod.c + for m in $list; do + echo " grub_init_module($m);" >> mod.c + done + echo "}" >> mod.c + fi + + $TARGET_CC -c $TARGET_CFLAGS -o mod.o mod.c + + mod_objs= + for m in $modules; do mod_objs="$mod_objs $m.mod"; done + + ld -nostdlib -T kern/ia64/elf_ia64_efi.lds -shared -Bsymbolic \ + $mod_objs mod.o -o grub.so + + syms=`nm grub.so | grep " U "` + + if test x"$syms" != x; then + echo "Unresolved symbols:" + echo $syms + exit 1 + fi + + objcopy -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \ + -j .rela -j .reloc --target=efi-app-ia64 grub.so grub.efi + + echo "grub.efi generated" + + exit 0 + + $grub_mkimage --output=${grubdir}/core.img $modules || exit 1 + + # Now perform the installation. + $grub_setup --directory=${grubdir} --device-map=${device_map} \ + ${install_device} || exit 1 + + # Prompt the user to check if the device map is correct. + echo "Installation finished. No error reported." + echo "This is the contents of the device map $device_map." + echo "Check if this is correct or not. If any of the lines is incorrect," + echo "fix it and re-run the script \`grub-install'." + echo + + cat $device_map + + # Bye. + exit 0