summaryrefslogtreecommitdiffstats
path: root/sys/boot/pc98
diff options
context:
space:
mode:
authornyan <nyan@FreeBSD.org>2009-12-08 13:06:35 +0000
committernyan <nyan@FreeBSD.org>2009-12-08 13:06:35 +0000
commitbefb051a26de5100d091e6690dafb8898eac72c9 (patch)
tree55b771c0cba9fd769869978b9fd287db460530af /sys/boot/pc98
parent8deeaefd93eaf35d983592e19be360bad03660d4 (diff)
downloadFreeBSD-src-befb051a26de5100d091e6690dafb8898eac72c9.zip
FreeBSD-src-befb051a26de5100d091e6690dafb8898eac72c9.tar.gz
MFi386: revision 200219
Improve the algorithm the loader uses to choose a memory range for its heap when using a range above 1MB. MFC after: 1 week
Diffstat (limited to 'sys/boot/pc98')
-rw-r--r--sys/boot/pc98/libpc98/biosmem.c17
-rw-r--r--sys/boot/pc98/loader/main.c16
2 files changed, 25 insertions, 8 deletions
diff --git a/sys/boot/pc98/libpc98/biosmem.c b/sys/boot/pc98/libpc98/biosmem.c
index aec3cbb..a25d8c2 100644
--- a/sys/boot/pc98/libpc98/biosmem.c
+++ b/sys/boot/pc98/libpc98/biosmem.c
@@ -34,8 +34,13 @@ __FBSDID("$FreeBSD$");
#include "libi386.h"
#include "btxv86.h"
-vm_offset_t memtop, memtop_copyin;
-uint32_t bios_basemem, bios_extmem;
+vm_offset_t memtop, memtop_copyin, high_heap_base;
+uint32_t bios_basemem, bios_extmem, high_heap_size;
+
+/*
+ * The minimum amount of memory to reserve in bios_extmem for the heap.
+ */
+#define HEAP_MIN (3 * 1024 * 1024)
void
bios_getmem(void)
@@ -48,4 +53,12 @@ bios_getmem(void)
/* Set memtop to actual top of memory */
memtop = memtop_copyin = 0x100000 + bios_extmem;
+ /*
+ * If we have extended memory, use the last 3MB of 'extended' memory
+ * as a high heap candidate.
+ */
+ if (bios_extmem >= HEAP_MIN) {
+ high_heap_size = HEAP_MIN;
+ high_heap_base = memtop - HEAP_MIN;
+ }
}
diff --git a/sys/boot/pc98/loader/main.c b/sys/boot/pc98/loader/main.c
index b1e7dd2..e10b1e7 100644
--- a/sys/boot/pc98/loader/main.c
+++ b/sys/boot/pc98/loader/main.c
@@ -97,13 +97,17 @@ main(void)
bios_getmem();
#if defined(LOADER_BZIP2_SUPPORT)
- heap_top = PTOV(memtop_copyin);
- memtop_copyin -= 0x300000;
- heap_bottom = PTOV(memtop_copyin);
-#else
- heap_top = (void *)bios_basemem;
- heap_bottom = (void *)end;
+ if (high_heap_size > 0) {
+ heap_top = PTOV(high_heap_base + high_heap_size);
+ heap_bottom = PTOV(high_heap_base);
+ if (high_heap_base < memtop_copyin)
+ memtop_copyin = high_heap_base;
+ } else
#endif
+ {
+ heap_top = (void *)PTOV(bios_basemem);
+ heap_bottom = (void *)end;
+ }
setheap(heap_bottom, heap_top);
/*
OpenPOWER on IntegriCloud