From: Michael Brown Date: Mon, 26 Mar 2012 23:21:24 +0000 (+0100) Subject: [umalloc] Unhide umalloc()ed memory region when there are no allocations X-Git-Tag: v1.20.1~1881 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2834f9f6ded44dbb217e3a8fa02f63b980dcfefb;p=thirdparty%2Fipxe.git [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 --- 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 );