aboutsummaryrefslogtreecommitdiff
path: root/src/pmm.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-08-16 21:59:40 -0400
committerKevin O'Connor <kevin@koconnor.net>2009-08-16 21:59:40 -0400
commita3855adbde97f3bb71e2d5f153be7304ac700a89 (patch)
treee13407187d715c8dc546affcf8bf5bdef9d3bf29 /src/pmm.c
parent1f83625f4861b1118e3392adb1da96a0d24a94cb (diff)
downloadseabios-a3855adbde97f3bb71e2d5f153be7304ac700a89.zip
seabios-a3855adbde97f3bb71e2d5f153be7304ac700a89.tar.gz
seabios-a3855adbde97f3bb71e2d5f153be7304ac700a89.tar.bz2
Add support for using floppy images in CBFS.
Add new "ramdisk" type for disk accesses. Extract out high-mem finding code from pmm into find_high_area(). Fix bug in GDB_BASE and GDT_LIMIT macros (wrong bit shifts).
Diffstat (limited to 'src/pmm.c')
-rw-r--r--src/pmm.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/pmm.c b/src/pmm.c
index b3eef4b..da462fd 100644
--- a/src/pmm.c
+++ b/src/pmm.c
@@ -6,7 +6,7 @@
#include "util.h" // checksum
#include "config.h" // BUILD_BIOS_ADDR
-#include "memmap.h" // e820_list
+#include "memmap.h" // find_high_area
#include "farptr.h" // GET_FARVAR
#include "biosvar.h" // EBDA_SEGMENT_MINIMUM
@@ -117,24 +117,14 @@ malloc_setup()
ZoneTmpLow.top = ZoneTmpLow.cur = (u32)MAKE_FLATPTR(EBDA_SEGMENT_MINIMUM, 0);
// Find memory at the top of ram.
- u32 top = 0, bottom = 0;
- int i;
- for (i=e820_count-1; i>=0; i--) {
- struct e820entry *e = &e820_list[i];
- u64 end = e->start + e->size;
- if (e->type != E820_RAM || end > 0xffffffff
- || e->size < CONFIG_MAX_HIGHTABLE + MALLOC_MIN_ALIGN)
- continue;
- top = end;
- bottom = e->start;
- break;
- }
- if (top < 1024*1024 + CONFIG_MAX_HIGHTABLE) {
+ struct e820entry *e = find_high_area(CONFIG_MAX_HIGHTABLE+MALLOC_MIN_ALIGN);
+ if (!e) {
// No memory above 1Meg
memset(&ZoneHigh, 0, sizeof(ZoneHigh));
- memset(&ZoneTmpHigh, 0, sizeof(ZoneHigh));
+ memset(&ZoneTmpHigh, 0, sizeof(ZoneTmpHigh));
return;
}
+ u32 top = e->start + e->size, bottom = e->start;
// Memory at top of ram.
ZoneHigh.bottom = ALIGN(top - CONFIG_MAX_HIGHTABLE, MALLOC_MIN_ALIGN);