summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/interface
diff options
context:
space:
mode:
authorMichael Brown2012-03-27 01:21:24 +0200
committerMichael Brown2012-03-27 01:31:01 +0200
commit2834f9f6ded44dbb217e3a8fa02f63b980dcfefb (patch)
tree6e139d03b48f97194afa7dbca6b20d5ce10a086a /src/arch/i386/interface
parent[umalloc] Fail allocations when we run out of external memory (diff)
downloadipxe-2834f9f6ded44dbb217e3a8fa02f63b980dcfefb.tar.gz
ipxe-2834f9f6ded44dbb217e3a8fa02f63b980dcfefb.tar.xz
ipxe-2834f9f6ded44dbb217e3a8fa02f63b980dcfefb.zip
[umalloc] Unhide umalloc()ed memory region when there are no allocations
At present, we always hide an extra sizeof(struct external_memory), to account for the header on the lowest allocated block. This header ceases to exist when there are no allocated blocks remaining. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/i386/interface')
-rw-r--r--src/arch/i386/interface/pcbios/memtop_umalloc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/arch/i386/interface/pcbios/memtop_umalloc.c b/src/arch/i386/interface/pcbios/memtop_umalloc.c
index 6c581feeb..dba4a23a4 100644
--- a/src/arch/i386/interface/pcbios/memtop_umalloc.c
+++ b/src/arch/i386/interface/pcbios/memtop_umalloc.c
@@ -208,7 +208,8 @@ static userptr_t memtop_urealloc ( userptr_t ptr, size_t new_size ) {
/* Collect any free blocks and update hidden memory region */
ecollect_free();
- hide_umalloc ( user_to_phys ( bottom, 0 ),
+ hide_umalloc ( user_to_phys ( bottom, ( ( bottom == top ) ?
+ 0 : -sizeof ( extmem ) ) ),
user_to_phys ( top, 0 ) );
return ( new_size ? new : UNOWHERE );