deps/lightning/lib/%.o: CFLAGS += -DHAVE_MMAP
ifeq ($(LIGHTREC_CUSTOM_MAP),1)
LDLIBS += -lrt
-OBJS += libpcsxcore/lightrec/mem.o
+OBJS += libpcsxcore/lightrec/mem.o deps/lightrec/tlsf/tlsf.o
endif
OBJS += libpcsxcore/lightrec/plugin.o
OBJS += deps/lightning/lib/jit_disasm.o \
#define ENABLE_THREADED_COMPILER 1
#define ENABLE_FIRST_PASS 1
#define ENABLE_DISASSEMBLER 0
-#define ENABLE_TINYMM 0
-#define ENABLE_CODE_BUFFER 0
+#define ENABLE_CODE_BUFFER 1
#define HAS_DEFAULT_ELM 1
#define MFD_HUGETLB 0x0004
#endif
+void *code_buffer;
+
static const uintptr_t supported_io_bases[] = {
0x0,
0x10000000,
psxH = (s8 *)map;
+ map = mmap_huge((void *)(base + 0x800000), CODE_BUFFER_SIZE,
+ PROT_EXEC | PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_FIXED_NOREPLACE | MAP_ANONYMOUS,
+ 0, 0);
+ if (map == MAP_FAILED) {
+ err = -EINVAL;
+ fprintf(stderr, "Unable to mmap code buffer\n");
+ goto err_unmap_scratch;
+ }
+
+ code_buffer = map;
+
return 0;
+err_unmap_scratch:
+ munmap(psxH, 0x10000);
err_unmap_bios:
munmap(psxR, 0x80000);
err_unmap_parallel:
{
unsigned int i;
+ munmap(code_buffer, CODE_BUFFER_SIZE);
munmap(psxH, 0x10000);
munmap(psxR, 0x80000);
munmap(psxP, 0x10000);
#ifndef __LIGHTREC_MEM_H__
#define __LIGHTREC_MEM_H__
+#define CODE_BUFFER_SIZE (8 * 1024 * 1024)
+
+extern void *code_buffer;
+
int lightrec_init_mmap(void);
void lightrec_free_mmap(void);
#include "../frontend/main.h"
+#include "mem.h"
+
#if (defined(__arm__) || defined(__aarch64__)) && !defined(ALLOW_LIGHTREC_ON_ARM)
#error "Lightrec should not be used on ARM (please specify DYNAREC=ari64 to make)"
#endif
.length = 0x200000,
.mirror_of = &lightrec_map[PSX_MAP_KERNEL_USER_RAM],
},
+ [PSX_MAP_CODE_BUFFER] = {
+ .length = CODE_BUFFER_SIZE,
+ },
};
static void lightrec_enable_ram(struct lightrec_state *state, bool enable)
lightrec_map[PSX_MAP_MIRROR1].address = psxM + 0x200000;
lightrec_map[PSX_MAP_MIRROR2].address = psxM + 0x400000;
lightrec_map[PSX_MAP_MIRROR3].address = psxM + 0x600000;
+ lightrec_map[PSX_MAP_CODE_BUFFER].address = code_buffer;
}
lightrec_debug = !!getenv("LIGHTREC_DEBUG");