mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-16 15:27:41 +00:00
(CTR/3DS) increase the default size of the linear heap.
makefile: allow changing stack/linear heap size without requiring a clean.
This commit is contained in:
parent
303fd1daed
commit
b7be1862a3
11
Makefile.ctr
11
Makefile.ctr
@ -28,7 +28,7 @@ CTR_STACK_SIZE = 0x400000
|
||||
else
|
||||
CTR_STACK_SIZE = 0x100000
|
||||
endif
|
||||
CTR_LINEAR_HEAP_SIZE = 0xC00000
|
||||
CTR_LINEAR_HEAP_SIZE = 0xD00000
|
||||
|
||||
include ctr/Makefile.cores
|
||||
|
||||
@ -42,9 +42,11 @@ endif
|
||||
APP_SYSTEM_MODE_EXT = 6
|
||||
|
||||
|
||||
CONFIG_OBJECT = ctr/ctr_config_$(CTR_STACK_SIZE)_$(CTR_LINEAR_HEAP_SIZE).o
|
||||
|
||||
OBJS :=
|
||||
OBJS += gfx/drivers/ctr_sprite.o
|
||||
|
||||
OBJS += $(CONFIG_OBJECT)
|
||||
ifeq ($(GRIFFIN_BUILD), 1)
|
||||
OBJS += griffin/griffin.o
|
||||
else
|
||||
@ -359,6 +361,10 @@ else
|
||||
endif
|
||||
|
||||
|
||||
$(CONFIG_OBJECT): ctr/ctr_config.c
|
||||
rm -f ctr/ctr_config_*.o
|
||||
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS)
|
||||
|
||||
%.o: %.shader
|
||||
python $(AEMSTRO)/aemstro_as.py $< $(notdir $<).shbin
|
||||
$(DEVKITARM)/bin/bin2s $(notdir $<).shbin | $(PREFIX)as -o $@
|
||||
@ -417,6 +423,7 @@ clean:
|
||||
rm -f $(TARGET).bnr
|
||||
rm -f $(TARGET).icn
|
||||
rm -f *_shader_shbin.h
|
||||
rm -f ctr/ctr_config_*.o
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
|
12
ctr/ctr_config.c
Normal file
12
ctr/ctr_config.c
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
|
||||
#ifndef CTR_STACK_SIZE
|
||||
#define CTR_STACK_SIZE 0x100000
|
||||
#endif
|
||||
|
||||
#ifndef CTR_LINEAR_HEAP_SIZE
|
||||
#define CTR_LINEAR_HEAP_SIZE 0x600000
|
||||
#endif
|
||||
|
||||
int __stacksize__ = CTR_STACK_SIZE;
|
||||
unsigned int linear_heap_size = CTR_LINEAR_HEAP_SIZE;
|
@ -46,21 +46,12 @@ void wait_for_input(void);
|
||||
|
||||
#define CTR_APPMEMALLOC_PTR ((u32*)0x1FF80040)
|
||||
|
||||
#ifndef CTR_STACK_SIZE
|
||||
#define CTR_STACK_SIZE 0x100000
|
||||
#endif
|
||||
|
||||
#ifndef CTR_LINEAR_HEAP_SIZE
|
||||
#define CTR_LINEAR_HEAP_SIZE 0x600000
|
||||
#endif
|
||||
|
||||
int __stacksize__ = CTR_STACK_SIZE;
|
||||
|
||||
extern char* fake_heap_start;
|
||||
extern char* fake_heap_end;
|
||||
u32 __linear_heap;
|
||||
u32 __heapBase;
|
||||
static u32 __heap_size_local, __linear_heap_size_local;
|
||||
static u32 heap_size;
|
||||
extern u32 linear_heap_size;
|
||||
|
||||
extern void (*__system_retAddr)(void);
|
||||
|
||||
@ -79,18 +70,17 @@ void __system_allocateHeaps() {
|
||||
|
||||
svcGetSystemInfo(&mem_used, 0, 1);
|
||||
|
||||
__linear_heap_size_local = CTR_LINEAR_HEAP_SIZE;
|
||||
__heap_size_local = (app_memory - mem_used - __linear_heap_size_local - 0x10000) & 0xFFFFF000;
|
||||
heap_size = (app_memory - mem_used - linear_heap_size - 0x10000) & 0xFFFFF000;
|
||||
|
||||
// Allocate the application heap
|
||||
__heapBase = 0x08000000;
|
||||
svcControlMemory(&tmp, __heapBase, 0x0, __heap_size_local, MEMOP_ALLOC, MEMPERM_READ | MEMPERM_WRITE);
|
||||
svcControlMemory(&tmp, __heapBase, 0x0, heap_size, MEMOP_ALLOC, MEMPERM_READ | MEMPERM_WRITE);
|
||||
|
||||
// Allocate the linear heap
|
||||
svcControlMemory(&__linear_heap, 0x0, 0x0, __linear_heap_size_local, MEMOP_ALLOC_LINEAR, MEMPERM_READ | MEMPERM_WRITE);
|
||||
svcControlMemory(&__linear_heap, 0x0, 0x0, linear_heap_size, MEMOP_ALLOC_LINEAR, MEMPERM_READ | MEMPERM_WRITE);
|
||||
// Set up newlib heap
|
||||
fake_heap_start = (char*)__heapBase;
|
||||
fake_heap_end = fake_heap_start + __heap_size_local;
|
||||
fake_heap_end = fake_heap_start + heap_size;
|
||||
|
||||
}
|
||||
|
||||
@ -99,10 +89,10 @@ void __attribute__((noreturn)) __libctru_exit(int rc)
|
||||
u32 tmp=0;
|
||||
|
||||
// Unmap the linear heap
|
||||
svcControlMemory(&tmp, __linear_heap, 0x0, __linear_heap_size_local, MEMOP_FREE, 0x0);
|
||||
svcControlMemory(&tmp, __linear_heap, 0x0, linear_heap_size, MEMOP_FREE, 0x0);
|
||||
|
||||
// Unmap the application heap
|
||||
svcControlMemory(&tmp, __heapBase, 0x0, __heap_size_local, MEMOP_FREE, 0x0);
|
||||
svcControlMemory(&tmp, __heapBase, 0x0, heap_size, MEMOP_FREE, 0x0);
|
||||
|
||||
// Close some handles
|
||||
__destroy_handle_list();
|
||||
|
@ -60,7 +60,7 @@ void wait_for_input(void);
|
||||
extern Handle gspEvents[GSPEVENT_MAX];
|
||||
extern u32* gpuCmdBuf;
|
||||
extern u32 gpuCmdBufOffset;
|
||||
extern u32 __linear_heap_size;
|
||||
extern u32 linear_heap_size;
|
||||
extern u32 __linear_heap;
|
||||
|
||||
__attribute__((always_inline))
|
||||
@ -126,7 +126,7 @@ __attribute__((always_inline))
|
||||
static INLINE void ctrGuFlushAndRun(bool queued)
|
||||
{
|
||||
//take advantage of GX_SetCommandList_First to flush gsp heap
|
||||
ctrGuSetCommandList_First(queued, gpuCmdBuf, gpuCmdBufOffset*4, (u32*)__linear_heap, __linear_heap_size, NULL, 0);
|
||||
ctrGuSetCommandList_First(queued, gpuCmdBuf, gpuCmdBufOffset*4, (u32*)__linear_heap, linear_heap_size, NULL, 0);
|
||||
ctrGuSetCommandList_Last(queued, gpuCmdBuf, gpuCmdBufOffset*4, 0x0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user