From dd103c4e042c00e5b59ccdae701f8a4a90f09b3f Mon Sep 17 00:00:00 2001 From: phcoder Date: Mon, 24 Aug 2009 13:20:24 +0000 Subject: [PATCH] 2009-08-24 Vladimir Serbinenko Fix OpenBSD and NetBSD support. * include/grub/i386/bsd.h (GRUB_BSD_TEMP_BUFFER): Change to resolve memory address conflict. (OPENBSD_MMAP_ACPI): New definition. (OPENBSD_MMAP_NVS): Likewise. * loader/i386/bsd.c (grub_openbsd_boot): Support OPENBSD_MMAP_ACPI and OPENBSD_MMAP_NVS. Add memory map terminator Explicit cast when calling grub_unix_real_boot. (grub_nebsd_boot): Explicit cast when calling grub_unix_real_boot. --- ChangeLog | 14 ++++++++++++++ include/grub/i386/bsd.h | 4 +++- loader/i386/bsd.c | 22 ++++++++++++++++++---- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index f26013862..d81560913 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2009-08-24 Vladimir Serbinenko + + Fix OpenBSD and NetBSD support. + + * include/grub/i386/bsd.h (GRUB_BSD_TEMP_BUFFER): Change to resolve + memory address conflict. + (OPENBSD_MMAP_ACPI): New definition. + (OPENBSD_MMAP_NVS): Likewise. + * loader/i386/bsd.c (grub_openbsd_boot): Support OPENBSD_MMAP_ACPI + and OPENBSD_MMAP_NVS. + Add memory map terminator + Explicit cast when calling grub_unix_real_boot. + (grub_nebsd_boot): Explicit cast when calling grub_unix_real_boot. + 2009-08-24 Vladimir Serbinenko Let user specify NetBSD root device. diff --git a/include/grub/i386/bsd.h b/include/grub/i386/bsd.h index f39fc9d5c..2939035d2 100644 --- a/include/grub/i386/bsd.h +++ b/include/grub/i386/bsd.h @@ -29,7 +29,7 @@ enum bsd_kernel_types KERNEL_TYPE_NETBSD, }; -#define GRUB_BSD_TEMP_BUFFER 0x68000 +#define GRUB_BSD_TEMP_BUFFER 0x80000 #define FREEBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */ #define FREEBSD_RB_SINGLE (1 << 1) /* reboot to single user only */ @@ -157,6 +157,8 @@ struct grub_openbsd_bios_mmap grub_uint64_t len; #define OPENBSD_MMAP_AVAILABLE 1 #define OPENBSD_MMAP_RESERVED 2 +#define OPENBSD_MMAP_ACPI 3 +#define OPENBSD_MMAP_NVS 4 grub_uint32_t type; }; diff --git a/loader/i386/bsd.c b/loader/i386/bsd.c index 09e5f5876..1b6f1902b 100644 --- a/loader/i386/bsd.c +++ b/loader/i386/bsd.c @@ -574,6 +574,14 @@ grub_openbsd_boot (void) pm->type = OPENBSD_MMAP_AVAILABLE; break; + case GRUB_MACHINE_MEMORY_ACPI: + pm->type = OPENBSD_MMAP_ACPI; + break; + + case GRUB_MACHINE_MEMORY_NVS: + pm->type = OPENBSD_MMAP_NVS; + break; + default: pm->type = OPENBSD_MMAP_RESERVED; break; @@ -589,6 +597,12 @@ grub_openbsd_boot (void) pm = (struct grub_openbsd_bios_mmap *) (pa + 1); grub_mmap_iterate (hook); + /* Memory map terminator. */ + pm->addr = 0; + pm->len = 0; + pm->type = 0; + pm++; + pa->ba_size = (char *) pm - (char *) pa; pa->ba_next = (struct grub_openbsd_bootargs *) pm; pa = pa->ba_next; @@ -600,8 +614,8 @@ grub_openbsd_boot (void) (part << OPENBSD_B_PARTSHIFT)); grub_unix_real_boot (entry, bootflags, bootdev, OPENBSD_BOOTARG_APIVER, - 0, grub_mmap_get_upper () >> 10, - grub_mmap_get_lower () >> 10, + 0, (grub_uint32_t) (grub_mmap_get_upper () >> 10), + (grub_uint32_t) (grub_mmap_get_lower () >> 10), (char *) pa - buf, buf); /* Not reached. */ @@ -642,8 +656,8 @@ grub_netbsd_boot (void) } grub_unix_real_boot (entry, bootflags, 0, bootinfo, - 0, grub_mmap_get_upper () >> 10, - grub_mmap_get_lower () >> 10); + 0, (grub_uint32_t) (grub_mmap_get_upper () >> 10), + (grub_uint32_t) (grub_mmap_get_lower () >> 10)); /* Not reached. */ return GRUB_ERR_NONE; -- 2.47.3