]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[umalloc] Unhide umalloc()ed memory region when there are no allocations
authorMichael Brown <mcb30@ipxe.org>
Mon, 26 Mar 2012 23:21:24 +0000 (00:21 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 26 Mar 2012 23:31:01 +0000 (00:31 +0100)
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>
src/arch/i386/interface/pcbios/memtop_umalloc.c

index 6c581feeb5fdbac39fde1b58a3f7c178aa7450a2..dba4a23a49558cb08d8ab2e7ee1ee9260d1679ee 100644 (file)
@@ -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 );