summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco José García García2016-10-03 20:19:11 +0200
committerFrancisco José García García2016-10-03 20:19:11 +0200
commit6bfb7e1b479923c084fd9d8645fa00faac4b3d93 (patch)
tree15fcf6e6c71d0177c463942244bdc662da14c79b
parent24cbebe2de483639f83c16452375831f7994fab8 (diff)
downloadpicogpsp-6bfb7e1b479923c084fd9d8645fa00faac4b3d93.tar.gz
picogpsp-6bfb7e1b479923c084fd9d8645fa00faac4b3d93.tar.bz2
picogpsp-6bfb7e1b479923c084fd9d8645fa00faac4b3d93.zip
(VITA) Dynarec working
-rw-r--r--Makefile3
-rw-r--r--arm/arm_emit.h5
-rw-r--r--cpu_threaded.c29
-rw-r--r--libretro.c20
4 files changed, 32 insertions, 25 deletions
diff --git a/Makefile b/Makefile
index 9ddbd54..b7b35a5 100644
--- a/Makefile
+++ b/Makefile
@@ -196,13 +196,14 @@ else ifeq ($(platform), vita)
CC = arm-vita-eabi-gcc$(EXE_EXT)
AR = arm-vita-eabi-ar$(EXE_EXT)
CFLAGS += -DVITA
- CFLAGS += -mcpu=cortex-a9 -mfloat-abi=hard
+ CFLAGS += -marm -mcpu=cortex-a9 -mfloat-abi=hard
CFLAGS += -Wall -mword-relocations
CFLAGS += -fomit-frame-pointer -ffast-math
CFLAGS += -mword-relocations -fno-unwind-tables -fno-asynchronous-unwind-tables
CFLAGS += -ftree-vectorize -fno-optimize-sibling-calls
ASFLAGS += -mcpu=cortex-a9
STATIC_LINKING = 1
+ HAVE_DYNAREC = 1
CPU_ARCH := arm
# CTR(3DS)
diff --git a/arm/arm_emit.h b/arm/arm_emit.h
index 185caef..c40d1ce 100644
--- a/arm/arm_emit.h
+++ b/arm/arm_emit.h
@@ -21,10 +21,7 @@
#define ARM_EMIT_H
#include "arm_codegen.h"
-#if defined(VITA)
-#define VITA_RW_INIT sceKernelOpenVMDomain
-#define VITA_RW_END sceKernelCloseVMDomain
-#endif
+
u32 arm_update_gba_arm(u32 pc);
u32 arm_update_gba_thumb(u32 pc);
u32 arm_update_gba_idle_arm(u32 pc);
diff --git a/cpu_threaded.c b/cpu_threaded.c
index 63f258d..f740502 100644
--- a/cpu_threaded.c
+++ b/cpu_threaded.c
@@ -260,12 +260,21 @@ static INLINE void RW_END(void)
#if defined(PSP_BUILD)
#define translate_invalidate_dcache() sceKernelDcacheWritebackAll()
#elif defined(VITA)
-#define translate_invalidate_dcache() (void)0
+#define translate_invalidate_dcache_one(which) \
+ if (which##_translation_ptr > last_##which##_translation_ptr) \
+ { \
+ sceKernelSyncVMDomain(sceBlock,last_##which##_translation_ptr, \
+ which##_translation_ptr - last_##which##_translation_ptr); \
+ }
-#define invalidate_icache_region(addr, size) \
-{ \
- int ret = sceKernelSyncVMDomain(sceBlock, addr, size); \
-}
+#define translate_invalidate_dcache() \
+{ \
+ translate_invalidate_dcache_one(rom) \
+ translate_invalidate_dcache_one(ram) \
+ translate_invalidate_dcache_one(bios) \
+}
+
+#define invalidate_icache_region(addr, size) (void)0
#elif defined(_3DS)
#include "3ds/3ds_utils.h"
@@ -2854,7 +2863,7 @@ u8 *block_lookup_address_##type(u32 pc) \
/* Starting at the beginning, we allow for one translation cache flush. */ \
if(translation_recursion_level == 0){ \
translation_flush_count = 0; \
- RW_INIT(); \
+ RW_INIT(); \
} \
block_lookup_address_pc_##type(); \
\
@@ -2950,8 +2959,6 @@ u8 *block_lookup_address_##type(u32 pc) \
block_address = (u8 *)(-1); \
break; \
} \
- if(translation_recursion_level == 0) \
- RW_END(); \
\
return block_address; \
} \
@@ -3415,7 +3422,6 @@ s32 translate_block_arm(u32 pc, translation_region_type
flush_translation_cache_bios();
break;
}
- RW_END();
return -1;
}
@@ -3493,13 +3499,11 @@ s32 translate_block_arm(u32 pc, translation_region_type
branch_target = external_block_exits[i].branch_target;
arm_link_block();
if(!translation_target){
- RW_END();
return -1;
}
generate_branch_patch_unconditional(
external_block_exits[i].branch_source, translation_target);
}
- RW_END();
return 0;
}
@@ -3635,7 +3639,6 @@ s32 translate_block_thumb(u32 pc, translation_region_type
flush_translation_cache_bios();
break;
}
- RW_END();
return -1;
}
@@ -3713,13 +3716,11 @@ s32 translate_block_thumb(u32 pc, translation_region_type
branch_target = external_block_exits[i].branch_target;
thumb_link_block();
if(!translation_target){
- RW_END();
return -1;
}
generate_branch_patch_unconditional(
external_block_exits[i].branch_source, translation_target);
}
- RW_END();
return 0;
}
diff --git a/libretro.c b/libretro.c
index 00dfe55..d0081da 100644
--- a/libretro.c
+++ b/libretro.c
@@ -19,6 +19,12 @@ static inline int align(int x, int n) {
#define FOUR_KB_ALIGN(x) align(x, 12)
#define MB_ALIGN(x) align(x, 20)
+int _newlib_vm_size_user = ROM_TRANSLATION_CACHE_SIZE +
+ RAM_TRANSLATION_CACHE_SIZE +
+ BIOS_TRANSLATION_CACHE_SIZE;
+
+int getVMBlock();
+
#endif
#if defined(_3DS)
@@ -163,9 +169,8 @@ void retro_init(void)
if(!translation_caches_inited){
void* currentHandle;
- sceBlock = sceKernelAllocMemBlockForVM("code", MB_ALIGN(FOUR_KB_ALIGN(ROM_TRANSLATION_CACHE_SIZE +
- RAM_TRANSLATION_CACHE_SIZE +
- BIOS_TRANSLATION_CACHE_SIZE)));
+ sceBlock = getVMBlock();
+
if (sceBlock < 0)
{
return;
@@ -237,9 +242,7 @@ void retro_deinit(void)
#if defined(VITA) && defined(HAVE_DYNAREC)
if(translation_caches_inited){
- sceKernelFreeMemBlock(sceBlock);
-
- translation_caches_inited = 0;
+ translation_caches_inited = 0;
}
#endif
@@ -438,6 +441,11 @@ bool retro_load_game(const struct retro_game_info* info)
rom_translation_ptr = rom_translation_cache;
ram_translation_ptr = ram_translation_cache;
bios_translation_ptr = bios_translation_cache;
+#elif defined(VITA)
+ dynarec_enable = 1;
+ rom_translation_ptr = rom_translation_cache;
+ ram_translation_ptr = ram_translation_cache;
+ bios_translation_ptr = bios_translation_cache;
#endif
}
else