lib: c: update libheap to use new address-space api
This commit is contained in:
@@ -38,14 +38,10 @@ static kern_status_t init_heap_region(heap_t *heap)
|
||||
task_get_address_space(self, &address_space);
|
||||
kern_handle_close(self);
|
||||
|
||||
kern_status_t status = vm_region_create(
|
||||
kern_status_t status = address_space_reserve(
|
||||
address_space,
|
||||
"libc-heap",
|
||||
9,
|
||||
VM_REGION_ANY_OFFSET,
|
||||
MAP_ADDRESS_ANY,
|
||||
HEAP_REGION_SIZE,
|
||||
VM_PROT_READ | VM_PROT_WRITE | VM_PROT_USER,
|
||||
&heap->heap_region,
|
||||
&heap->heap_base);
|
||||
|
||||
kern_handle_close(address_space);
|
||||
@@ -72,9 +68,14 @@ static kern_status_t expand_heap(heap_t *heap)
|
||||
|
||||
virt_addr_t base = 0;
|
||||
|
||||
status = vm_region_map_relative(
|
||||
heap->heap_region,
|
||||
heap->heap_sys_alloc,
|
||||
kern_handle_t self, address_space;
|
||||
task_self(&self);
|
||||
task_get_address_space(self, &address_space);
|
||||
kern_handle_close(self);
|
||||
|
||||
status = address_space_map(
|
||||
address_space,
|
||||
heap->heap_base + heap->heap_sys_alloc,
|
||||
vmo,
|
||||
0,
|
||||
HEAP_EXPAND_INCREMENT,
|
||||
@@ -90,7 +91,7 @@ static kern_status_t expand_heap(heap_t *heap)
|
||||
void *heap_expand(heap_t *heap, size_t size)
|
||||
{
|
||||
kern_status_t status = KERN_OK;
|
||||
if (heap->heap_region == KERN_HANDLE_INVALID) {
|
||||
if (!heap->heap_base) {
|
||||
status = init_heap_region(heap);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user