CFLAGS += -O2 -DNDEBUG
endif
endif
+CFLAGS += -DHAVE_MMAP=$(if $(NO_MMAP),0,1)
CXXFLAGS += $(CFLAGS)
#DRC_DBG = 1
#PCNT = 1
LIGHTREC_THREADED_COMPILER ?= 0
CFLAGS += -DLIGHTREC_CUSTOM_MAP=$(LIGHTREC_CUSTOM_MAP) \
-DLIGHTREC_ENABLE_THREADED_COMPILER=$(LIGHTREC_THREADED_COMPILER)
-deps/lightning/lib/%.o: CFLAGS += -DHAVE_MMAP
ifeq ($(LIGHTREC_CUSTOM_MAP),1)
LDLIBS += -lrt
OBJS += libpcsxcore/lightrec/mem.o
#include <_mingw.h>
#endif
+#endif //_WIN32
+
+#if defined(_WIN32) || !HAVE_MMAP
#include <sys/types.h>
#ifdef __cplusplus
#define MS_SYNC 2
#define MS_INVALIDATE 4
+#ifdef _WIN32
void* mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off);
int munmap(void *addr, size_t len);
int mprotect(void *addr, size_t len, int prot);
int msync(void *addr, size_t len, int flags);
int mlock(const void *addr, size_t len);
int munlock(const void *addr, size_t len);
+#endif
#ifdef __cplusplus
};
static void * psxMapDefault(unsigned long addr, size_t size,
int is_fixed, enum psxMapTag tag)
{
+#if !HAVE_MMAP
+ void *ptr;
+
+ ptr = malloc(size);
+ return ptr ? ptr : MAP_FAILED;
+#else
int flags = MAP_PRIVATE | MAP_ANONYMOUS;
return mmap((void *)(uintptr_t)addr, size,
PROT_READ | PROT_WRITE, flags, -1, 0);
+#endif
}
static void psxUnmapDefault(void *ptr, size_t size, enum psxMapTag tag)
{
+#if !HAVE_MMAP
+ free(ptr);
+#else
munmap(ptr, size);
+#endif
}
void *(*psxMapHook)(unsigned long addr, size_t size, int is_fixed,