Add preliminary support for PS2 devices

This commit is contained in:
David Guillen Fandos 2021-07-22 18:30:45 +02:00
parent a77c1c9171
commit 60155e0b81
3 changed files with 23 additions and 2 deletions

View File

@ -396,6 +396,18 @@ else ifeq ($(platform), mips64n32)
HAVE_DYNAREC := 1
CPU_ARCH := mips
# PS2
else ifeq ($(platform), ps2)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = mips64r5900el-ps2-elf-gcc$(EXE_EXT)
AR = mips64r5900el-ps2-elf-ar$(EXE_EXT)
CFLAGS += -fomit-frame-pointer -ffast-math
CFLAGS += -DPS2 -DUSE_XBGR1555_FORMAT -DROM_BUFFER_SIZE=12
CFLAGS += -D_EE -I$(PS2SDK)/ee/include/ -I$(PS2SDK)/common/include/
HAVE_DYNAREC = 1
CPU_ARCH := mips
STATIC_LINKING = 1
# emscripten
else ifeq ($(platform), emscripten)
TARGET := $(TARGET_NAME)_libretro_$(platform).bc

View File

@ -25,6 +25,8 @@
#if defined(VITA)
#include <psp2/kernel/sysmem.h>
#include <stdio.h>
#elif defined(PS2)
#include <kernel.h>
#endif
u8 *last_rom_translation_ptr = NULL;
@ -212,6 +214,11 @@ extern u8 bit_count[256];
sceKernelDcacheWritebackRange(baseaddr, ((char*)endptr) - ((char*)baseaddr));
sceKernelIcacheInvalidateRange(baseaddr, ((char*)endptr) - ((char*)baseaddr));
}
#elif defined(PS2)
void platform_cache_sync(void *baseaddr, void *endptr) {
FlushCache(0); // Dcache flush
FlushCache(2); // Icache invalidate
}
#elif defined(VITA)
void platform_cache_sync(void *baseaddr, void *endptr) {
sceKernelSyncVMDomain(sceBlock, baseaddr, ((char*)endptr) - ((char*)baseaddr) + 64);

View File

@ -3205,13 +3205,15 @@ static void emit_phand(
mips_emit_lw(reg_temp, reg_temp, tbloff2); // Get opcode from 2nd table
mips_emit_sw(reg_temp, mips_reg_ra, -8); // Patch instruction!
#ifdef PSP
#if defined(PSP)
mips_emit_cache(0x1A, mips_reg_ra, -8);
mips_emit_jr(reg_rv); // Jump directly to target for speed
mips_emit_cache(0x08, mips_reg_ra, -8);
#else
mips_emit_jr(reg_rv);
mips_emit_synci(mips_reg_ra, -8);
#ifdef MIPS_HAS_R2_INSTS
mips_emit_synci(mips_reg_ra, -8);
#endif
#endif
// Round up handlers to 16 instructions for easy addressing