From 5b9f1b9e4aa51af5712cf1d90552ace57d9f486b Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 3 Aug 2012 00:43:56 +0300 Subject: [PATCH] frontend/pollux: wiz: move tables to upper memory to free some RAM --- Makefile | 1 + frontend/pl_gun_ts.h | 1 + frontend/plat_pollux.c | 16 ++++++++++++++++ libpcsxcore/new_dynarec/pcsxmem.c | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/Makefile b/Makefile index b5442506..61bec8b2 100644 --- a/Makefile +++ b/Makefile @@ -145,6 +145,7 @@ endif ifeq "$(PLATFORM)" "caanoo" OBJS += frontend/plat_pollux.o frontend/in_tsbutton.o frontend/blit320.o OBJS += frontend/gp2x/in_gp2x.o frontend/warm/warm.o +libpcsxcore/new_dynarec/pcsxmem.o: CFLAGS += -DCUSTOM_MEMMAPS USE_FRONTEND = 1 endif ifeq "$(PLATFORM)" "maemo" diff --git a/frontend/pl_gun_ts.h b/frontend/pl_gun_ts.h index 4e15f005..4e3d195f 100644 --- a/frontend/pl_gun_ts.h +++ b/frontend/pl_gun_ts.h @@ -13,5 +13,6 @@ int pl_gun_ts_get_fd(struct tsdev *ts); #define pl_gun_ts_init() NULL #define pl_gun_ts_update(...) do {} while (0) +#define pl_set_gun_rect(...) do {} while (0) #endif diff --git a/frontend/plat_pollux.c b/frontend/plat_pollux.c index 589049c3..1dafb7cd 100644 --- a/frontend/plat_pollux.c +++ b/frontend/plat_pollux.c @@ -653,6 +653,22 @@ void plat_finish(void) close(memdev); } +/* WIZ RAM lack workaround */ +void *memtab_mmap(void *addr, size_t size) +{ + void *ret; + + if (gp2x_dev_id != GP2X_DEV_WIZ) + return mmap(addr, size, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); + + ret = mmap(addr, size, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_FIXED, memdev, 0x03000000); + if (ret != MAP_FAILED) + warm_change_cb_range(WCB_C_BIT | WCB_B_BIT, 1, ret, size); + return ret; +} + /* Caanoo stuff, perhaps move later */ static const char * const caanoo_keys[KEY_MAX + 1] = { [0 ... KEY_MAX] = NULL, diff --git a/libpcsxcore/new_dynarec/pcsxmem.c b/libpcsxcore/new_dynarec/pcsxmem.c index 99b1efa6..47b876ef 100644 --- a/libpcsxcore/new_dynarec/pcsxmem.c +++ b/libpcsxcore/new_dynarec/pcsxmem.c @@ -299,9 +299,15 @@ void new_dyna_pcsx_mem_init(void) { int i; +#ifdef CUSTOM_MEMMAPS + // WIZ lack-of-RAM hack + extern void *memtab_mmap(void *addr, size_t size); + mem_readtab = memtab_mmap((void *)0x08000000, 0x200000 * 4); +#else // have to map these further to keep tcache close to .text mem_readtab = mmap((void *)0x08000000, 0x200000 * 4, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); +#endif if (mem_readtab == MAP_FAILED) { fprintf(stderr, "failed to map mem tables\n"); exit(1); -- 2.39.5