libc: malloc: store the global heap in a fixed region of virtual memory
This commit is contained in:
@@ -30,5 +30,5 @@ sysroot_add_library(
|
||||
HEADER_DIR /usr/include
|
||||
LIB_DIR /usr/lib)
|
||||
|
||||
target_compile_definitions(libc-malloc PRIVATE ENABLE_GLOBAL_HEAP=1)
|
||||
target_compile_definitions(libc-malloc PRIVATE LIBC_STATIC=1 ENABLE_GLOBAL_HEAP=1)
|
||||
target_link_libraries(libc-malloc libc-core libmagenta)
|
||||
|
||||
@@ -8,6 +8,12 @@
|
||||
#include <magenta/vm.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(LIBC_STATIC)
|
||||
#define HEAP_REGION_BASE 0x20000000000
|
||||
#else
|
||||
#define HEAP_REGION_BASE 0x60000000000
|
||||
#endif
|
||||
|
||||
#define HEAP_REGION_SIZE 0x40000000
|
||||
#define HEAP_EXPAND_INCREMENT 0x100000
|
||||
|
||||
@@ -40,7 +46,7 @@ static kern_status_t init_heap_region(heap_t *heap)
|
||||
|
||||
kern_status_t status = address_space_reserve(
|
||||
address_space,
|
||||
MAP_ADDRESS_ANY,
|
||||
HEAP_REGION_BASE,
|
||||
HEAP_REGION_SIZE,
|
||||
&heap->heap_base);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user