From 92517362b2e204ec83a6d2d7bef99913b081da21 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 2 May 2010 16:26:00 +0200 Subject: [PATCH] Split a memory chunk spanning accross 1MiB mark for openbsd --- loader/i386/bsd.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/loader/i386/bsd.c b/loader/i386/bsd.c index c0c75204d..26055d5ca 100644 --- a/loader/i386/bsd.c +++ b/loader/i386/bsd.c @@ -301,7 +301,7 @@ generate_e820_mmap (grub_size_t *len, grub_size_t *cnt, void *buf) { prev.size += cur.size; if (mmap) - mmap[-1] = prev; + mmap[-1] = prev; } else { @@ -311,6 +311,23 @@ generate_e820_mmap (grub_size_t *len, grub_size_t *cnt, void *buf) count++; } + if (kernel_type == KERNEL_TYPE_OPENBSD && prev.addr < 0x100000 + && prev.addr + prev.size > 0x100000) + { + cur.addr = 0x100000; + cur.size = prev.addr + prev.size - 0x100000; + cur.type = prev.type; + prev.size = 0x100000 - prev.addr; + if (mmap) + { + mmap[-1] = prev; + mmap[0] = cur; + mmap++; + } + prev = cur; + count++; + } + return 0; } @@ -1475,7 +1492,7 @@ grub_cmd_openbsd (grub_extcmd_t cmd, int argc, char *argv[]) if (grub_bsd_load (argc, argv) == GRUB_ERR_NONE) { - grub_loader_set (grub_openbsd_boot, grub_bsd_unload, 1); + grub_loader_set (grub_openbsd_boot, grub_bsd_unload, 0); openbsd_root = bootdev; }