asm_misc = 0
asm_cdmemory = 0
asm_mix = 0
+asm_32xdraw = 0
+asm_32xmemory = 0
fpic :=
ifeq ($(platform), unix)
EXT ?= so
TARGET := $(TARGET_NAME)_libretro.$(EXT)
- fpic := -fPIC
+ fpic := -fPIC
SHARED := -shared
DONT_COMPILE_IN_ZLIB = 1
CFLAGS += -DFAMEC_NO_GOTOS
EXT ?= so
TARGET := $(TARGET_NAME)_libretro.$(EXT)
SHARED := -shared -nostdlib
- fpic := -fPIC
+ fpic := -fPIC
LIBM :=
DONT_COMPILE_IN_ZLIB = 1
CFLAGS += -DFAMEC_NO_GOTOS
EXT ?= dylib
TARGET := $(TARGET_NAME)_libretro.$(EXT)
SHARED := -dynamiclib
- fpic := -fPIC
+ fpic := -fPIC
APPLE := 1
arch = intel
ifeq ($(shell uname -p),powerpc)
endif
ifeq ($(arch),ppc)
CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ -DFAMEC_NO_GOTOS
+ else
+ use_sh2drc = 1
endif
OSXVER = `sw_vers -productVersion | cut -d. -f 2`
OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
CXX += -miphoneos-version-min=8.0
CC_AS += -miphoneos-version-min=8.0
CFLAGS += -miphoneos-version-min=8.0
- ARCH := arm
+ ARCH := aarch64
STATIC_LINKING = 1
use_cyclone = 0
use_fame = 1
use_drz80 = 0
use_cz80 = 1
- use_sh2drc = 0
+ use_sh2drc = 1
use_svpdrc = 0
# iOS
else ifneq (,$(findstring ios,$(platform)))
TARGET := $(TARGET_NAME)_libretro_ios.dylib
SHARED := -dynamiclib
- fpic := -fPIC
+ fpic := -fPIC
APPLE := 1
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
NO_MMAP = 1
DONT_COMPILE_IN_ZLIB = 1
- asm_memory = 0
- asm_render = 0
- asm_ym2612 = 0
- asm_misc = 0
- asm_cdpico = 0
- asm_cdmemory = 0
- asm_mix = 0
use_cyclone = 0
use_fame = 1
use_drz80 = 0
use_cz80 = 1
+ use_sh2drc = 1
# sncps3
else ifeq ($(platform), sncps3)
NO_MMAP = 1
DONT_COMPILE_IN_ZLIB = 1
- asm_memory = 0
- asm_render = 0
- asm_ym2612 = 0
- asm_misc = 0
- asm_cdpico = 0
- asm_cdmemory = 0
- asm_mix = 0
use_cyclone = 0
use_fame = 1
use_drz80 = 0
use_cz80 = 1
+ use_sh2drc = 1
# Lightweight PS3 Homebrew SDK
else ifeq ($(platform), psl1ght)
NO_MMAP = 1
DONT_COMPILE_IN_ZLIB = 1
- asm_memory = 0
- asm_render = 0
- asm_ym2612 = 0
- asm_misc = 0
- asm_cdpico = 0
- asm_cdmemory = 0
- asm_mix = 0
use_cyclone = 0
use_fame = 1
use_drz80 = 0
use_cz80 = 1
+ use_sh2drc = 1
# PSP
else ifeq ($(platform), psp1)
NO_MMAP = 1
DONT_COMPILE_IN_ZLIB = 1
- asm_memory = 0
asm_render = 1
- asm_ym2612 = 0
- asm_misc = 0
- asm_cdpico = 0
- asm_cdmemory = 0
- asm_mix = 0
use_cyclone = 0
use_fame = 1
use_drz80 = 0
use_cz80 = 1
+ use_sh2drc = 1
# CTR (3DS)
else ifeq ($(platform), ctr)
ARCH = arm
ARM_ASM = 1
- asm_memory = 1
- asm_render = 1
- asm_ym2612 = 1
- asm_misc = 1
- asm_cdpico = 1
- asm_cdmemory = 1
- asm_mix = 1
-
use_cyclone = 1
use_fame = 0
use_drz80 = 1
fpic := -fPIC
DONT_COMPILE_IN_ZLIB = 1
- asm_memory = 1
- asm_render = 1
- asm_ym2612 = 1
- asm_misc = 1
- asm_cdpico = 1
- asm_cdmemory = 1
- asm_mix = 1
-
use_cyclone = 1
use_fame = 0
use_drz80 = 1
NO_MMAP = 1
DONT_COMPILE_IN_ZLIB = 1
ARCH = arm
+ ARM_ASM = 1
- asm_memory = 1
- asm_render = 1
- asm_ym2612 = 1
- asm_misc = 1
- asm_cdpico = 1
- asm_cdmemory = 1
- asm_mix = 1
use_cyclone = 1
use_fame = 0
use_drz80 = 1
# QNX
else ifeq ($(platform), qnx)
TARGET := $(TARGET_NAME)_libretro_$(platform).so
- fpic := -fPIC
+ fpic := -fPIC
CC = qcc -Vgcc_ntoarmv7le
CC_AS = $(CC)
CFLAGS += -DBASE_ADDR_FIXED=0 -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon -mfloat-abi=softfp
else ifneq (,$(findstring armv,$(platform)))
TARGET := $(TARGET_NAME)_libretro.so
SHARED := -shared -Wl,--no-undefined,-Bsymbolic
- fpic := -fPIC
+ fpic := -fPIC
ifneq (,$(findstring cortexa5,$(platform)))
CFLAGS += -marm -mcpu=cortex-a5
ASFLAGS += -mcpu=cortex-a5
# GCW0
else ifeq ($(platform), gcw0)
TARGET := $(TARGET_NAME)_libretro.so
- CC = /opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc
- AR = /opt/gcw0-toolchain/usr/bin/mipsel-linux-ar
+ CC = mipsel-linux-gcc
+ AR = mipsel-linux-ar
SHARED := -shared -nostdlib
- fpic := -fPIC
+ fpic := -fPIC
LIBM :=
DONT_COMPILE_IN_ZLIB = 1
CFLAGS += -ffast-math -march=mips32 -mtune=mips32r2 -mhard-float
- asm_memory = 0
- asm_render = 0
- asm_ym2612 = 0
- asm_misc = 0
- asm_cdpico = 0
- asm_cdmemory = 0
- asm_mix = 0
use_cyclone = 0
use_fame = 1
use_drz80 = 0
asm_misc = 1
asm_cdmemory = 1
asm_mix = 1
+asm_32xdraw = 1
+asm_32xmemory = 1
endif
CFLAGS += $(fpic)
/* mov r <-> [ebp+#offs] */ \
if ((offs) == 0) { \
emith_deref_modrm(op, 0, r, rs); \
- } else if (abs(offs) >= 0x80) { \
+ } else if ((s32)(offs) < -0x80 || (s32)(offs) >= 0x80) { \
emith_deref_modrm(op, 2, r, rs); \
EMIT(offs, u32); \
} else { \
#define PARAM_REGS { xCX, xDX, xR8, xR9 }
#define PRESERVED_REGS { xSI, xDI, xR12, xR13, xR14, xR15, xBX, xBP }
#define TEMPORARY_REGS { xAX, xR10, xR11 }
-#define STATIC_SH2_REGS { SHR_SR,xBX , SHR_R(0),xR15 , SH2_R(1),xR14 }
+#define STATIC_SH2_REGS { SHR_SR,xBX , SHR_R(0),xR15 , SHR_R(1),xR14 }
#define host_arg2reg(rd, arg) \
switch (arg) { \
blink_free[tcid] = NULL;
memset(unresolved_links[tcid], 0, sizeof(*unresolved_links[0]) * HASH_TABLE_SIZE(tcid));
memset(hash_tables[tcid], 0, sizeof(*hash_tables[0]) * HASH_TABLE_SIZE(tcid));
- if (Pico32xMem->sdram != NULL) {
- if (tcid == 0) { // ROM, RAM
- memset(Pico32xMem->drcblk_ram, 0, sizeof(Pico32xMem->drcblk_ram));
- memset(Pico32xMem->drclit_ram, 0, sizeof(Pico32xMem->drclit_ram));
- memset(sh2s[0].branch_cache, -1, sizeof(sh2s[0].branch_cache));
- memset(sh2s[1].branch_cache, -1, sizeof(sh2s[1].branch_cache));
- memset(sh2s[0].rts_cache, -1, sizeof(sh2s[0].rts_cache));
- memset(sh2s[1].rts_cache, -1, sizeof(sh2s[1].rts_cache));
- sh2s[0].rts_cache_idx = sh2s[1].rts_cache_idx = 0;
- } else {
- memset(Pico32xMem->drcblk_ram, 0, sizeof(Pico32xMem->drcblk_ram));
- memset(Pico32xMem->drclit_ram, 0, sizeof(Pico32xMem->drclit_ram));
- memset(Pico32xMem->drcblk_da[tcid - 1], 0, sizeof(Pico32xMem->drcblk_da[tcid - 1]));
- memset(Pico32xMem->drclit_da[tcid - 1], 0, sizeof(Pico32xMem->drclit_da[tcid - 1]));
- memset(sh2s[tcid - 1].branch_cache, -1, sizeof(sh2s[0].branch_cache));
- memset(sh2s[tcid - 1].rts_cache, -1, sizeof(sh2s[0].rts_cache));
- sh2s[tcid - 1].rts_cache_idx = 0;
- }
+
+ if (tcid == 0) { // ROM, RAM
+ memset(Pico32xMem->drcblk_ram, 0, sizeof(Pico32xMem->drcblk_ram));
+ memset(Pico32xMem->drclit_ram, 0, sizeof(Pico32xMem->drclit_ram));
+ memset(sh2s[0].branch_cache, -1, sizeof(sh2s[0].branch_cache));
+ memset(sh2s[1].branch_cache, -1, sizeof(sh2s[1].branch_cache));
+ memset(sh2s[0].rts_cache, -1, sizeof(sh2s[0].rts_cache));
+ memset(sh2s[1].rts_cache, -1, sizeof(sh2s[1].rts_cache));
+ sh2s[0].rts_cache_idx = sh2s[1].rts_cache_idx = 0;
+ } else {
+ memset(Pico32xMem->drcblk_ram, 0, sizeof(Pico32xMem->drcblk_ram));
+ memset(Pico32xMem->drclit_ram, 0, sizeof(Pico32xMem->drclit_ram));
+ memset(Pico32xMem->drcblk_da[tcid - 1], 0, sizeof(Pico32xMem->drcblk_da[tcid - 1]));
+ memset(Pico32xMem->drclit_da[tcid - 1], 0, sizeof(Pico32xMem->drclit_da[tcid - 1]));
+ memset(sh2s[tcid - 1].branch_cache, -1, sizeof(sh2s[0].branch_cache));
+ memset(sh2s[tcid - 1].rts_cache, -1, sizeof(sh2s[0].rts_cache));
+ sh2s[tcid - 1].rts_cache_idx = 0;
}
#if (DRC_DEBUG & 4)
tcache_dsm_ptrs[tcid] = tcache_ring[tcid].base;
unsigned char *op_flags, uint32_t *end_pc,
uint32_t *base_literals, uint32_t *end_literals);
-#if defined(DRC_SH2) && defined(__GNUC__)
+#if defined(DRC_SH2) && defined(__GNUC__) && !defined(__clang__)
// direct access to some host CPU registers used by the DRC if gcc is used.
// XXX MUST match SHR_SR definitions in cpu/drc/emit_*.c; should be moved there
// XXX yuck, there's no portable way to determine register size. Use long long
\r
static __inline void sh2_execute_prepare(SH2 *sh2, int use_drc)\r
{\r
+#ifdef DRC_SH2\r
sh2->run = use_drc ? sh2_execute_drc : sh2_execute_interpreter;\r
+#else\r
+ sh2->run = sh2_execute_interpreter;\r
+#endif\r
}\r
\r
static __inline int sh2_execute(SH2 *sh2, int cycles)\r
# endianess of target (automagically determined below)
ENDIAN=
+# don't do this if ELF format isn't used. it doesn't matter since offsets are
+# only needed for the asm parts (currently mips/arm32) and those have ELF
+check_elf ()
+{
+ echo '#include <stdint.h>' >/tmp/getoffs.c
+ echo "const int32_t val = 1;" >>/tmp/getoffs.c
+ $CC $CFLAGS -I .. -c /tmp/getoffs.c -o /tmp/getoffs.o || exit 1
+ if ! command -v readelf >/dev/null || ! file /tmp/getoffs.o | grep -q ELF; then
+ echo "/* mkoffset.sh: no readelf or not ELF, offset table not created */" >$fn
+ echo "WARNING: no readelf or not ELF, offset table not created"
+ exit
+ fi
+}
+
# compile with target C compiler and extract value from .rodata section
compile_rodata ()
{
fn="${1:-.}/pico_int_offs.h"
if echo $CFLAGS | grep -qe -flto; then CFLAGS="$CFLAGS -fno-lto"; fi
-# don't do this if readelf isn't available. it doesn't matter since offsets are
-# only needed for the asm parts (currently mips/arm32) and those have readelf
-if ! command -v readelf >/dev/null; then
- echo "/* mkoffset.sh: readelf not found, offset table not created */" >$fn
- echo "WARNING: readelf not found, offset table not created"
- exit
-fi
+check_elf
# determine endianess
echo '#include <stdint.h>' >/tmp/getoffs.c
echo "const int32_t val = 1;" >>/tmp/getoffs.c