mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-23 21:32:39 +02:00
Improving heap init a little
This commit is contained in:
parent
a1815dd7b9
commit
94683c43d1
@ -32,9 +32,19 @@ void heapInit(void* base, size_t size) {
|
|||||||
|
|
||||||
void heapSetup() {
|
void heapSetup() {
|
||||||
// Called by crt0.
|
// Called by crt0.
|
||||||
#define HEAP_SIZE 0x1000000
|
#define INNER_HEAP_SIZE 0x20000
|
||||||
static u8 g_Heap[HEAP_SIZE];
|
#define OUTER_HEAP_SIZE (0x2000000*4)
|
||||||
heapInit(&g_Heap[0], HEAP_SIZE);
|
|
||||||
|
void* addr;
|
||||||
|
Result rc = svcSetHeapSize(&addr, OUTER_HEAP_SIZE);
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(rc)) {
|
||||||
|
heapInit(addr, OUTER_HEAP_SIZE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
static u8 g_Heap[INNER_HEAP_SIZE];
|
||||||
|
heapInit(&g_Heap[0], INNER_HEAP_SIZE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void* heapAllocPages(size_t size) {
|
void* heapAllocPages(size_t size) {
|
||||||
|
Loading…
Reference in New Issue
Block a user