FreeBSD Bugzilla – Attachment 234185 Details for
Bug 264218
emulators/reicast: fix i386 build
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
[PATCH] emulators/reicast: fix 32-bit / i386 build
0004-fix-32-bit-i386-build-for-emulators-reicast.patch (text/plain), 21.45 KB, created by
Timothy Beyer
on 2022-05-25 04:34:44 UTC
(
hide
)
Description:
[PATCH] emulators/reicast: fix 32-bit / i386 build
Filename:
MIME Type:
Creator:
Timothy Beyer
Created:
2022-05-25 04:34:44 UTC
Size:
21.45 KB
patch
obsolete
>From 433e29dcb4c586540feb2a8669c51f87d0f86462 Mon Sep 17 00:00:00 2001 >From: Timothy Beyer <beyert_freebsd@fastmail.net> >Date: Tue, 24 May 2022 21:17:24 -0700 >Subject: [PATCH 4/5] fix 32-bit / i386 build for emulators/reicast > >--- > emulators/reicast/Makefile | 18 ++- > emulators/reicast/distinfo | 4 +- > emulators/reicast/files/patch-CMakeLists.txt | 88 +++++++++++++- > .../reicast/files/patch-libswirl_build.h | 10 ++ > .../patch-libswirl_deps_intrin_intrin__x86.h | 14 +++ > .../files/patch-libswirl_deps_lua_luaconf.h | 14 +++ > ...-libswirl_hw_arm7_arm7__jit__virt__x86.cpp | 114 ++++++++++++++++++ > .../patch-libswirl_hw_sh4_dyna_driver.cpp | 11 ++ > ...swirl_jit_backend_x86_rec__x86__driver.cpp | 11 ++ > .../reicast/files/patch-libswirl_libswirl.cpp | 11 ++ > .../files/patch-libswirl_linux-dist_main.cpp | 33 ++++- > .../files/patch-libswirl_linux_common.cpp | 27 ++++- > .../patch-libswirl_linux_nixprof_nixprof.cpp | 48 ++++++++ > .../files/patch-reicast_cmake_config.cmake | 22 +++- > 14 files changed, 407 insertions(+), 18 deletions(-) > create mode 100644 emulators/reicast/files/patch-libswirl_build.h > create mode 100644 emulators/reicast/files/patch-libswirl_deps_intrin_intrin__x86.h > create mode 100644 emulators/reicast/files/patch-libswirl_deps_lua_luaconf.h > create mode 100644 emulators/reicast/files/patch-libswirl_hw_arm7_arm7__jit__virt__x86.cpp > create mode 100644 emulators/reicast/files/patch-libswirl_hw_sh4_dyna_driver.cpp > create mode 100644 emulators/reicast/files/patch-libswirl_jit_backend_x86_rec__x86__driver.cpp > create mode 100644 emulators/reicast/files/patch-libswirl_libswirl.cpp > create mode 100644 emulators/reicast/files/patch-libswirl_linux_nixprof_nixprof.cpp > >diff --git a/emulators/reicast/Makefile b/emulators/reicast/Makefile >index d6a317e..9dff00a 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 <bsd.port.options.mk> >+ > 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 9ade18a..9aa5d39 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 5532f40..ce7313b 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 0000000..05dcf62 >--- /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 0000000..2fa6fb7 >--- /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 0000000..c4dd21b >--- /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 0000000..9331c26 >--- /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 <sys/mman.h> >++ >++#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<ArmDPOP> 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 <Windows.h> >+@@ -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 0000000..5f2f011 >--- /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 0000000..4259505 >--- /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 0000000..608bdab >--- /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 a0e4638..c510f8e 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 <poll.h> >+ #include <termios.h> >+ //#include <curses.h> >+@@ -22,7 +22,9 @@ > #include "hw/sh4/dyna/blockmanager.h" > #include "hw/maple/maple_cfg.h" > #include <unistd.h> >--#include <pty.h> >++#if HOST_OS==OS_LINUX >+ #include <pty.h> >++#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 147dd36..686feaf 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 <pthread.h> >+ >+-#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 <TargetConditionals.h> >+ #include <dlfcn.h> >+ #include <util.h> >++#elif HOST_OS == OS_FREEBSD >++ #include <dlfcn.h> >++ #include <libutil.h> >+ #endif >+ #if FEAT_HAS_SERIAL_TTY > #include <sys/stat.h> > #if HOST_OS == OS_DARWIN > #import <util.h> >@@ -13,7 +30,7 @@ > #else > #include <pty.h> > #endif >-@@ -33,7 +39,7 @@ >+@@ -33,7 +42,7 @@ > #include <sys/param.h> > #include <sys/mman.h> > #include <sys/time.h> >@@ -22,7 +39,7 @@ > #include <sys/personality.h> > #include <dlfcn.h> > #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 0000000..5156036 >--- /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 <stdio.h> >+ #include <stdlib.h> >++#include <thread> >+ #include <pthread.h> >+ #include <unistd.h> >+ #include <pthread.h> >+@@ -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 4fa4fed..a8fc926 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) >+ >-- >2.36.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 264218
:
234185
|
234187