From adb29902f39d18660c0cb4115c79f2a55dc1ba04 Mon Sep 17 00:00:00 2001 From: phcoder Date: Mon, 24 Aug 2009 12:59:48 +0000 Subject: [PATCH] 2009-08-24 Vladimir Serbinenko Support for 64-bit NetBSD. * loader/i386/bsd.c (grub_bsd_load_elf): Apply correct mask to entry point when booting non-FreeBSD. --- ChangeLog | 7 +++++++ loader/i386/bsd.c | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9ec86ede8..59b50f04a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-08-24 Vladimir Serbinenko + + 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 Support --no-smp and --no-acpi for NetBSD. diff --git a/loader/i386/bsd.c b/loader/i386/bsd.c index 10b92e3c6..26f98b3a9 100644 --- a/loader/i386/bsd.c +++ b/loader/i386/bsd.c @@ -778,8 +778,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