From nobody Thu Jun 30 05:37:24 2022 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 749C086C261; Thu, 30 Jun 2022 05:37:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LYRtD1sl4z3CJQ; Thu, 30 Jun 2022 05:37:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656567444; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=I8ENZcaajxwYi5BnKOznTWDiEYj42lISlOzc/G7lM8c=; b=Z4LuI2hABehoNRIXXAvRs25ukDbuSqeQeUUMQppoPT2/uLQ3945n83SN5/rOObVPj+eDaf EXZWEDBvmi3/EZGCvA/Hg5qJ0JPWgtb47eajWNZHMHi0imo8VpnyWxn9zCDBi1voVtSBKM fYzajkt5BXhDTSu4gH9sJz/JjQLwgvIOjreUjvurq6Q75olp5qBts5RmaKZRE1d40+0MA6 9RcDVgzb48tMxQDuo35t1nDH6BHAqsYfwNvRvVda+0804pVEdoDZYJ4zeimkHmN9N22iUS v7WCt8zvCuLGi0+SNzQd/oFc2WH1NiTpvTjOlgbzz2iBUKalHYGRxSsk9intCg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1FED020889; Thu, 30 Jun 2022 05:37:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25U5bOYq049297; Thu, 30 Jun 2022 05:37:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25U5bOCK049296; Thu, 30 Jun 2022 05:37:24 GMT (envelope-from git) Date: Thu, 30 Jun 2022 05:37:24 GMT Message-Id: <202206300537.25U5bOCK049296@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: =?utf-8?Q?Fernando=20Apestegu=C3=ADa?= Subject: git: afa8682087b5 - main - emulators/reicast: fix i386 build List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: afa8682087b52fbd98ed5faa421f713d7e3b89f2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656567444; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=I8ENZcaajxwYi5BnKOznTWDiEYj42lISlOzc/G7lM8c=; b=NI33sFlzHEfmcLNBwDwLJjMlPyt9cOcnKhI+VWnsECBFpTmJHlpQxU72Wy9WGDLZlPaAvF oACMw5AtS6G3EEMFIvy7Nutv7zcCUHH9cZmM91l43s2+pSdUbv6pouWGGv3J5THv9WQ6K9 xrNb0k7z3h8fDDrpiLOzmFcqxglGd35Zzqnz3WqEBm7yJnsD4rElbXNtz04ePbUtbmpVSi /AY0T88xv433ZDmZFvkFuYBWLNzKouAZbOFQsK+0dFj36Zr4KHSdXDSaiEF+b+JMVrHlNT r5Ev20MTel5bqIY/X39wXk3gLzvluvP+SM2CjU4tzZXvDat46LhYD3PalAbbXg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656567444; a=rsa-sha256; cv=none; b=hO/TyDzOE3TryQ0P+KotubHTv0GzA6Jsvq/3TnnVQyqeM4Obqwhbjzl8yo5biN+Djf80RR 6e/xTq6CaWI43NV5qzQLeTTrHxbo8MGJPVPRFOlwtxNkEDTxwy5XvYMV2lwGfS+BLi+hts JQi+Q5oG/jqBrl4SyidsoPglp6mFyFwV6W0fmgPlfkOk4UXKGS9/77NLE5wG9JqdMi+yy5 oZcN/VnLZf3n25H7JjIsZO18l4UjZ03ib7jD+FhcxHRNpstGFjb4KZ6sdE5R3Q53jv8vDw 82wtCkfiafpAb1dHgNJwzeb1WHwF0UYBJpTxapUQn0ejKe4XvrQi+K0hyrWRmw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by fernape: URL: https://cgit.FreeBSD.org/ports/commit/?id=afa8682087b52fbd98ed5faa421f713d7e3b89f2 commit afa8682087b52fbd98ed5faa421f713d7e3b89f2 Author: Timothy Beyer AuthorDate: 2022-06-29 05:32:33 +0000 Commit: Fernando ApesteguĂ­a CommitDate: 2022-06-30 05:34:25 +0000 emulators/reicast: fix i386 build PR: 264218 Reported by: beyert@cs.ucr.edu (maintainer) --- emulators/reicast/Makefile | 18 +++- emulators/reicast/distinfo | 4 +- emulators/reicast/files/patch-CMakeLists.txt | 88 +++++++++++++++- emulators/reicast/files/patch-libswirl_build.h | 10 ++ .../files/patch-libswirl_deps_intrin_intrin__x86.h | 14 +++ .../files/patch-libswirl_deps_lua_luaconf.h | 14 +++ ...patch-libswirl_hw_arm7_arm7__jit__virt__x86.cpp | 114 +++++++++++++++++++++ .../files/patch-libswirl_hw_sh4_dyna_driver.cpp | 11 ++ ...h-libswirl_jit_backend_x86_rec__x86__driver.cpp | 11 ++ .../reicast/files/patch-libswirl_libswirl.cpp | 11 ++ .../files/patch-libswirl_linux-dist_main.cpp | 33 +++++- .../reicast/files/patch-libswirl_linux_common.cpp | 27 ++++- .../files/patch-libswirl_linux_nixprof_nixprof.cpp | 48 +++++++++ .../reicast/files/patch-reicast_cmake_config.cmake | 22 +++- 14 files changed, 407 insertions(+), 18 deletions(-) diff --git a/emulators/reicast/Makefile b/emulators/reicast/Makefile index d6a317efb18f..9dff00af7f80 100644 --- a/emulators/reicast/Makefile +++ b/emulators/reicast/Makefile @@ -2,6 +2,7 @@ PORTNAME= reicast PORTVERSION= 0.20201231 +PORTREVISION= 1 CATEGORIES= emulators games MAINTAINER= beyert@cs.ucr.edu @@ -18,7 +19,10 @@ LIB_DEPENDS= libao.so:audio/libao \ libpulse.so:audio/pulseaudio \ libudev.so:devel/libudev-devd -USES= cmake compiler gl xorg +USES= cmake compiler gl xorg + +.include + USE_GCC= yes USE_LDCONFIG= yes CMAKE_ARGS= -DOPENGL_EGL_INCLUDE_DIR:PATH=${LOCALBASE}/include/EGL \ @@ -26,13 +30,17 @@ CMAKE_ARGS= -DOPENGL_EGL_INCLUDE_DIR:PATH=${LOCALBASE}/include/EGL \ -DOPENGL_INCLUDE_DIR:PATH=${LOCALBASE}/include/GL \ -DOPENGL_opengl_LIBRARY:PATH=${LOCALBASE}/lib/libGL.so +.if ${ARCH} == i386 +USE_BINUTILS= yes +CXXFLAGS+= -DSIMPLELINK +.endif + USE_GITHUB= yes -GH_ACCOUNT= reicast -GH_PROJECT= reicast-emulator -GH_TAGNAME= 0bd6ea3 +GH_TUPLE= reicast:reicast-emulator:0bd6ea3 \ + yuikns:intrin:ae63327:intrin/libswirl/deps/intrin USE_XORG= ice sm x11 xext -USE_GL= egl gbm gl +USE_GL= egl gbm gl PLIST_FILES= bin/reicast diff --git a/emulators/reicast/distinfo b/emulators/reicast/distinfo index 9ade18ae5b8a..9aa5d391dc06 100644 --- a/emulators/reicast/distinfo +++ b/emulators/reicast/distinfo @@ -1,3 +1,5 @@ -TIMESTAMP = 1623465538 +TIMESTAMP = 1653194932 SHA256 (reicast-reicast-emulator-0.20201231-0bd6ea3_GH0.tar.gz) = a30e67754c28029e16cf2eb3d3878906888178e308800139e64e8e29533bc679 SIZE (reicast-reicast-emulator-0.20201231-0bd6ea3_GH0.tar.gz) = 6467649 +SHA256 (yuikns-intrin-ae63327_GH0.tar.gz) = 744aca1c35a28b25d85202ddb14379be70defae303ca1667aa7448ef4a7ee17e +SIZE (yuikns-intrin-ae63327_GH0.tar.gz) = 12533 diff --git a/emulators/reicast/files/patch-CMakeLists.txt b/emulators/reicast/files/patch-CMakeLists.txt index 5532f40fde80..ce7313b51ea7 100644 --- a/emulators/reicast/files/patch-CMakeLists.txt +++ b/emulators/reicast/files/patch-CMakeLists.txt @@ -1,6 +1,90 @@ ---- CMakeLists.txt.orig 2020-08-21 20:26:50 UTC +--- CMakeLists.txt.orig 2020-10-18 11:22:48 UTC +++ CMakeLists.txt -@@ -431,6 +431,8 @@ if(${HOST_OS} EQUAL ${OS_DARWIN}) +@@ -100,20 +100,29 @@ set(core_SRCS + ${d_core}/serialize.cpp + ) + +-if(${BUILD_COMPILER} EQUAL ${COMPILER_GCC} OR (${BUILD_COMPILER} EQUAL ${COMPILER_CLANG} AND ${HOST_OS} EQUAL ${OS_DARWIN})) # TODO: Test with Clang on other platforms ++if(${BUILD_COMPILER} EQUAL ${COMPILER_GCC} OR (${BUILD_COMPILER} EQUAL ${COMPILER_CLANG} AND (${HOST_OS} EQUAL ${OS_DARWIN} OR ${HOST_OS} EQUAL ${OS_FREEBSD}))) + list(APPEND core_SRCS ${archive_SRCS}) + endif() + + if(${FEAT_SHREC} EQUAL ${DYNAREC_JIT}) + + if(${HOST_CPU} EQUAL ${CPU_X86}) +- list(APPEND core_SRCS +- ${d_core}/jit/backend/x86/rec_x86_driver.cpp +- ${d_core}/jit/backend/x86/rec_x86_asm.cpp # change for linux , rec_lin86_asm.S +- ${d_core}/jit/backend/x86/rec_x86_ngen.h +- +- ${d_core}/jit/emitter/x86/x86_emitter.cpp +- ) ++ if (${HOST_OS} EQUAL ${OS_LINUX} OR (${HOST_OS} EQUAL ${OS_FREEBSD})) ++ list(APPEND core_SRCS ++ ${d_core}/jit/backend/x86/rec_x86_driver.cpp ++ ${d_core}/jit/backend/x86/rec_lin86_asm.S ++ ${d_core}/jit/backend/x86/rec_x86_asm.cpp ++ ${d_core}/jit/backend/x86/rec_x86_ngen.h ++ ${d_core}/jit/emitter/x86/x86_emitter.cpp ++ ) ++ else() ++ list(APPEND core_SRCS ++ ${d_core}/jit/backend/x86/rec_x86_driver.cpp ++ ${d_core}/jit/backend/x86/rec_x86_asm.cpp ++ ${d_core}/jit/backend/x86/rec_x86_ngen.h ++ ${d_core}/jit/emitter/x86/x86_emitter.cpp ++ ) ++ endif() + elseif(${HOST_CPU} EQUAL ${CPU_ARM}) + list(APPEND core_SRCS + ${d_core}/rec-ARM/ngen_arm.S +@@ -139,6 +148,8 @@ add_definitions(/DFEAT_HAS_SOFTREND=1) + + if(${HOST_OS} EQUAL ${OS_LINUX}) + add_definitions(-DLUA_USE_LINUX) ++elseif(${HOST_OS} EQUAL ${OS_FREEBSD}) ++ add_definitions(-DLUA_USE_FREEBSD) + endif() + + ### deps.cmake ################################################################################# +@@ -149,6 +160,7 @@ set(gpl_deps ${reicast_core_path}/gpl/deps) + include_directories ("${d_deps}") + include_directories ("${gpl_deps}/picotcp/include") + include_directories ("${gpl_deps}/picotcp/modules") ++include_directories ("${d_deps}/intrin") + + file(GLOB xbyak_H ${d_deps}/xbyak/*.h) # include headers into cmake target/project view + +@@ -185,8 +197,8 @@ set(deps_SRCS + ${d_deps}/coreio/coreio.cpp + ${xbyak_H} + ) +- +-if(${BUILD_COMPILER} EQUAL ${COMPILER_GCC} OR (${BUILD_COMPILER} EQUAL ${COMPILER_CLANG} AND ${HOST_OS} EQUAL ${OS_DARWIN})) # TODO: Test with Clang on other platforms ++ ++if(${BUILD_COMPILER} EQUAL ${COMPILER_GCC} OR (${BUILD_COMPILER} EQUAL ${COMPILER_CLANG} AND (${HOST_OS} EQUAL ${OS_DARWIN} OR ${HOST_OS} EQUAL ${OS_FREEBSD}))) + list(APPEND deps_SRCS + ${lzip_SRCS} + ${lzma_SRCS} +@@ -228,7 +240,7 @@ if (${HOST_OS} EQUAL ${OS_WINDOWS}) + list(APPEND osd_SRCS ${d_core}/oslib/windows/threading.cpp) + list(APPEND osd_SRCS ${d_aout}/audiobackend_directsound.cpp) + link_libraries(dsound.lib winmm.lib xinput.lib wsock32.lib opengl32.lib) +-elseif (${HOST_OS} EQUAL ${OS_LINUX} OR ${HOST_OS} EQUAL ${OS_ANDROID}) ++elseif (${HOST_OS} EQUAL ${OS_LINUX} OR ${HOST_OS} EQUAL ${OS_ANDROID} OR ${OS_FREEBSD}) + + list(APPEND osd_SRCS + ${d_core}/linux-dist/main.cpp +@@ -294,7 +306,7 @@ endif() + + target_compile_features(${TNAME}${binSuffix} PRIVATE cxx_std_14) + +-if(${HOST_OS} EQUAL ${OS_LINUX}) ++if(${HOST_OS} EQUAL ${OS_LINUX} OR ${HOST_OS} EQUAL ${OS_FREEBSD}) + # needed for opentty + target_link_libraries(${TNAME} -lutil) + +@@ -431,6 +443,8 @@ if(${HOST_OS} EQUAL ${OS_DARWIN}) endif() diff --git a/emulators/reicast/files/patch-libswirl_build.h b/emulators/reicast/files/patch-libswirl_build.h new file mode 100644 index 000000000000..05dcf62fbcae --- /dev/null +++ b/emulators/reicast/files/patch-libswirl_build.h @@ -0,0 +1,10 @@ +--- libswirl/build.h.orig 2020-10-18 11:22:48 UTC ++++ libswirl/build.h +@@ -139,6 +139,7 @@ + #define OS_DARWIN 0x10000003 + #define OS_IOS 0x10000004 + #define OS_ANDROID 0x10000005 ++#define OS_FREEBSD 0x10000006 + + #define OS_UWP 0x10000011 + #define OS_NSW_HOS 0x80000001 diff --git a/emulators/reicast/files/patch-libswirl_deps_intrin_intrin__x86.h b/emulators/reicast/files/patch-libswirl_deps_intrin_intrin__x86.h new file mode 100644 index 000000000000..2fa6fb7bbf00 --- /dev/null +++ b/emulators/reicast/files/patch-libswirl_deps_intrin_intrin__x86.h @@ -0,0 +1,14 @@ +--- libswirl/deps/intrin/intrin_x86.h.orig 2018-11-26 23:44:32 UTC ++++ libswirl/deps/intrin/intrin_x86.h +@@ -896,9 +896,11 @@ static __inline__ __attribute__((always_inline)) unsig + #endif // !HAS_BUILTIN(__rdtsc) + + /*** Interrupts ***/ ++/* + static __inline__ __attribute__((always_inline)) void __debugbreak(void) { + __asm__("int $3"); + } ++*/ + + static __inline__ __attribute__((always_inline)) void __int2c(void) { + __asm__("int $0x2c"); diff --git a/emulators/reicast/files/patch-libswirl_deps_lua_luaconf.h b/emulators/reicast/files/patch-libswirl_deps_lua_luaconf.h new file mode 100644 index 000000000000..c4dd21b707b4 --- /dev/null +++ b/emulators/reicast/files/patch-libswirl_deps_lua_luaconf.h @@ -0,0 +1,14 @@ +--- libswirl/deps/lua/luaconf.h.orig 2020-10-18 11:22:48 UTC ++++ libswirl/deps/lua/luaconf.h +@@ -64,6 +64,11 @@ + #define LUA_USE_READLINE /* needs some extra libraries */ + #endif + ++#if defined(LUA_USE_FREEBSD) ++#define LUA_USE_POSIX ++#define LUA_USE_DLOPEN /* FreeBSD does not need -ldl */ ++#define LUA_USE_READLINE /* needs an extra library: -lreadline */ ++#endif + + #if defined(LUA_USE_MACOSX) + #define LUA_USE_POSIX diff --git a/emulators/reicast/files/patch-libswirl_hw_arm7_arm7__jit__virt__x86.cpp b/emulators/reicast/files/patch-libswirl_hw_arm7_arm7__jit__virt__x86.cpp new file mode 100644 index 000000000000..9331c26f4d49 --- /dev/null +++ b/emulators/reicast/files/patch-libswirl_hw_arm7_arm7__jit__virt__x86.cpp @@ -0,0 +1,114 @@ +--- libswirl/hw/arm7/arm7_jit_virt_x86.cpp.orig 2020-10-18 11:22:48 UTC ++++ libswirl/hw/arm7/arm7_jit_virt_x86.cpp +@@ -11,8 +11,101 @@ + + #if HOST_CPU == CPU_X86 && FEAT_AREC == DYNAREC_JIT + +-#if HOST_OS == OS_LINUX || HOST_OS == OS_DARWIN ++#if HOST_OS == OS_LINUX || HOST_OS == OS_DARWIN || HOST_OS == OS_FREEBSD + #include ++ ++#define DP_R_ROFC (OP_READ_FLAGS_S|OP_READ_REG_1) //Reads reg1, op2, flags if S ++#define DP_R_ROF (OP_READ_FLAGS|OP_READ_REG_1) //Reads reg1, op2, flags (ADC & co) ++#define DP_R_OFC (OP_READ_FLAGS_S) //Reads op2, flags if S ++ ++#define DP_W_RFC (OP_WRITE_FLAGS_S|OP_WRITE_REG) //Writes reg, and flags if S ++#define DP_W_F (OP_WRITE_FLAGS) //Writes only flags, always (S=1) ++ ++struct ArmDPOP { ++ u32 key; ++ u32 mask; ++ u32 flags; ++}; ++ ++vector ops; ++ ++void AddDPOP(u32 subcd, u32 rflags, u32 wflags) { ++ ArmDPOP op; ++ ++ u32 key = subcd << 21; ++ u32 mask = (15 << 21) | (7 << 25); ++ ++ op.flags = rflags | wflags; ++ ++ if (wflags == DP_W_F) { ++ //also match S bit for opcodes that must write to flags (CMP & co) ++ mask |= 1 << 20; ++ key |= 1 << 20; ++ } ++ ++ //ISR form (bit 25=0, bit 4 = 0) ++ op.key = key; ++ op.mask = mask | (1 << 4); ++ ops.push_back(op); ++ ++ //RSR form (bit 25=0, bit 4 = 1, bit 7=0) ++ op.key = key | (1 << 4); ++ op.mask = mask | (1 << 4) | (1 << 7); ++ ops.push_back(op); ++ ++ //imm8r4 form (bit 25=1) ++ op.key = key | (1 << 25); ++ op.mask = mask; ++ ops.push_back(op); ++} ++ ++void InitHash() { ++ /* ++ COND | 00 I OP1 S Rn Rd OPER2 -- Data opcode, PSR xfer ++ Data processing opcodes ++ */ ++ ++ //AND 0000 Rn, OPER2, {Flags} Rd, {Flags} ++ //EOR 0001 Rn, OPER2, {Flags} Rd, {Flags} ++ //SUB 0010 Rn, OPER2, {Flags} Rd, {Flags} ++ //RSB 0011 Rn, OPER2, {Flags} Rd, {Flags} ++ //ADD 0100 Rn, OPER2, {Flags} Rd, {Flags} ++ //ORR 1100 Rn, OPER2, {Flags} Rd, {Flags} ++ //BIC 1110 Rn, OPER2, {Flags} Rd, {Flags} ++ AddDPOP(0, DP_R_ROFC, DP_W_RFC); ++ AddDPOP(1, DP_R_ROFC, DP_W_RFC); ++ AddDPOP(2, DP_R_ROFC, DP_W_RFC); ++ AddDPOP(3, DP_R_ROFC, DP_W_RFC); ++ AddDPOP(4, DP_R_ROFC, DP_W_RFC); ++ AddDPOP(12, DP_R_ROFC, DP_W_RFC); ++ AddDPOP(14, DP_R_ROFC, DP_W_RFC); ++ ++ //ADC 0101 Rn, OPER2, Flags Rd, {Flags} ++ //SBC 0110 Rn, OPER2, Flags Rd, {Flags} ++ //RSC 0111 Rn, OPER2, Flags Rd, {Flags} ++ AddDPOP(5, DP_R_ROF, DP_W_RFC); ++ AddDPOP(6, DP_R_ROF, DP_W_RFC); ++ AddDPOP(7, DP_R_ROF, DP_W_RFC); ++ ++ //TST 1000 S=1 Rn, OPER2, Flags Flags ++ //TEQ 1001 S=1 Rn, OPER2, Flags Flags ++ AddDPOP(8, DP_R_ROF, DP_W_F); ++ AddDPOP(9, DP_R_ROF, DP_W_F); ++ ++ //CMP 1010 S=1 Rn, OPER2 Flags ++ //CMN 1011 S=1 Rn, OPER2 Flags ++ AddDPOP(10, DP_R_ROF, DP_W_F); ++ AddDPOP(11, DP_R_ROF, DP_W_F); ++ ++ //MOV 1101 OPER2, {Flags} Rd, {Flags} ++ //MVN 1111 OPER2, {Flags} Rd, {Flags} ++ AddDPOP(13, DP_R_OFC, DP_W_RFC); ++ AddDPOP(15, DP_R_OFC, DP_W_RFC); ++} ++ ++void armt_init() { ++ InitHash(); ++} + #endif + #if HOST_OS == OS_WINDOWS + #include +@@ -55,6 +148,8 @@ u8 ARM7_TCB[ICacheSize + 4096] __attribute__((section( + + #elif HOST_OS==OS_DARWIN + u8 ARM7_TCB[ICacheSize + 4096] __attribute__((section("__TEXT, .text"))); ++#elif HOST_OS==OS_FREEBSD ++u8 ARM7_TCB[ICacheSize + 4096] __attribute__((section(".text"))); + #else + #error ARM7_TCB ALLOC + #endif diff --git a/emulators/reicast/files/patch-libswirl_hw_sh4_dyna_driver.cpp b/emulators/reicast/files/patch-libswirl_hw_sh4_dyna_driver.cpp new file mode 100644 index 000000000000..5f2f011e9bd9 --- /dev/null +++ b/emulators/reicast/files/patch-libswirl_hw_sh4_dyna_driver.cpp @@ -0,0 +1,11 @@ +--- libswirl/hw/sh4/dyna/driver.cpp.orig 2020-10-18 11:22:48 UTC ++++ libswirl/hw/sh4/dyna/driver.cpp +@@ -31,7 +31,7 @@ + u8 SH4_TCB[CODE_SIZE+4096] + #if HOST_OS == OS_WINDOWS || FEAT_SHREC != DYNAREC_JIT + ; +-#elif HOST_OS == OS_LINUX ++#elif HOST_OS == OS_LINUX || HOST_OS == OS_FREEBSD + __attribute__((section(".text"))); + #elif HOST_OS==OS_DARWIN + __attribute__((section("__TEXT,.text"))); diff --git a/emulators/reicast/files/patch-libswirl_jit_backend_x86_rec__x86__driver.cpp b/emulators/reicast/files/patch-libswirl_jit_backend_x86_rec__x86__driver.cpp new file mode 100644 index 000000000000..42595057c452 --- /dev/null +++ b/emulators/reicast/files/patch-libswirl_jit_backend_x86_rec__x86__driver.cpp @@ -0,0 +1,11 @@ +--- libswirl/jit/backend/x86/rec_x86_driver.cpp.orig 2020-10-18 11:22:48 UTC ++++ libswirl/jit/backend/x86/rec_x86_driver.cpp +@@ -852,7 +852,7 @@ struct X86NGenBackend : NGenBackend + + addr=retadr-5; + +- #if HOST_OS == OS_LINUX ++ #if HOST_OS == OS_LINUX || HOST_OS == OS_FREEBSD + ctx->esp += 4; + //restore the addr from eax to ecx so it's valid again + ctx->ecx = ctx->eax; diff --git a/emulators/reicast/files/patch-libswirl_libswirl.cpp b/emulators/reicast/files/patch-libswirl_libswirl.cpp new file mode 100644 index 000000000000..608bdab016dc --- /dev/null +++ b/emulators/reicast/files/patch-libswirl_libswirl.cpp @@ -0,0 +1,11 @@ +--- libswirl/libswirl.cpp.orig 2020-10-18 11:22:48 UTC ++++ libswirl/libswirl.cpp +@@ -95,7 +95,7 @@ int64_t get_time_usec(void) + if (!QueryPerformanceCounter(&count)) + return 0; + return count.QuadPart * 1000000 / freq.QuadPart; +-#elif defined(_POSIX_MONOTONIC_CLOCK) || defined(__QNX__) || defined(ANDROID) || defined(__MACH__) || HOST_OS==OS_LINUX ++#elif defined(_POSIX_MONOTONIC_CLOCK) || defined(__QNX__) || defined(ANDROID) || defined(__MACH__) || HOST_OS==OS_LINUX || HOST_OS==OS_FREEBSD + struct timespec tv = { 0 }; + if (clock_gettime(CLOCK_MONOTONIC, &tv) < 0) + return 0; diff --git a/emulators/reicast/files/patch-libswirl_linux-dist_main.cpp b/emulators/reicast/files/patch-libswirl_linux-dist_main.cpp index a0e4638bf5b9..c510f8e9a419 100644 --- a/emulators/reicast/files/patch-libswirl_linux-dist_main.cpp +++ b/emulators/reicast/files/patch-libswirl_linux-dist_main.cpp @@ -1,10 +1,37 @@ ---- libswirl/linux-dist/main.cpp.orig 2020-08-21 20:26:50 UTC +--- libswirl/linux-dist/main.cpp.orig 2020-10-18 11:22:48 UTC +++ libswirl/linux-dist/main.cpp -@@ -22,7 +22,6 @@ +@@ -7,7 +7,7 @@ + #include "types.h" + #include "cfg/cfg.h" + +-#if HOST_OS==OS_LINUX ++#if HOST_OS==OS_LINUX || HOST_OS==OS_FREEBSD + #include + #include + //#include +@@ -22,7 +22,9 @@ #include "hw/sh4/dyna/blockmanager.h" #include "hw/maple/maple_cfg.h" #include --#include ++#if HOST_OS==OS_LINUX + #include ++#endif #include "libswirl.h" #include "hw/pvr/Renderer_if.h" +@@ -539,6 +541,7 @@ int main(int argc, wchar* argv[]) + + int get_mic_data(u8* buffer) { return 0; } + ++#if HOST_OS == OS_LINUX + void os_DebugBreak() + { + #if !defined(TARGET_EMSCRIPTEN) +@@ -548,6 +551,7 @@ void os_DebugBreak() + exit(-1); + #endif + } ++#endif + + + diff --git a/emulators/reicast/files/patch-libswirl_linux_common.cpp b/emulators/reicast/files/patch-libswirl_linux_common.cpp index 147dd36e4224..686feaf0e9c7 100644 --- a/emulators/reicast/files/patch-libswirl_linux_common.cpp +++ b/emulators/reicast/files/patch-libswirl_linux_common.cpp @@ -1,6 +1,23 @@ ---- libswirl/linux/common.cpp.orig 2020-08-21 20:26:50 UTC +--- libswirl/linux/common.cpp.orig 2020-10-18 11:22:48 UTC +++ libswirl/linux/common.cpp -@@ -22,6 +22,12 @@ +@@ -9,7 +9,7 @@ + + #include + +-#if HOST_OS==OS_LINUX || HOST_OS == OS_DARWIN ++#if HOST_OS==OS_LINUX || HOST_OS == OS_DARWIN || HOST_OS == OS_FREEBSD + + #if HOST_OS == OS_DARWIN + #define _XOPEN_SOURCE 1 +@@ -17,11 +17,20 @@ + #include + #include + #include ++#elif HOST_OS == OS_FREEBSD ++ #include ++ #include + #endif + #if FEAT_HAS_SERIAL_TTY #include #if HOST_OS == OS_DARWIN #import @@ -13,7 +30,7 @@ #else #include #endif -@@ -33,7 +39,7 @@ +@@ -33,7 +42,7 @@ #include #include #include @@ -22,7 +39,7 @@ #include #include #endif -@@ -294,7 +300,7 @@ void enable_runfast() +@@ -294,7 +303,7 @@ void enable_runfast() } void linux_fix_personality() { @@ -31,7 +48,7 @@ printf("Personality: %08X\n", personality(0xFFFFFFFF)); personality(~READ_IMPLIES_EXEC & personality(0xFFFFFFFF)); printf("Updated personality: %08X\n", personality(0xFFFFFFFF)); -@@ -302,7 +308,7 @@ void linux_fix_personality() { +@@ -302,7 +311,7 @@ void linux_fix_personality() { } void linux_rpi2_init() { diff --git a/emulators/reicast/files/patch-libswirl_linux_nixprof_nixprof.cpp b/emulators/reicast/files/patch-libswirl_linux_nixprof_nixprof.cpp new file mode 100644 index 000000000000..51560366fe24 --- /dev/null +++ b/emulators/reicast/files/patch-libswirl_linux_nixprof_nixprof.cpp @@ -0,0 +1,48 @@ +--- libswirl/linux/nixprof/nixprof.cpp.orig 2020-10-18 11:22:48 UTC ++++ libswirl/linux/nixprof/nixprof.cpp +@@ -13,6 +13,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -56,7 +57,7 @@ + + static int tick_count=0; + static pthread_t proft; +-static pthread_t thread[2]; ++static pthread_t thread_[2]; + static void* prof_address[2]; + static u32 prof_wait; + +@@ -76,8 +77,8 @@ void prof_handler (int sn, siginfo_t * si, void *ctxr) + context_from_segfault(&ctx); + + int thd=-1; +- if (pthread_self()==thread[0]) thd=0; +- else if (pthread_self()==thread[1]) thd=1; ++ if (pthread_self()==thread_[0]) thd=0; ++ else if (pthread_self()==thread_[1]) thd=1; + else return; + + prof_address[thd] = (void*)ctx.pc; +@@ -94,7 +95,7 @@ void install_prof_handler(int id) + act.sa_flags = SA_SIGINFO | SA_RESTART; + sigaction(SIGPROF, &act, &segv_oact); + +- thread[id]=pthread_self(); ++ thread_[id]=pthread_self(); + } + + static void prof_head(FILE* out, const char* type, const char* name) +@@ -299,7 +300,7 @@ static void* profiler_main(void *ptr) + { + tick_count++; + // printf("Sending SIGPROF %08X %08X\n",thread[0],thread[1]); +- for (int i = 0; i < 2; i++) pthread_kill(thread[i], SIGPROF); ++ for (int i = 0; i < 2; i++) pthread_kill(thread_[i], SIGPROF); + // printf("Sent SIGPROF\n"); + usleep(prof_wait); + // fwrite(&prof_address[0],1,sizeof(prof_address[0])*2,prof_out); diff --git a/emulators/reicast/files/patch-reicast_cmake_config.cmake b/emulators/reicast/files/patch-reicast_cmake_config.cmake index 4fa4fed8b020..a8fc926abacc 100644 --- a/emulators/reicast/files/patch-reicast_cmake_config.cmake +++ b/emulators/reicast/files/patch-reicast_cmake_config.cmake @@ -1,6 +1,14 @@ ---- reicast/cmake/config.cmake.orig 2020-08-21 20:26:50 UTC +--- reicast/cmake/config.cmake.orig 2020-10-18 11:22:48 UTC +++ reicast/cmake/config.cmake -@@ -106,11 +106,13 @@ endif() +@@ -39,6 +39,7 @@ set(OS_LINUX 0x10000002) + set(OS_DARWIN 0x10000003) + set(OS_IOS 0x10000004) # todo: iOS != OS_DARWIN + set(OS_ANDROID 0x10000005) # todo: should be SYSTEM_ANDROID but ! OS_LINUX ++set(OS_FREEBSD 0x10000006) + + set(OS_UWP 0x10000011) + set(OS_NSW_HOS 0x80000001) +@@ -106,11 +107,13 @@ endif() # AMD64/x86_64:x64, i*86:x86, ppc/powerpc[64][b|l]e:ppc[64] etc # if(("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686") OR @@ -14,3 +22,13 @@ ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64") OR ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x64")) set(host_arch "x64") +@@ -164,6 +167,9 @@ elseif("windowsstore" STREQUAL "${host_os}") + + elseif(CMAKE_HOST_WIN32) + set(HOST_OS ${OS_WINDOWS}) ++ ++elseif("freebsd" STREQUAL "${host_os}") ++ set(HOST_OS ${OS_FREEBSD}) + + elseif(CMAKE_HOST_APPLE) +