All of lore.kernel.org
 help / color / mirror / Atom feed
* RE: Grub for ia64
@ 2006-10-11 11:43 Mao, Bibo
  2006-10-12  8:21 ` Tristan Gingold
  0 siblings, 1 reply; 26+ messages in thread
From: Mao, Bibo @ 2006-10-11 11:43 UTC (permalink / raw)
  To: The development of GRUB 2

On IA64 module supporting is very complicated, I do not know whether
Grub2 can provide configuration file to compile command module with 
both compile-in mode or module mode.

If commands are compiled with compile-in mode, then there may be only
one image and there is no need to relocate module.

Thanks
Bibo,mao

>-----Original Message-----
>From: grub-devel-bounces+bibo.mao=intel.com@gnu.org
>[mailto:grub-devel-bounces+bibo.mao=intel.com@gnu.org] On Behalf Of Johan
>Rydberg
>Sent: 2006年10月11日 19:20
>To: The development of GRUB 2
>Subject: Re: Grub for ia64
>
>Jeff Bailey <jbailey@raspberryginger.com> writes:
>
>>> > Anyhow, when I get a few more minutes over I'll try to review your
>>> > patches more in depth.
>>>
>>> A few comments;
>>>
>>>  * Would it be possible for you to rewrite kern/ia64/efi/startup.S,
>>>    so that you hold the copyright for it?
>>>
>>>  * Same goes for kern/ia64/efi/reloc_ia64.S.
>>
>> Who holds the copyright now?  If it's folks at HP, we can probably get a
>> disclaimer for it.
>
>Some files are both copyrighted by both HP and Mosberger-Tang:
>
>+  * Copyright (C) 2000 Hewlett-Packard Co
>+  * Copyright (C) 2000 David Mosberger-Tang <davidm@hpl.hp.com>
>
>Files that are from the GNU EFI package seem to be just copyrighted by
>HP:
>
>+    Copyright (C) 1999 Hewlett-Packard Co.
>+ 	Contributed by David Mosberger <davidm@hpl.hp.com>.
>
>How would one go about to get a disclaimer for them?
>
>~j



^ permalink raw reply	[flat|nested] 26+ messages in thread
* RE: Grub for ia64
@ 2006-10-12 12:50 Mao, Bibo
  0 siblings, 0 replies; 26+ messages in thread
From: Mao, Bibo @ 2006-10-12 12:50 UTC (permalink / raw)
  To: The development of GRUB 2

It is reasonable to write a converter porting from util/i386/efi/grub-mkimage.c, I have one patch for x84_64, I am waiting for approval for FSF license. IA64 should be much complicated because IA64 relocation type is hairy.

Thanks
Bibo,mao

>-----Original Message-----
>From: grub-devel-bounces+bibo.mao=intel.com@gnu.org
>[mailto:grub-devel-bounces+bibo.mao=intel.com@gnu.org] On Behalf Of Johan
>Rydberg
>Sent: 2006年10月12日 20:12
>To: The development of GRUB 2
>Subject: Re: Grub for ia64
>
>Tristan Gingold <tgingold@free.fr> writes:
>
>>> You're telling me that EFI on your IA-64 system does not relocate the
>>> program before start executing it?  That sounds strange.
>>
>> It does relocate EFI PEI images.  Unfortunatly there is no tools to create
>> EFI PEI objects on Linux.  The gnu efi tools are kludgy: they use standard
>> gcc and ld, create an ELF image and convert it to a PEI image.  But the
>> relocations are not converted, they are simply put into the data section.
>
>How hard would it be to write a converter ourselves, starting with
>util/i386/efi/grub-mkimage.c?
>
>~j



^ permalink raw reply	[flat|nested] 26+ messages in thread
* Grub for ia64
@ 2006-09-28 11:41 tgingold
  2006-09-28 13:06 ` bibo,mao
                   ` (2 more replies)
  0 siblings, 3 replies; 26+ messages in thread
From: tgingold @ 2006-09-28 11:41 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 1048 bytes --]

Hi

this is a port of grub2 to ia64.  ia64 systems (itanium) are EFI based so this
port reuse existing EFI infrastructure.

I have made 4 patches:

efi64.diffs: fix a 64 bits issue of efi/api.h
fat.diffs: fix 64bits issues and make filename match case insensitive.

[I think most 64 bits issues have already been reported recently and
independently by the mail grub2 64bit system compatible]

ia64.diffs: ia64 specific files

modules.diffs:
currently the ia64 port cannot load modules.  This patch makes slight changes
so that grub can be completly prelinked without removing the dynamic loading
feature.
I think it is worth for three reasons:
* it makes initial port easier.
* the current common code can't work on ia64 (on ia64 a function pointer is a
descriptor and not the address of the first function instruction).
* grub-emu doesn't have dynamic modules and could reuse this work to remove
most of #ifdef/#endif GRUB_UTIL

I have also written a few additionnal EFI specific commands I will post later.

Tristan.

[-- Attachment #2: efi64.diffs --]
[-- Type: application/octet-stream, Size: 661 bytes --]

diff -rcN -x '*~' -x '*.mk' grub2.cvs/include/grub/efi/api.h grub2/include/grub/efi/api.h
*** grub2.cvs/include/grub/efi/api.h	Sat May 27 23:09:25 2006
--- grub2/include/grub/efi/api.h	Wed Sep 27 08:15:44 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)
  

[-- Attachment #3: fat.diffs --]
[-- Type: application/octet-stream, Size: 3387 bytes --]

diff -rcN -x '*~' -x '*.mk' grub2.cvs/fs/fat.c grub2/fs/fat.c
*** grub2.cvs/fs/fat.c	Sun Jun  4 17:56:54 2006
--- grub2/fs/fat.c	Wed Sep 27 08:15:44 2006
***************
*** 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)
--- 322,328 ----
    
    /* 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)
***************
*** 569,575 ****
  		  continue;
  		}
  
! 	      if (grub_strcmp (dirname, filename) == 0)
  		{
  		  if (call_hook)
  		    hook (filename, dir.attr & GRUB_FAT_ATTR_DIRECTORY);
--- 569,575 ----
  		  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);
--- 602,608 ----
  	  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);
diff -rcN -x '*~' -x '*.mk' grub2.cvs/include/grub/misc.h grub2/include/grub/misc.h
*** grub2.cvs/include/grub/misc.h	Sun Jun  4 17:56:54 2006
--- grub2/include/grub/misc.h	Wed Sep 27 08:15:44 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 '*.mk' grub2.cvs/kern/misc.c grub2/kern/misc.c
*** grub2.cvs/kern/misc.c	Sun Jun  4 17:56:54 2006
--- grub2/kern/misc.c	Wed Sep 27 08:15:44 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)
***************
*** 366,372 ****
    
    /* 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')
  	{
--- 386,392 ----
    
    /* 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')
  	{

[-- Attachment #4: ia64.diffs --]
[-- Type: application/octet-stream, Size: 85551 bytes --]

diff -rcN -x '*~' -x '*.mk' grub2.cvs/Makefile.in grub2/Makefile.in
*** grub2.cvs/Makefile.in	Mon May 29 01:01:43 2006
--- grub2/Makefile.in	Wed Sep 27 08:15:44 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) \
--- 77,83 ----
  ### 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 '*.mk' grub2.cvs/conf/ia64-efi.rmk grub2/conf/ia64-efi.rmk
*** grub2.cvs/conf/ia64-efi.rmk	Thu Jan  1 01:00:00 1970
--- grub2/conf/ia64-efi.rmk	Wed Sep 27 09:10:25 2006
***************
*** 0 ****
--- 1,144 ----
+ # -*- makefile -*-
+ 
+ COMMON_ASFLAGS = -nostdinc -fno-builtin
+ COMMON_CFLAGS = -fno-builtin -fpic
+ COMMON_LDFLAGS = -melf_64 -nostdlib 
+ 
+ STRIP_FLAGS=-R .note -R .comment -X
+ 
+ # 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
+ 
+ pkgdata_DATA += kern/ia64/efi/elf_ia64_efi.lds
+ 
+ # 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)
+ 
+ # Modules.
+ pkgdata_MODULES = kernel.mod normal.mod _chain.mod chain.mod \
+ 	_linux.mod linux.mod memmap.mod systab.mod
+ 
+ # For kernel.mod.
+ kernel_mod_EXPORTS = no
+ kernel_mod_SOURCES = kern/ia64/efi/startup.S kern/ia64/efi/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)
+ 
+ # For systab.mod.
+ systab_mod_SOURCES = commands/efi/systab.c
+ systab_mod_CFLAGS = $(COMMON_CFLAGS)
+ systab_mod_LDFLAGS = $(COMMON_LDFLAGS)
+ 
+ include $(srcdir)/conf/common.mk
diff -rcN -x '*~' -x '*.mk' grub2.cvs/configure grub2/configure
*** grub2.cvs/configure	Wed Jul 12 22:42:52 2006
--- grub2/configure	Wed Sep 27 08:15:44 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 '*.mk' grub2.cvs/configure.ac grub2/configure.ac
*** grub2.cvs/configure.ac	Wed Jul 12 22:42:52 2006
--- grub2/configure.ac	Wed Sep 27 08:15:44 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 '*.mk' grub2.cvs/include/grub/ia64/efi/console.h grub2/include/grub/ia64/efi/console.h
*** grub2.cvs/include/grub/ia64/efi/console.h	Thu Jan  1 01:00:00 1970
--- grub2/include/grub/ia64/efi/console.h	Wed Sep 27 08:15:44 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 <grub/efi/console.h>
+ 
+ #endif /* ! GRUB_MACHINE_CONSOLE_HEADER */
diff -rcN -x '*~' -x '*.mk' grub2.cvs/include/grub/ia64/efi/kernel.h grub2/include/grub/ia64/efi/kernel.h
*** grub2.cvs/include/grub/ia64/efi/kernel.h	Thu Jan  1 01:00:00 1970
--- grub2/include/grub/ia64/efi/kernel.h	Wed Sep 27 08:15:44 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 '*.mk' grub2.cvs/include/grub/ia64/efi/loader.h grub2/include/grub/ia64/efi/loader.h
*** grub2.cvs/include/grub/ia64/efi/loader.h	Thu Jan  1 01:00:00 1970
--- grub2/include/grub/ia64/efi/loader.h	Wed Sep 27 08:15:44 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 '*.mk' grub2.cvs/include/grub/ia64/efi/time.h grub2/include/grub/ia64/efi/time.h
*** grub2.cvs/include/grub/ia64/efi/time.h	Thu Jan  1 01:00:00 1970
--- grub2/include/grub/ia64/efi/time.h	Wed Sep 27 08:15:44 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 <grub/efi/time.h>
+ 
+ #endif /* ! GRUB_MACHINE_TIME_HEADER */
diff -rcN -x '*~' -x '*.mk' grub2.cvs/include/grub/ia64/libgcc.h grub2/include/grub/ia64/libgcc.h
*** grub2.cvs/include/grub/ia64/libgcc.h	Thu Jan  1 01:00:00 1970
--- grub2/include/grub/ia64/libgcc.h	Wed Sep 27 08:15:44 2006
***************
*** 0 ****
--- 1,37 ----
+ /*
+  *  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 (__udivdi3) (void);
+ void EXPORT_FUNC (__umoddi3) (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 '*.mk' grub2.cvs/include/grub/ia64/setjmp.h grub2/include/grub/ia64/setjmp.h
*** grub2.cvs/include/grub/ia64/setjmp.h	Thu Jan  1 01:00:00 1970
--- grub2/include/grub/ia64/setjmp.h	Wed Sep 27 08:15:44 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 <davidm@hpl.hp.com>.
+ 
+    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 '*.mk' grub2.cvs/include/grub/ia64/types.h grub2/include/grub/ia64/types.h
*** grub2.cvs/include/grub/ia64/types.h	Thu Jan  1 01:00:00 1970
--- grub2/include/grub/ia64/types.h	Wed Sep 27 08:15:44 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 '*.mk' grub2.cvs/kern/ia64/asmmacro.h grub2/kern/ia64/asmmacro.h
*** grub2.cvs/kern/ia64/asmmacro.h	Thu Jan  1 01:00:00 1970
--- grub2/kern/ia64/asmmacro.h	Wed Sep 27 08:15:44 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 <davidm@hpl.hp.com>
+  */
+ 
+ #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 '*.mk' grub2.cvs/kern/ia64/divdi3.S grub2/kern/ia64/divdi3.S
*** grub2.cvs/kern/ia64/divdi3.S	Thu Jan  1 01:00:00 1970
--- grub2/kern/ia64/divdi3.S	Wed Sep 27 08:15:44 2006
***************
*** 0 ****
--- 1 ----
+ #include "idiv64.S"
diff -rcN -x '*~' -x '*.mk' grub2.cvs/kern/ia64/divsi3.S grub2/kern/ia64/divsi3.S
*** grub2.cvs/kern/ia64/divsi3.S	Thu Jan  1 01:00:00 1970
--- grub2/kern/ia64/divsi3.S	Wed Sep 27 08:15:44 2006
***************
*** 0 ****
--- 1 ----
+ #include "idiv32.S"
diff -rcN -x '*~' -x '*.mk' grub2.cvs/kern/ia64/efi/elf_ia64_efi.lds grub2/kern/ia64/efi/elf_ia64_efi.lds
*** grub2.cvs/kern/ia64/efi/elf_ia64_efi.lds	Thu Jan  1 01:00:00 1970
--- grub2/kern/ia64/efi/elf_ia64_efi.lds	Wed Sep 27 08:15:44 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 '*.mk' grub2.cvs/kern/ia64/efi/init.c grub2/kern/ia64/efi/init.c
*** grub2.cvs/kern/ia64/efi/init.c	Thu Jan  1 01:00:00 1970
--- grub2/kern/ia64/efi/init.c	Wed Sep 27 08:15:44 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 <grub/types.h>
+ #include <grub/misc.h>
+ #include <grub/mm.h>
+ #include <grub/err.h>
+ #include <grub/dl.h>
+ #include <grub/cache.h>
+ #include <grub/kernel.h>
+ #include <grub/efi/efi.h>
+ 
+ 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 '*.mk' grub2.cvs/kern/ia64/efi/reloc_ia64.S grub2/kern/ia64/efi/reloc_ia64.S
*** grub2.cvs/kern/ia64/efi/reloc_ia64.S	Thu Jan  1 01:00:00 1970
--- grub2/kern/ia64/efi/reloc_ia64.S	Wed Sep 27 08:15:44 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 <davidm@hpl.hp.com>.
+ 
+    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 '*.mk' grub2.cvs/kern/ia64/efi/startup.S grub2/kern/ia64/efi/startup.S
*** grub2.cvs/kern/ia64/efi/startup.S	Thu Jan  1 01:00:00 1970
--- grub2/kern/ia64/efi/startup.S	Wed Sep 27 08:15:44 2006
***************
*** 0 ****
--- 1,81 ----
+ /* crt0-efi-ia64.S - IA-64 EFI startup code.
+    Copyright (C) 1999 Hewlett-Packard Co.
+ 	Contributed by David Mosberger <davidm@hpl.hp.com>.
+ 
+    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 '*.mk' grub2.cvs/kern/ia64/idiv32.S grub2/kern/ia64/idiv32.S
*** grub2.cvs/kern/ia64/idiv32.S	Thu Jan  1 01:00:00 1970
--- grub2/kern/ia64/idiv32.S	Wed Sep 27 08:15:44 2006
***************
*** 0 ****
--- 1,83 ----
+ /*
+  * Copyright (C) 2000 Hewlett-Packard Co
+  * Copyright (C) 2000 David Mosberger-Tang <davidm@hpl.hp.com>
+  *
+  * 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 '*.mk' grub2.cvs/kern/ia64/idiv64.S grub2/kern/ia64/idiv64.S
*** grub2.cvs/kern/ia64/idiv64.S	Thu Jan  1 01:00:00 1970
--- grub2/kern/ia64/idiv64.S	Wed Sep 27 08:15:44 2006
***************
*** 0 ****
--- 1,80 ----
+ /*
+  * Copyright (C) 1999-2000 Hewlett-Packard Co
+  * Copyright (C) 1999-2000 David Mosberger-Tang <davidm@hpl.hp.com>
+  *
+  * 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 '*.mk' grub2.cvs/kern/ia64/modsi3.S grub2/kern/ia64/modsi3.S
*** grub2.cvs/kern/ia64/modsi3.S	Thu Jan  1 01:00:00 1970
--- grub2/kern/ia64/modsi3.S	Wed Sep 27 08:15:44 2006
***************
*** 0 ****
--- 1,2 ----
+ #define MODULO 1
+ #include "idiv32.S"
diff -rcN -x '*~' -x '*.mk' grub2.cvs/kern/ia64/trampoline.S grub2/kern/ia64/trampoline.S
*** grub2.cvs/kern/ia64/trampoline.S	Thu Jan  1 01:00:00 1970
--- grub2/kern/ia64/trampoline.S	Wed Sep 27 08:15:44 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 '*.mk' grub2.cvs/kern/ia64/udivdi3.S grub2/kern/ia64/udivdi3.S
*** grub2.cvs/kern/ia64/udivdi3.S	Thu Jan  1 01:00:00 1970
--- grub2/kern/ia64/udivdi3.S	Wed Sep 27 08:15:44 2006
***************
*** 0 ****
--- 1,2 ----
+ #define UNSIGNED 1
+ #include "idiv64.S"
diff -rcN -x '*~' -x '*.mk' grub2.cvs/kern/ia64/udivsi3.S grub2/kern/ia64/udivsi3.S
*** grub2.cvs/kern/ia64/udivsi3.S	Thu Jan  1 01:00:00 1970
--- grub2/kern/ia64/udivsi3.S	Wed Sep 27 08:15:44 2006
***************
*** 0 ****
--- 1,2 ----
+ #define UNSIGNED 1
+ #include "idiv32.S"
diff -rcN -x '*~' -x '*.mk' grub2.cvs/kern/ia64/umoddi3.S grub2/kern/ia64/umoddi3.S
*** grub2.cvs/kern/ia64/umoddi3.S	Thu Jan  1 01:00:00 1970
--- grub2/kern/ia64/umoddi3.S	Wed Sep 27 08:15:44 2006
***************
*** 0 ****
--- 1,3 ----
+ #define UNSIGNED 1
+ #define MODULO 1
+ #include "idiv64.S"
diff -rcN -x '*~' -x '*.mk' grub2.cvs/kern/ia64/umodsi3.S grub2/kern/ia64/umodsi3.S
*** grub2.cvs/kern/ia64/umodsi3.S	Thu Jan  1 01:00:00 1970
--- grub2/kern/ia64/umodsi3.S	Wed Sep 27 08:15:44 2006
***************
*** 0 ****
--- 1,3 ----
+ #define UNSIGNED 1
+ #define MODULO 1
+ #include "idiv32.S"
diff -rcN -x '*~' -x '*.mk' grub2.cvs/loader/ia64/linux.c grub2/loader/ia64/linux.c
*** grub2.cvs/loader/ia64/linux.c	Thu Jan  1 01:00:00 1970
--- grub2/loader/ia64/linux.c	Wed Sep 27 08:15:44 2006
***************
*** 0 ****
--- 1,806 ----
+ /*
+  *  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 <grub/loader.h>
+ #include <grub/machine/loader.h>
+ #include <grub/file.h>
+ #include <grub/disk.h>
+ #include <grub/err.h>
+ #include <grub/misc.h>
+ #include <grub/types.h>
+ #include <grub/rescue.h>
+ #include <grub/dl.h>
+ #include <grub/mm.h>
+ #include <grub/cache.h>
+ /* #include <grub/cpu/linux.h> */
+ #include <grub/efi/api.h>
+ #include <grub/efi/efi.h>
+ #include <grub/elf.h>
+ #include <grub/gzio.h>
+ 
+ #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;
+ 
+   grub_printf ("Module %s [addr=%llx + %lx]\n",
+ 	       argv[0], (grub_uint64_t)module, size);
+ 
+   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++;
+ 
+   /* 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);
+ }
+ 
+ GRUB_MOD_INIT(linux)
+ {
+   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;
+ }
+ 
+ GRUB_MOD_FINI(linux)
+ {
+   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");
+ }
diff -rcN -x '*~' -x '*.mk' grub2.cvs/loader/ia64/linux_normal.c grub2/loader/ia64/linux_normal.c
*** grub2.cvs/loader/ia64/linux_normal.c	Thu Jan  1 01:00:00 1970
--- grub2/loader/ia64/linux_normal.c	Wed Sep 27 08:15:44 2006
***************
*** 0 ****
--- 1,108 ----
+ /* 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 <grub/machine/loader.h>
+ #include <grub/err.h>
+ #include <grub/normal.h>
+ #include <grub/dl.h>
+ 
+ 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;
+ }
+ 
+ GRUB_MOD_INIT(linux_normal)
+ {
+   (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);
+ }
+ 
+ GRUB_MOD_FINI(linux_normal)
+ {
+   grub_unregister_command ("linux");
+   grub_unregister_command ("initrd");
+   grub_unregister_command ("normal");
+   grub_unregister_command ("relocate");
+   grub_unregister_command ("fpswa");
+ }
diff -rcN -x '*~' -x '*.mk' grub2.cvs/normal/ia64/longjmp.S grub2/normal/ia64/longjmp.S
*** grub2.cvs/normal/ia64/longjmp.S	Thu Jan  1 01:00:00 1970
--- grub2/normal/ia64/longjmp.S	Wed Sep 27 08:15:44 2006
***************
*** 0 ****
--- 1,162 ----
+ /* Copyright (C) 1999, 2000, 2001, 2002  Free Software Foundation, Inc.
+    Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
+ 
+    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 '*.mk' grub2.cvs/normal/ia64/setjmp.S grub2/normal/ia64/setjmp.S
*** grub2.cvs/normal/ia64/setjmp.S	Thu Jan  1 01:00:00 1970
--- grub2/normal/ia64/setjmp.S	Wed Sep 27 08:15:44 2006
***************
*** 0 ****
--- 1,171 ----
+ /* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+    Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
+ 
+    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 '*.mk' grub2.cvs/util/ia64/efi/grub-install.in grub2/util/ia64/efi/grub-install.in
*** grub2.cvs/util/ia64/efi/grub-install.in	Thu Jan  1 01:00:00 1970
--- grub2/util/ia64/efi/grub-install.in	Wed Sep 27 10:41:43 2006
***************
*** 0 ****
--- 1,238 ----
+ #! /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
+ Usage: grub-install [OPTION] install_device
+ Install GRUB on your drive.
+ 
+   -h, --help              print this message and exit
+   -v, --version           print the version information and exit
+   --modules=MODULES       pre-load specified modules MODULES
+   --root-directory=DIR    install GRUB images under the directory DIR
+                           instead of the root directory
+   --grub-setup=FILE       use FILE as grub-setup
+   --grub-mkimage=FILE     use FILE as grub-mkimage
+   --grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
+   --grub-probefs=FILE     use FILE as grub-probefs
+   --no-floppy             do not probe any floppy drive
+   --recheck               probe a device map even if it already exists
+ 
+ INSTALL_DEVICE can be a GRUB device name or a system device filename.
+ 
+ grub-install copies GRUB images into the DIR/boot directory specfied by
+ --root-directory, and uses grub-setup to install grub into the boot
+ sector.
+ 
+ Report bugs to <bug-grub@gnu.org>.
+ 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 $modules"
+ modules="$modules memmap systab boot"
+ 
+ tmpdir=`mktemp -d /tmp/grub.XXXXXXXXXX` || exit 1
+ trap "rm -rf $tmpdir" 1 2 13 15
+ 
+ # Generate init/fini for modules.
+ modfile=$tmpdir/mod.c
+ echo "/* Dummy modules.  */" > $modfile
+ list=""
+ init_list=""
+ fini_list=""
+ for m in $modules; do
+   file="$pkglibdir/${m}.mod"
+   name=`nm $file | sed -n "/ r grub_module_name/ s/.* r grub_module_name_\(.*\)/\1/p"`
+   if test x"$name" != x; then
+     init=`nm $file | sed -n "/ T grub_module_.*_init/ s/.* T //p"`
+     fini=`nm $file | sed -n "/ T grub_module_.*_fini/ s/.* T //p"`
+     init_list="$init_list $init"
+     fini_list="$fini_list $fini"
+     arg="\"$name\",${init:-0},${fini:-0}"
+     list="$list $arg"
+ 
+   fi
+ done
+ echo "extern void grub_init_module (const char *, void (*init)(void *), void (*fini)(void));" >> $modfile
+ echo "extern void grub_init_modules (void);" >> $modfile
+ for m in $init_list; do
+   echo "extern void $m(void *);" >> $modfile
+ done
+ for m in $fini_list; do
+   echo "extern void $m(void);" >> $modfile
+ done
+ echo "void grub_init_modules (void)" >> $modfile
+ echo "{" >> $modfile
+ for m in $list; do
+   echo "  grub_init_module($m);" >> $modfile
+ done
+ echo "}" >> $modfile
+ 
+ $TARGET_CC -c $TARGET_CFLAGS -o $tmpdir/mod.o $modfile
+ 
+ mod_objs=
+ for m in $modules; do mod_objs="$mod_objs $pkglibdir/${m}.mod"; done
+ 
+ ld -nostdlib -T $pkglibdir/elf_ia64_efi.lds -shared -Bsymbolic \
+  $mod_objs $tmpdir/mod.o -o $tmpdir/grub.so 
+ 
+ syms=`nm $tmpdir/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 \
+          $tmpdir/grub.so $grubdir/grub.efi
+ 
+ echo "grub.efi generated"
+ 
+ rm -rf $tmpdir
+ 
+ #$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
+ 
+ # Bye.
+ exit 0

[-- Attachment #5: modules.diffs --]
[-- Type: application/octet-stream, Size: 5464 bytes --]

diff -rcN -x '*~' -x '*.mk' grub2.cvs/Makefile.in grub2/Makefile.in
*** grub2.cvs/Makefile.in	Mon May 29 01:01:43 2006
--- grub2/Makefile.in	Wed Sep 27 08:15:44 2006
***************
*** 64,69 ****
--- 64,70 ----
  TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I. -Iinclude -I$(srcdir)/include \
  	-Wall -W
  TARGET_LDFLAGS = @TARGET_LDFLAGS@
+ STRIP_FLAGS=--strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment 
  OBJCOPY = @OBJCOPY@
  STRIP = @STRIP@
  NM = @NM@
diff -rcN -x '*~' -x '*.mk' grub2.cvs/geninit.sh grub2/geninit.sh
*** grub2.cvs/geninit.sh	Sun Dec 25 18:04:32 2005
--- grub2/geninit.sh	Wed Sep 27 08:15:44 2006
***************
*** 45,51 ****
  while read line; do
    file=`echo $line | cut -f1 -d:`
    if echo $@ | grep $file >/dev/null; then
!     echo $line | sed -e 's/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/  grub_\1_init ();/'
    fi
  done < grub_modules_init.lst
  
--- 45,51 ----
  while read line; do
    file=`echo $line | cut -f1 -d:`
    if echo $@ | grep $file >/dev/null; then
!     echo $line | sed -e 's/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/  grub_\1_init (0);/'
    fi
  done < grub_modules_init.lst
  
diff -rcN -x '*~' -x '*.mk' grub2.cvs/geninitheader.sh grub2/geninitheader.sh
*** grub2.cvs/geninitheader.sh	Sun Nov 13 16:47:08 2005
--- grub2/geninitheader.sh	Wed Sep 27 08:15:44 2006
***************
*** 39,43 ****
  void grub_fini_all (void);
  EOF
  
! cat grub_modules_init.lst | grep -v '^#' | sed -n '/GRUB_MOD_INIT *([a-zA-Z0-9_]*)/{s/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/void grub_\1_init (void);/;p;}'
  cat grub_modules_init.lst | grep -v '^#' | sed -n '/GRUB_MOD_INIT *([a-zA-Z0-9_]*)/{s/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/void grub_\1_fini (void);/;p;}'
--- 39,43 ----
  void grub_fini_all (void);
  EOF
  
! cat grub_modules_init.lst | grep -v '^#' | sed -n '/GRUB_MOD_INIT *([a-zA-Z0-9_]*)/{s/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/void grub_\1_init (grub_dl_t mod);/;p;}'
  cat grub_modules_init.lst | grep -v '^#' | sed -n '/GRUB_MOD_INIT *([a-zA-Z0-9_]*)/{s/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/void grub_\1_fini (void);/;p;}'
diff -rcN -x '*~' -x '*.mk' grub2.cvs/genmk.rb grub2/genmk.rb
*** grub2.cvs/genmk.rb	Fri Sep 22 02:27:38 2006
--- grub2/genmk.rb	Wed Sep 27 08:15:44 2006
***************
*** 115,121 ****
  #{@name}: #{pre_obj} #{mod_obj}
  	-rm -f $@
  	$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ $^
! 	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
  
  #{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str}
  	-rm -f $@
--- 115,121 ----
  #{@name}: #{pre_obj} #{mod_obj}
  	-rm -f $@
  	$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ $^
! 	$(STRIP) $(STRIP_FLAGS) $@
  
  #{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str}
  	-rm -f $@
diff -rcN -x '*~' -x '*.mk' grub2.cvs/include/grub/dl.h grub2/include/grub/dl.h
*** grub2.cvs/include/grub/dl.h	Sun Nov 27 13:21:12 2005
--- grub2/include/grub/dl.h	Wed Sep 27 08:15:44 2006
***************
*** 27,51 ****
  
  #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
  {
--- 27,53 ----
  
  #define GRUB_MOD_INIT(name)	\
  static void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ ((used)); \
! void grub_module_##name##_init (grub_dl_t); \
  void \
! grub_module_##name##_init (grub_dl_t mod) { grub_mod_init (mod); } \
  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_module_##name##_fini (void); \
  void \
! grub_module_##name##_fini (void) { grub_mod_fini (); } \
  static void \
  grub_mod_fini (void)
  
  #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
  {
diff -rcN -x '*~' -x '*.mk' grub2.cvs/kern/dl.c grub2/kern/dl.c
*** grub2.cvs/kern/dl.c	Mon May 29 01:01:43 2006
--- grub2/kern/dl.c	Wed Sep 27 08:15:44 2006
***************
*** 580,585 ****
--- 580,608 ----
    return mod;
  }
  
+ void
+ grub_init_module (const char *name,
+ 		  void (*init)(grub_dl_t), void (*fini)(void))
+ {
+   grub_dl_t mod;
+ 
+   mod = (grub_dl_t) grub_malloc (sizeof (*mod));
+   if (! mod)
+     return;
+ 
+   mod->name = name;
+   mod->ref_count = 1;
+   mod->dep = 0;
+   mod->segment = 0;
+   mod->init = init;
+   mod->fini = fini;
+ 
+   grub_dl_call_init (mod);
+ 
+   /* Can't fail.  */
+   grub_dl_add (mod);
+ }
+ 
  /* Load a module from the file FILENAME.  */
  grub_dl_t
  grub_dl_load_file (const char *filename)

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2006-10-13 18:49 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-11 11:43 Grub for ia64 Mao, Bibo
2006-10-12  8:21 ` Tristan Gingold
2006-10-12 11:30   ` Johan Rydberg
2006-10-12 11:35     ` Tristan Gingold
2006-10-12 12:11       ` Johan Rydberg
2006-10-12 14:14         ` Tristan Gingold
2006-10-12 15:32           ` Johan Rydberg
2006-10-13  5:22             ` Tristan Gingold
2006-10-13  8:02               ` bibo,mao
2006-10-13 18:48                 ` Yoshinori K. Okuji
  -- strict thread matches above, loose matches on Subject: below --
2006-10-12 12:50 Mao, Bibo
2006-09-28 11:41 tgingold
2006-09-28 13:06 ` bibo,mao
2006-09-28 13:12   ` tgingold
2006-09-28 13:33 ` Marco Gerards
2006-09-28 13:45   ` tgingold
2006-09-28 14:29     ` Marco Gerards
2006-09-28 14:49       ` tgingold
2006-09-28 13:47 ` Johan Rydberg
2006-09-28 13:35   ` tgingold
2006-09-28 14:15     ` Johan Rydberg
2006-09-28 13:38   ` Marco Gerards
2006-10-10 18:15   ` Johan Rydberg
2006-10-10 22:03     ` Jeff Bailey
2006-10-11 11:19       ` Johan Rydberg
2006-10-11 10:50     ` Tristan Gingold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.