mirror of
https://github.com/libretro/mupen64plus-libretro-nx.git
synced 2024-11-26 18:00:45 +00:00
[NX] Test JIT Changes
- Lowers platform requirements
This commit is contained in:
parent
0573142c21
commit
e69532ac04
@ -7520,6 +7520,9 @@ static void disassemble_inst(int i)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBNX
|
||||
ALIGN(4096, char jit_memory[33554432]) __attribute__((section(".text")));
|
||||
#endif
|
||||
void new_dynarec_init(void)
|
||||
{
|
||||
DebugMessage(M64MSG_INFO, "Init new dynarec");
|
||||
@ -7544,8 +7547,8 @@ void new_dynarec_init(void)
|
||||
|
||||
#if CACHE_ADDR==DOUBLE_CACHE_ADDR
|
||||
#ifdef HAVE_LIBNX
|
||||
base_addr = mmap((u_char *)g_dev.r4300.extra_memory, 1<<TARGET_SIZE_2, 0,0,0,0);
|
||||
base_addr_rx = jit_rx_addr;
|
||||
base_addr = mmap((u_char *)jit_memory, 1<<TARGET_SIZE_2, 0,0,0,0);
|
||||
base_addr_rx = (void*)jit_memory;
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -21,26 +21,18 @@ extern "C"
|
||||
#define MAP_ANONYMOUS 0x20
|
||||
|
||||
#define MAP_FAILED ((void *)-1)
|
||||
|
||||
Jit dynarec_jit;
|
||||
void *jit_rx_addr = 0;
|
||||
void *jit_rw_addr = 0;
|
||||
size_t jit_len = 0;
|
||||
void* ptr_rw = NULL;
|
||||
|
||||
static inline void *mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset)
|
||||
{
|
||||
(void)fd;
|
||||
(void)offset;
|
||||
|
||||
if (R_SUCCEEDED(jitCreate(&dynarec_jit, len)))
|
||||
size_t size = (len + 0xFFF) &~ 0xFFF;
|
||||
ptr_rw = virtmemReserve(size);
|
||||
if (R_SUCCEEDED(svcMapProcessMemory(ptr_rw, envGetOwnProcessHandle(), (u64)addr, size)))
|
||||
{
|
||||
jit_len = dynarec_jit.size;
|
||||
jit_rw_addr = jitGetRwAddr(&dynarec_jit);
|
||||
jit_rx_addr = jitGetRxAddr(&dynarec_jit);
|
||||
|
||||
printf("[NXJIT]: Jit Initialized: RX %p, RW %p\n", jit_rx_addr, jit_rw_addr);
|
||||
|
||||
return jit_rw_addr;
|
||||
return ptr_rw;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -56,10 +48,8 @@ static inline int mprotect(void *addr, size_t len, int prot)
|
||||
|
||||
static inline int munmap(void *addr, size_t len)
|
||||
{
|
||||
jitClose(&dynarec_jit);
|
||||
jit_rx_addr = jit_rw_addr = NULL;
|
||||
jit_len = 0;
|
||||
|
||||
size_t size = (len + 0xFFF) &~ 0xFFF;
|
||||
svcUnmapProcessMemory(ptr_rw, envGetOwnProcessHandle(), (u64)addr, size);
|
||||
printf("[NXJIT]: Jit closed\n");
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user