Skip to contentSkip to conversation

NetBSD64 support

PATCH In review Vladimir 'phcoder' Serbinenko 1 participant 2 messages Aug 23, 2009 – Aug 24, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NetBSD64 support

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
ChangeLog +7 -0
index 6cf11a6..6c36901 100644
@@ -1,5 +1,12 @@
 2009-08-23  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-23  Vladimir Serbinenko  <[email protected]>
+
 	* loader/i386/bsd.c (freebsd_opts): Rewritten to use extcmd.
 	(openbsd_opts): Likewise.
 	(netbsd_opts): Likewise.
loader/i386/bsd.c +12 -2
index d5f677a..d9d628c 100644
@@ -776,8 +776,18 @@ grub_bsd_load_elf (grub_elf_t elf)
   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
#1 lore raw

Committed as approved by Robert Millan for fast-track acception.

Quoted 6 lines · Vladimir 'phcoder' Serbinenko

--
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git