|
iPXE
|
External ("user") heap. More...
Go to the source code of this file.
Macros | |
| #define | UHEAP_ALIGN PAGE_SIZE |
| Alignment for external heap allocations. More... | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| static void | uheap_resize (ssize_t delta) |
| Adjust size of external heap in-use memory region. More... | |
| static void | uheap_find (void) |
| Find an external heap region. More... | |
| static unsigned int | uheap_grow (size_t size) |
| Attempt to grow external heap. More... | |
| static unsigned int | uheap_shrink (void *ptr, size_t size) |
| Allow external heap to shrink. More... | |
| static void * | uheap_realloc (void *old_ptr, size_t new_size) |
| Reallocate external memory. More... | |
| PROVIDE_UMALLOC (uheap, urealloc, uheap_realloc) | |
Variables | |
| static struct heap | uheap |
| The external heap. More... | |
| physaddr_t | uheap_limit |
| Minimum possible start of external heap. More... | |
| physaddr_t | uheap_start |
| Start of external heap. More... | |
| physaddr_t | uheap_end |
| End of external heap. More... | |
| struct used_region uheap_used | __used_region |
| In-use memory region. More... | |
External ("user") heap.
This file implements an external heap (for umalloc()) that grows downwards from the top of the largest contiguous accessible block in the system memory map.
Definition in file uheap.c.
| #define UHEAP_ALIGN PAGE_SIZE |
Alignment for external heap allocations.
Historically, umalloc() has produced page-aligned allocations, and the hidden region in the system memory map has been aligned to a page boundary. Preserve this behaviour, to avoid needing to inspect and update large amounts of driver code, and also because it keeps the resulting memory maps easy to read.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Adjust size of external heap in-use memory region.
| delta | Size change |
Definition at line 72 of file uheap.c.
References assert(), DBGC, memmap_dump_all(), memmap_use(), uheap, UHEAP_ALIGN, uheap_end, uheap_limit, and uheap_start.
Referenced by uheap_find(), uheap_grow(), and uheap_shrink().
|
static |
Find an external heap region.
Definition at line 92 of file uheap.c.
References after, assert(), before, DBGC, end, memmap_largest(), size, start, uheap, UHEAP_ALIGN, uheap_end, uheap_limit, uheap_resize(), and uheap_start.
Referenced by uheap_grow().
|
static |
Attempt to grow external heap.
| size | Failed allocation size |
| grown | Heap has grown: retry allocations |
Definition at line 135 of file uheap.c.
References heap_populate(), size, uheap, uheap_end, uheap_find(), uheap_limit, uheap_resize(), and uheap_start.
|
static |
Allow external heap to shrink.
| ptr | Start of free block |
| size | Size of free block |
| shrunk | Heap has shrunk: discard block |
Definition at line 161 of file uheap.c.
References size, uheap_resize(), and uheap_start.
|
static |
Reallocate external memory.
| old_ptr | Memory previously allocated by umalloc(), or NULL |
| new_size | Requested size |
| new_ptr | Allocated memory, or NULL |
Calling urealloc() with a new size of zero is a valid way to free a memory block.
Definition at line 192 of file uheap.c.
References heap_realloc(), and uheap.
| PROVIDE_UMALLOC | ( | uheap | , |
| urealloc | , | ||
| uheap_realloc | |||
| ) |
|
static |
The external heap.
Definition at line 51 of file uheap.c.
Referenced by uheap_find(), uheap_grow(), uheap_realloc(), and uheap_resize().
| physaddr_t uheap_limit |
Minimum possible start of external heap.
Definition at line 54 of file uheap.c.
Referenced by initrd_region(), initrd_reshuffle(), uheap_find(), uheap_grow(), and uheap_resize().
| physaddr_t uheap_start |
Start of external heap.
Definition at line 57 of file uheap.c.
Referenced by initrd_startup(), int15_sync(), uheap_find(), uheap_grow(), uheap_resize(), and uheap_shrink().
| physaddr_t uheap_end |
End of external heap.
Definition at line 60 of file uheap.c.
Referenced by initrd_region(), initrd_reshuffle(), int15_sync(), uheap_find(), uheap_grow(), and uheap_resize().
| struct used_region uheap_used __used_region |
1.8.15