// reserved: r0(zero), r1(stack), r2(TOC), r13(TID)
// additionally reserved on OSX: r31(PIC), r30(frame), r11(parentframe)
// for OSX PIC code, on function calls r12 must contain the called address
+#define TOC_REG 2
#define RET_REG 3
#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 emith_call_cond(cond, 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 { \
+ EMIT(PPC_MTSP_REG(r, CTR)); \
+ EMIT(PPC_BLCTRCOND(BXX)); \
+} while(0)
+#endif
#define emith_abicall_ctx(offs) do { \
emith_ctx_read_ptr(CR, offs); \
emith_call_reg(CR); \
} 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) \
+ if ((r) != CR) emith_move_r_r(CR, r); \
+ emith_jump_reg(CR)
+#endif
#define emith_abijump_reg_c(cond, r) \
emith_abijump_reg(r)
#define emith_abicall(target) \
static int sceBlock;
int getVMBlock();
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
#include "libretro_core_options.h"
// For WiiU, a slice of RWX memory left from the exploit is used, see:
// https://github.com/embercold/pcsx_rearmed/commit/af0453223
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
return mem;
}
free(vout_buf);
free(retro_palette);
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
free(vout_buf);
#endif