mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-04 23:07:46 -04:00
Add dynarec support for PS3
This commit is contained in:
parent
0512a22869
commit
08be5f1dab
3 changed files with 31 additions and 4 deletions
|
@ -188,13 +188,9 @@ else ifneq (,$(filter $(platform), ps3 psl1ght))
|
||||||
CFLAGS += -DFAMEC_NO_GOTOS -D__PS3__
|
CFLAGS += -DFAMEC_NO_GOTOS -D__PS3__
|
||||||
STATIC_LINKING = 1
|
STATIC_LINKING = 1
|
||||||
STATIC_LINKING_LINK = 1
|
STATIC_LINKING_LINK = 1
|
||||||
NO_MMAP = 1
|
|
||||||
ifeq ($(platform), psl1ght)
|
ifeq ($(platform), psl1ght)
|
||||||
FLAGS += -D__PSL1GHT__
|
FLAGS += -D__PSL1GHT__
|
||||||
endif
|
endif
|
||||||
# PS3 has memory mapped in a way not suitable for DRC
|
|
||||||
use_sh2drc = 0
|
|
||||||
use_svpdrc = 0
|
|
||||||
|
|
||||||
# PSP
|
# PSP
|
||||||
else ifeq ($(platform), psp1)
|
else ifeq ($(platform), psp1)
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
// reserved: r0(zero), r1(stack), r2(TOC), r13(TID)
|
// reserved: r0(zero), r1(stack), r2(TOC), r13(TID)
|
||||||
// additionally reserved on OSX: r31(PIC), r30(frame), r11(parentframe)
|
// additionally reserved on OSX: r31(PIC), r30(frame), r11(parentframe)
|
||||||
// for OSX PIC code, on function calls r12 must contain the called address
|
// for OSX PIC code, on function calls r12 must contain the called address
|
||||||
|
#define TOC_REG 2
|
||||||
#define RET_REG 3
|
#define RET_REG 3
|
||||||
#define PARAM_REGS { 3, 4, 5, 6, 7, 8, 9, 10 }
|
#define PARAM_REGS { 3, 4, 5, 6, 7, 8, 9, 10 }
|
||||||
#define PRESERVED_REGS { 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 }
|
#define PRESERVED_REGS { 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 }
|
||||||
|
@ -1506,19 +1507,36 @@ static int emith_cond_check(int cond)
|
||||||
#define emith_call_cond(cond, target) \
|
#define emith_call_cond(cond, target) \
|
||||||
emith_call(target)
|
emith_call(target)
|
||||||
|
|
||||||
|
#ifdef __PS3__
|
||||||
|
#define emith_call_reg(r) do { \
|
||||||
|
emith_read_r_r_offs_ptr(TOC_REG, r, 8); \
|
||||||
|
emith_read_r_r_offs_ptr(r, r, 0); \
|
||||||
|
EMIT(PPC_MTSP_REG(r, CTR)); \
|
||||||
|
EMIT(PPC_BLCTRCOND(BXX)); \
|
||||||
|
} while(0)
|
||||||
|
#else
|
||||||
#define emith_call_reg(r) do { \
|
#define emith_call_reg(r) do { \
|
||||||
EMIT(PPC_MTSP_REG(r, CTR)); \
|
EMIT(PPC_MTSP_REG(r, CTR)); \
|
||||||
EMIT(PPC_BLCTRCOND(BXX)); \
|
EMIT(PPC_BLCTRCOND(BXX)); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define emith_abicall_ctx(offs) do { \
|
#define emith_abicall_ctx(offs) do { \
|
||||||
emith_ctx_read_ptr(CR, offs); \
|
emith_ctx_read_ptr(CR, offs); \
|
||||||
emith_call_reg(CR); \
|
emith_call_reg(CR); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#ifdef __PS3__
|
||||||
|
#define emith_abijump_reg(r) \
|
||||||
|
if ((r) != CR) emith_move_r_r(CR, r); \
|
||||||
|
emith_read_r_r_offs_ptr(TOC_REG, CR, 8); \
|
||||||
|
emith_read_r_r_offs_ptr(CR, CR, 0); \
|
||||||
|
emith_jump_reg(CR)
|
||||||
|
#else
|
||||||
#define emith_abijump_reg(r) \
|
#define emith_abijump_reg(r) \
|
||||||
if ((r) != CR) emith_move_r_r(CR, r); \
|
if ((r) != CR) emith_move_r_r(CR, r); \
|
||||||
emith_jump_reg(CR)
|
emith_jump_reg(CR)
|
||||||
|
#endif
|
||||||
#define emith_abijump_reg_c(cond, r) \
|
#define emith_abijump_reg_c(cond, r) \
|
||||||
emith_abijump_reg(r)
|
emith_abijump_reg(r)
|
||||||
#define emith_abicall(target) \
|
#define emith_abicall(target) \
|
||||||
|
|
|
@ -62,6 +62,12 @@ static int ctr_svchack_successful = 0;
|
||||||
static int sceBlock;
|
static int sceBlock;
|
||||||
int getVMBlock();
|
int getVMBlock();
|
||||||
int _newlib_vm_size_user = 1 << TARGET_SIZE_2;
|
int _newlib_vm_size_user = 1 << TARGET_SIZE_2;
|
||||||
|
|
||||||
|
#elif defined(__PS3__)
|
||||||
|
#include <sys/process.h>
|
||||||
|
#include <ps3mapi_ps3_lib.h>
|
||||||
|
|
||||||
|
static uint64_t page_table[2] = {0, 0};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "libretro_core_options.h"
|
#include "libretro_core_options.h"
|
||||||
|
@ -471,6 +477,9 @@ void *plat_mem_get_for_drc(size_t size)
|
||||||
// For WiiU, a slice of RWX memory left from the exploit is used, see:
|
// For WiiU, a slice of RWX memory left from the exploit is used, see:
|
||||||
// https://github.com/embercold/pcsx_rearmed/commit/af0453223
|
// https://github.com/embercold/pcsx_rearmed/commit/af0453223
|
||||||
mem = (void *)(0x01000000 - size);
|
mem = (void *)(0x01000000 - size);
|
||||||
|
#elif defined __PS3__
|
||||||
|
ps3mapi_process_page_allocate(sysProcessGetPid(), size, PAGE_SIZE_AUTO, 0x2F, 1, page_table);
|
||||||
|
mem = (void *)page_table[0];
|
||||||
#endif
|
#endif
|
||||||
return mem;
|
return mem;
|
||||||
}
|
}
|
||||||
|
@ -2374,6 +2383,10 @@ void retro_deinit(void)
|
||||||
free(vout_buf);
|
free(vout_buf);
|
||||||
free(retro_palette);
|
free(retro_palette);
|
||||||
ps2 = NULL;
|
ps2 = NULL;
|
||||||
|
#elif defined(__PS3__)
|
||||||
|
free(vout_buf);
|
||||||
|
if (page_table[0] > 0 && page_table[1] > 0)
|
||||||
|
ps3mapi_process_page_free(sysProcessGetPid(), 0x2F, page_table);
|
||||||
#else
|
#else
|
||||||
free(vout_buf);
|
free(vout_buf);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue