diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2010-06-06 11:10:24 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2010-06-06 11:10:24 -0400 |
commit | 42a1d4cdb09535d9c5880880af6a17d6741377a6 (patch) | |
tree | 4cf6222680d009e1845c022342a48526ab722987 /src/memmap.c | |
parent | 34e9cc5d417442a776ae0e849214bc391c31d0aa (diff) | |
download | seabios-42a1d4cdb09535d9c5880880af6a17d6741377a6.tar.gz |
Rework malloc to use a "first fit" algorithm.
The existing malloc implementation effectively uses a stack - all new
allocations come from the top of the stack. When allocating memory
with a large alignment, the pad used to align the new memory is
unavailable to other users. Also, memory released by calling free()
is only available to other users when all memory allocated after it is
also freed.
This new malloc scheme uses a first fit approach to finding available
memory. It makes it possible to use alignment padding and freed space
for new allocations.
This helps reduce the required memory in the permanent memory zones
(ZoneHigh and ZoneLow) where users have the need to allocate
structures with high alignment (eg, virtio and usb).
Diffstat (limited to 'src/memmap.c')
-rw-r--r-- | src/memmap.c | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/src/memmap.c b/src/memmap.c index 8770bbc9..84bc4faa 100644 --- a/src/memmap.c +++ b/src/memmap.c @@ -119,23 +119,6 @@ add_e820(u64 start, u64 size, u32 type) //dump_map(); } -// Find highest area of 32bit memory that can hold the given size. -struct e820entry * -find_high_area(u32 size) -{ - 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 < size) - continue; - if (end < 1024*1024 + size) - break; - return e; - } - return NULL; -} - // Prep for memmap stuff - init bios table locations. void memmap_setup(void) |