[2522] 2009-08-24 Vladimir Serbinenko <[email protected]>

Vladimir Serbinenko <[email protected]> Mon, 24 Aug 2009 12:59:49 +0000
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 2522
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2522
Author:   phcoder
Date:     2009-08-24 12:59:48 +0000 (Mon, 24 Aug 2009)
Log Message:
-----------
2009-08-24  Vladimir Serbinenko  <[email protected]>

	Support for 64-bit NetBSD.

	* loader/i386/bsd.c (grub_bsd_load_elf): Apply correct mask to entry
	point when booting non-FreeBSD.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/loader/i386/bsd.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2009-08-24 12:55:19 UTC (rev 2521)
+++ trunk/grub2/ChangeLog	2009-08-24 12:59:48 UTC (rev 2522)
@@ -1,5 +1,12 @@
 2009-08-24  Vladimir Serbinenko  <[email protected]>
 
+	Support for 64-bit NetBSD.
+
+	* loader/i386/bsd.c (grub_bsd_load_elf): Apply correct mask to entry
+	point when booting non-FreeBSD.
+
+2009-08-24  Vladimir Serbinenko  <[email protected]>
+
 	Support --no-smp and --no-acpi for NetBSD.
 
 	* include/grub/i386/bsd.h (NETBSD_AB_NOSMP): New definition.

Modified: trunk/grub2/loader/i386/bsd.c
===================================================================
--- trunk/grub2/loader/i386/bsd.c	2009-08-24 12:55:19 UTC (rev 2521)
+++ trunk/grub2/loader/i386/bsd.c	2009-08-24 12:59:48 UTC (rev 2522)
@@ -778,8 +778,18 @@
   else if (grub_elf_is_elf64 (elf))
     {
       is_64bit = 1;
-      entry = elf->ehdr.ehdr64.e_entry & 0xffffffff;
-      entry_hi = (elf->ehdr.ehdr64.e_entry >> 32) & 0xffffffff;
+
+      /* FreeBSD has 64-bit entry point.  */
+      if (kernel_type == KERNEL_TYPE_FREEBSD)
+	{
+	  entry = elf->ehdr.ehdr64.e_entry & 0xffffffff;
+	  entry_hi = (elf->ehdr.ehdr64.e_entry >> 32) & 0xffffffff;
+	}
+      else
+	{
+	  entry = elf->ehdr.ehdr64.e_entry & 0x0fffffff;
+	  entry_hi = 0;
+	}
       return grub_elf64_load (elf, grub_bsd_elf64_hook, 0, 0);
     }
   else