abort() is now called if a heap mapping fails
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <magenta/vmo.h>
|
||||
#include <magenta/bootstrap.h>
|
||||
#include <magenta/errors.h>
|
||||
#include <magenta/misc.h>
|
||||
#include <magenta/vmar.h>
|
||||
|
||||
#define ROUND_UP(x, b) x += (b) - ((x) % (b))
|
||||
@@ -56,9 +60,15 @@ void *__crt_heap_extend(size_t sz)
|
||||
mx_vmar_bounds(mx_bootstrap_handle_get(MX_B_VMAR_ROOT), &vmar_base, NULL);
|
||||
size_t offset = heap_end - vmar_base;
|
||||
|
||||
mx_vmar_map(mx_bootstrap_handle_get(MX_B_VMAR_ROOT),
|
||||
mx_status_t err = mx_vmar_map(mx_bootstrap_handle_get(MX_B_VMAR_ROOT),
|
||||
MX_VM_PERM_READ | MX_VM_PERM_WRITE | MX_VM_SPECIFIC,
|
||||
offset, heap_vmo, heap_sz, sz, &alloc_base);
|
||||
|
||||
if (err != MX_OK) {
|
||||
printf("cannot map extended heap: %s\n", mx_status_to_string(err));
|
||||
abort();
|
||||
}
|
||||
|
||||
heap_sz += sz;
|
||||
|
||||
void *out = (void *)heap_end;
|
||||
|
||||
Reference in New Issue
Block a user