mirror of
https://github.com/libretro/RetroArch
synced 2025-03-24 13:43:32 +00:00
[VITA] Make newlib heap allocation dynamic.
This commit is contained in:
parent
9ea18c433b
commit
b3316fea35
@ -158,7 +158,7 @@ $(TARGET).elf: $(OBJ) libretro_vita.a
|
||||
vita-make-fself -c -s $< $@
|
||||
|
||||
%.vpk: %.self
|
||||
vita-mksfoex -s TITLE_ID=$(VITA_TITLE_ID) "$(VITA_TITLE_NAME)" param.sfo
|
||||
vita-mksfoex -s TITLE_ID=$(VITA_TITLE_ID) "$(VITA_TITLE_NAME)" -d ATTRIBUTE2=12 param.sfo
|
||||
vita-pack-vpk -s param.sfo -b $< $@
|
||||
|
||||
clean:
|
||||
|
@ -55,7 +55,7 @@ OBJS = frontend/frontend_salamander.o \
|
||||
all: $(TARGET).vpk
|
||||
|
||||
%.vpk: eboot.bin
|
||||
vita-mksfoex -s TITLE_ID=$(TITLE_ID) "$(TARGET)" param.sfo
|
||||
vita-mksfoex -s TITLE_ID=$(TITLE_ID) "$(TARGET)" -d ATTRIBUTE2=12 param.sfo
|
||||
vita-pack-vpk -s param.sfo -b eboot.bin $@
|
||||
|
||||
eboot.bin: $(TARGET).velf
|
||||
|
@ -4,9 +4,11 @@
|
||||
#include <psp2/kernel/sysmem.h>
|
||||
#include <psp2/kernel/threadmgr.h>
|
||||
|
||||
#define RAM_THRESHOLD 0xA00000 // Memory left to the system for threads and other internal stuffs
|
||||
|
||||
static int _newlib_heap_memblock;
|
||||
static unsigned _newlib_heap_size;
|
||||
static char *_newlib_heap_base, *_newlib_heap_end, *_newlib_heap_cur;
|
||||
char *_newlib_heap_base, *_newlib_heap_end, *_newlib_heap_cur;
|
||||
static char _newlib_sbrk_mutex[32] __attribute__ ((aligned (8)));
|
||||
|
||||
static int _newlib_vm_memblock;
|
||||
@ -50,11 +52,16 @@ void _init_vita_heap(void) {
|
||||
if (sceKernelCreateLwMutex((struct SceKernelLwMutexWork*)_newlib_sbrk_mutex, "sbrk mutex", 0, 0, 0) < 0) {
|
||||
goto failure;
|
||||
}
|
||||
|
||||
// Always allocating the max avaliable USER_RW mem on the system
|
||||
SceKernelFreeMemorySizeInfo info;
|
||||
info.size = sizeof(SceKernelFreeMemorySizeInfo);
|
||||
sceKernelGetFreeMemorySize(&info);
|
||||
|
||||
if (&_newlib_heap_size_user != NULL) {
|
||||
_newlib_heap_size = _newlib_heap_size_user;
|
||||
}else{
|
||||
_newlib_heap_size = 256 * 1024 * 1024;
|
||||
_newlib_heap_size = info.size_user - RAM_THRESHOLD;
|
||||
}
|
||||
|
||||
_newlib_heap_size -= _newlib_vm_size;
|
||||
|
Loading…
x
Reference in New Issue
Block a user