summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2005-12-21 02:17:58 +0000
committersobomax <sobomax@FreeBSD.org>2005-12-21 02:17:58 +0000
commitaaeace5d5b2863e9c631c7a3766e0f948ce5282e (patch)
tree7b8ac94c121170cce171a82aef24f35810ee345f /sys/boot
parent0be5d450a64399db1956b285f2cc3c9099a2736d (diff)
downloadFreeBSD-src-aaeace5d5b2863e9c631c7a3766e0f948ce5282e.zip
FreeBSD-src-aaeace5d5b2863e9c631c7a3766e0f948ce5282e.tar.gz
For the cases when loading bzip2-compressed kernels enabled use last
3MB of physical memory for heap instead of range between 1MB and 4MB. This makes this feature working with PAE and amd64 kernels, which are loaded at 2MB. Teach i386_copyin() to avoid using range allocated by heap in such case, so that it won't trash heap in the low memory conditions. This should make loading bzip2-compressed kernels/modules/mfs images generally useable, so that re@ team is welcome to evaluate merits of using this feature in the installation CDs. Valuable suggestions by: jhb
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/i386/libi386/biosmem.c4
-rw-r--r--sys/boot/i386/libi386/i386_copy.c2
-rw-r--r--sys/boot/i386/libi386/libi386.h5
-rw-r--r--sys/boot/i386/loader/main.c5
4 files changed, 10 insertions, 6 deletions
diff --git a/sys/boot/i386/libi386/biosmem.c b/sys/boot/i386/libi386/biosmem.c
index 019cf90..6d4f966 100644
--- a/sys/boot/i386/libi386/biosmem.c
+++ b/sys/boot/i386/libi386/biosmem.c
@@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$");
#include "libi386.h"
#include "btxv86.h"
-vm_offset_t memtop;
+vm_offset_t memtop, memtop_copyin;
u_int32_t bios_basemem, bios_extmem;
#define SMAPSIG 0x534D4150
@@ -101,7 +101,7 @@ bios_getmem(void)
}
/* Set memtop to actual top of memory */
- memtop = 0x100000 + bios_extmem;
+ memtop = memtop_copyin = 0x100000 + bios_extmem;
}
diff --git a/sys/boot/i386/libi386/i386_copy.c b/sys/boot/i386/libi386/i386_copy.c
index e488716..3c05241 100644
--- a/sys/boot/i386/libi386/i386_copy.c
+++ b/sys/boot/i386/libi386/i386_copy.c
@@ -66,7 +66,7 @@ ssize_t
i386_readin(const int fd, vm_offset_t dest, const size_t len)
{
- if (dest + len >= memtop) {
+ if (dest + len >= memtop_copyin) {
errno = EFBIG;
return(-1);
}
diff --git a/sys/boot/i386/libi386/libi386.h b/sys/boot/i386/libi386/libi386.h
index 670d2cb..4f12161 100644
--- a/sys/boot/i386/libi386/libi386.h
+++ b/sys/boot/i386/libi386/libi386.h
@@ -91,7 +91,10 @@ void bios_getsmap(void);
void bios_getmem(void);
extern u_int32_t bios_basemem; /* base memory in bytes */
extern u_int32_t bios_extmem; /* extended memory in bytes */
-extern vm_offset_t memtop;
+extern vm_offset_t memtop; /* last address of physical memory + 1 */
+extern vm_offset_t memtop_copyin; /* memtop less heap size for the cases */
+ /* when heap is at the top of extended memory */
+ /* for other cases - just the same as memtop */
int biospci_find_devclass(uint32_t class, int index);
int biospci_write_config(uint32_t locator, int offset, int width, int val);
diff --git a/sys/boot/i386/loader/main.c b/sys/boot/i386/loader/main.c
index 85d574b..96c40db 100644
--- a/sys/boot/i386/loader/main.c
+++ b/sys/boot/i386/loader/main.c
@@ -92,8 +92,9 @@ main(void)
bios_getmem();
#ifdef LOADER_BZIP2_SUPPORT
- heap_top = PTOV(0x400000);
- heap_bottom = PTOV(0x100000);
+ heap_top = PTOV(memtop_copyin);
+ memtop_copyin -= 0x300000;
+ heap_bottom = PTOV(memtop_copyin);
#else
heap_top = (void *)bios_basemem;
heap_bottom = (void *)end;
OpenPOWER on IntegriCloud