david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[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>
This commit is contained in:
Michael Brown 2012-03-27 00:21:24 +01:00
parent 920799a0ba
commit 2834f9f6de
1 changed files with 2 additions and 1 deletions

View 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 );