Heap initialisation failure now results in abort() being called

This commit is contained in:
2022-05-24 21:34:06 +01:00
parent 973b8255ae
commit c37b591d33

View File

@@ -29,16 +29,25 @@ void __crt_heap_init(size_t sz)
mx_status_t status = mx_vmar_allocate(root_vmar,
MX_VM_CAN_MAP_READ | MX_VM_CAN_MAP_WRITE | MX_VM_CAN_MAP_SPECIFIC,
0, HEAP_REGION_SZ, &heap_vmar, &heap);
if (status != MX_OK) {
abort();
}
status = mx_vmo_create(
sz,
MX_VM_CAN_MAP_READ | MX_VM_CAN_MAP_WRITE | MX_VM_CAN_MAP_SPECIFIC,
&heap_vmo);
if (status != MX_OK) {
abort();
}
mx_vmar_map(heap_vmar,
status = mx_vmar_map(heap_vmar,
MX_VM_PERM_READ | MX_VM_PERM_WRITE | MX_VM_SPECIFIC,
0, heap_vmo, 0, sz,
&heap);
if (status != MX_OK) {
abort();
}
heap_sz = sz;
heap_start = heap;