(VITA) Dynarec working

This commit is contained in:
lentillog
2016-09-30 23:44:49 -07:00
parent 36745acc51
commit 88f7643f70
5 changed files with 42 additions and 8 deletions

View File

@@ -2,7 +2,11 @@ TARGET ?= PicoDrive
CFLAGS += -Wall
CFLAGS += -I. -DINLINE=inline
ifndef DEBUG
ifeq ($(platform), vita)
CFLAGS += -O3 -DNDEBUG
else
CFLAGS += -O2 -DNDEBUG -ffunction-sections
endif
ifneq ($(APPLE),1)
LDFLAGS += -Wl,--gc-sections
endif

View File

@@ -263,8 +263,10 @@ else ifeq ($(platform), vita)
CC = arm-vita-eabi-gcc$(EXE_EXT)
AR = arm-vita-eabi-ar$(EXE_EXT)
CFLAGS += -DVITA
CFLAGS += -mfloat-abi=hard -ffast-math -mword-relocations -fno-optimize-sibling-calls
CFLAGS += -marm -mfpu=neon -mcpu=cortex-a9 -march=armv7-a
CFLAGS += -marm -mfpu=neon -mcpu=cortex-a9 -march=armv7-a -mfloat-abi=hard -ffast-math
CFLAGS += -fno-asynchronous-unwind-tables -ftree-vectorize -funroll-loops
CFLAGS += -mword-relocations -fno-unwind-tables
CFLAGS += -fno-optimize-sibling-calls
STATIC_LINKING = 1
NO_MMAP = 1
DONT_COMPILE_IN_ZLIB = 1
@@ -274,15 +276,15 @@ else ifeq ($(platform), vita)
asm_render = 1
asm_ym2612 = 1
asm_misc = 1
asm_cdpico = 0
asm_cdmemory = 0
asm_cdpico = 1
asm_cdmemory = 1
asm_mix = 1
use_cyclone = 1
use_fame = 0
use_drz80 = 1
use_cz80 = 0
use_sh2drc = 0
use_svpdrc = 0
use_sh2drc = 1
use_svpdrc = 1
# Xbox 360
else ifeq ($(platform), xenon)

View File

@@ -12,6 +12,11 @@
#ifdef _MSC_VER
u8 tcache[DRC_TCACHE_SIZE];
#elif defined(VITA)
#include <psp2/kernel/sysmem.h>
u8 *tcache;
static int sceBlock;
int getVMBlock();
#else
u8 __attribute__((aligned(4096))) tcache[DRC_TCACHE_SIZE];
#endif
@@ -19,6 +24,11 @@ u8 __attribute__((aligned(4096))) tcache[DRC_TCACHE_SIZE];
void drc_cmn_init(void)
{
#ifdef VITA
sceBlock = getVMBlock();
sceKernelGetMemBlockBase(sceBlock, (void **)&tcache);
#endif
int ret = plat_mem_set_exec(tcache, sizeof(tcache));
elprintf(EL_STATUS, "drc_cmn_init: %p, %zd bytes: %d",
tcache, sizeof(tcache), ret);

View File

@@ -5,7 +5,11 @@ typedef unsigned int u32;
#define DRC_TCACHE_SIZE (2*1024*1024)
#ifdef VITA
extern u8 *tcache;
#else
extern u8 tcache[DRC_TCACHE_SIZE];
#endif
void drc_cmn_init(void);
void drc_cmn_cleanup(void);

View File

@@ -38,6 +38,15 @@ void* linearMemAlign(size_t size, size_t alignment);
void linearFree(void* mem);
static int ctr_svchack_successful = 0;
#elif defined(VITA)
#define TARGET_SIZE_2 24 // 2^24 = 16 megabytes
#include <psp2/kernel/sysmem.h>
static int sceBlock;
int getVMBlock();
int _newlib_vm_size_user = 1 << TARGET_SIZE_2;
#endif
#include <pico/pico_int.h>
@@ -83,14 +92,16 @@ static void snd_write(int len);
void cache_flush_d_inval_i(void *start, void *end)
{
#ifdef __arm__
size_t len = (char *)end - (char *)start;
#if defined(__BLACKBERRY_QNX__)
msync(start, end - start, MS_SYNC | MS_CACHE_ONLY | MS_INVALIDATE_ICACHE);
#elif defined(__MACH__)
size_t len = (char *)end - (char *)start;
sys_dcache_flush(start, len);
sys_icache_invalidate(start, len);
#elif defined(_3DS)
ctr_flush_invalidate_cache();
#elif defined(VITA)
sceKernelSyncVMDomain(sceBlock, start, len);
#else
__clear_cache(start, end);
#endif
@@ -444,7 +455,8 @@ int plat_mem_set_exec(void *ptr, size_t size)
exit(1);
}
#elif defined(VITA)
int ret = sceKernelOpenVMDomain();
#else
int ret = mprotect(ptr, size, PROT_READ | PROT_WRITE | PROT_EXEC);
if (ret != 0 && log_cb)
@@ -1251,6 +1263,8 @@ void retro_init(void)
#ifdef _3DS
ctr_svchack_successful = ctr_svchack_init();
#elif defined(VITA)
sceBlock = getVMBlock();
#endif
PicoOpt = POPT_EN_STEREO|POPT_EN_FM|POPT_EN_PSG|POPT_EN_Z80