Skip to content

Commit

Permalink
Merge pull request #3502 from Sonicadvance1/remove_termux
Browse files Browse the repository at this point in the history
Removes false termux support
  • Loading branch information
lioncash authored Mar 21, 2024
2 parents 6ce366e + 45ea0cd commit 0c24aea
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 74 deletions.
13 changes: 0 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ option(ENABLE_OFFLINE_TELEMETRY "Enables FEX offline telemetry" TRUE)
option(ENABLE_COMPILE_TIME_TRACE "Enables time trace compile option" FALSE)
option(ENABLE_LIBCXX "Enables LLVM libc++" FALSE)
option(ENABLE_CCACHE "Enables ccache for compile caching" TRUE)
option(ENABLE_TERMUX_BUILD "Forces building for Termux on a non-Termux build machine" FALSE)
option(ENABLE_VIXL_SIMULATOR "Forces the FEX JIT to use the VIXL simulator" FALSE)
option(ENABLE_VIXL_DISASSEMBLER "Enables debug disassembler output with VIXL" FALSE)
option(COMPILE_VIXL_DISASSEMBLER "Compiles the vixl disassembler in to vixl" FALSE)
Expand Down Expand Up @@ -163,18 +162,6 @@ if (NOT ENABLE_OFFLINE_TELEMETRY)
add_definitions(-DFEX_DISABLE_TELEMETRY=1)
endif()

if(DEFINED ENV{TERMUX_VERSION} OR ENABLE_TERMUX_BUILD)
add_definitions(-DTERMUX_BUILD=1)
set(TERMUX_BUILD 1)

# Termux doesn't support Jemalloc due to bad interactions between emutls, jemalloc, and scudo
set(ENABLE_JEMALLOC FALSE)

# Termux builds can't rely on X11 packages
# SDL2 isn't even compiled with GL support so our GUIs wouldn't even work
set(BUILD_FEXCONFIG FALSE)
endif()

if (ENABLE_ASAN)
add_definitions(-DENABLE_ASAN=1)
add_compile_options(-fno-omit-frame-pointer -fsanitize=address -fsanitize-address-use-after-scope)
Expand Down
11 changes: 0 additions & 11 deletions FEXCore/Source/Utils/Allocator/IntrusiveArenaAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,8 @@

#include <bitset>
#include <cstddef>
#ifdef TERMUX_BUILD
#ifdef __has_include
#if __has_include(<memory_resource>)
#error Termux <experimental/memory_resource> workaround can be removed
#endif
#endif
#include <experimental/memory_resource>
#include <experimental/list>
namespace fex_pmr = std::experimental::pmr;
#else
#include <memory_resource>
namespace fex_pmr = std::pmr;
#endif
#include <sys/user.h>

#include <mutex>
Expand Down
6 changes: 0 additions & 6 deletions Scripts/GenerateSyscallNumbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ def EntryName(self):
"pread64": "pread_64",
"pwrite64": "pwrite_64",
"prlimit64": "prlimit_64",
# Shm symbols conflict with termux defines and FEX's syscall token pasting.
# Underscore at the start to avoid name collision
"shmget": "_shmget",
"shmctl": "_shmctl",
"shmat": "_shmat",
"shmdt": "_shmdt",
# musl/Alpine Linux defines `fstatat64` as a define that points to `fstatat`.
# Rename it to avoid global define conflicts.
"fstatat64": "fstatat_64",
Expand Down
5 changes: 1 addition & 4 deletions Source/Tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ if (NOT MINGW_BUILD)
add_subdirectory(FEXConfig/)
endif()

if (NOT TERMUX_BUILD)
# Disable FEXRootFSFetcher on Termux, it doesn't even work there
add_subdirectory(FEXRootFSFetcher/)
endif()

if (ENABLE_GDB_SYMBOLS)
add_subdirectory(FEXGDBReader/)
endif()

add_subdirectory(FEXRootFSFetcher/)
add_subdirectory(FEXGetConfig/)
add_subdirectory(FEXServer/)
add_subdirectory(FEXBash/)
Expand Down
5 changes: 0 additions & 5 deletions Source/Tools/FEXLoader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ if (ENABLE_VIXL_SIMULATOR)
list(APPEND DEFINES -DVIXL_SIMULATOR=1)
endif()

if (TERMUX_BUILD)
# Termux needs android-shmem to get the shm emulation library.
list(APPEND LIBS android-shmem)
endif()

function(GenerateInterpreter NAME AsInterpreter)
add_executable(${NAME}
FEXLoader.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ enum Syscalls_Arm64 {
SYSCALL_Arm64_semctl = 191,
SYSCALL_Arm64_semtimedop = 192,
SYSCALL_Arm64_semop = 193,
SYSCALL_Arm64__shmget = 194,
SYSCALL_Arm64__shmctl = 195,
SYSCALL_Arm64__shmat = 196,
SYSCALL_Arm64__shmdt = 197,
SYSCALL_Arm64_shmget = 194,
SYSCALL_Arm64_shmctl = 195,
SYSCALL_Arm64_shmat = 196,
SYSCALL_Arm64_shmdt = 197,
SYSCALL_Arm64_socket = 198,
SYSCALL_Arm64_socketpair = 199,
SYSCALL_Arm64_bind = 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,10 @@ uint64_t SyscallPassthrough7(FEXCore::Core::CpuStateFrame *Frame, uint64_t arg1,
SyscallPassthrough3<SYSCALL_DEF(msync)>);
REGISTER_SYSCALL_IMPL_PASS_FLAGS(mincore, SyscallFlags::OPTIMIZETHROUGH | SyscallFlags::NOSYNCSTATEONENTRY,
SyscallPassthrough3<SYSCALL_DEF(mincore)>);
REGISTER_SYSCALL_IMPL_PASS_FLAGS(_shmget, SyscallFlags::OPTIMIZETHROUGH | SyscallFlags::NOSYNCSTATEONENTRY,
SyscallPassthrough3<SYSCALL_DEF(_shmget)>);
REGISTER_SYSCALL_IMPL_PASS_FLAGS(_shmctl, SyscallFlags::OPTIMIZETHROUGH | SyscallFlags::NOSYNCSTATEONENTRY,
SyscallPassthrough3<SYSCALL_DEF(_shmctl)>);
REGISTER_SYSCALL_IMPL_PASS_FLAGS(shmget, SyscallFlags::OPTIMIZETHROUGH | SyscallFlags::NOSYNCSTATEONENTRY,
SyscallPassthrough3<SYSCALL_DEF(shmget)>);
REGISTER_SYSCALL_IMPL_PASS_FLAGS(shmctl, SyscallFlags::OPTIMIZETHROUGH | SyscallFlags::NOSYNCSTATEONENTRY,
SyscallPassthrough3<SYSCALL_DEF(shmctl)>);
REGISTER_SYSCALL_IMPL_PASS_FLAGS(getpid, SyscallFlags::OPTIMIZETHROUGH | SyscallFlags::NOSYNCSTATEONENTRY,
SyscallPassthrough0<SYSCALL_DEF(getpid)>);
REGISTER_SYSCALL_IMPL_PASS_FLAGS(socket, SyscallFlags::OPTIMIZETHROUGH | SyscallFlags::NOSYNCSTATEONENTRY,
Expand Down
4 changes: 2 additions & 2 deletions Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ namespace FEX::HLE::x32 {
SYSCALL_ERRNO();
});

REGISTER_SYSCALL_IMPL_X32(_shmat, [](FEXCore::Core::CpuStateFrame *Frame, int shmid, const void *shmaddr, int shmflg) -> uint64_t {
REGISTER_SYSCALL_IMPL_X32(shmat, [](FEXCore::Core::CpuStateFrame *Frame, int shmid, const void *shmaddr, int shmflg) -> uint64_t {
// also implemented in ipc:OP_SHMAT
uint32_t ResultAddr{};
uint64_t Result = static_cast<FEX::HLE::x32::x32SyscallHandler*>(FEX::HLE::_SyscallHandler)->GetAllocator()->
Expand All @@ -127,7 +127,7 @@ namespace FEX::HLE::x32 {
}
});

REGISTER_SYSCALL_IMPL_X32(_shmdt, [](FEXCore::Core::CpuStateFrame *Frame, const void *shmaddr) -> uint64_t {
REGISTER_SYSCALL_IMPL_X32(shmdt, [](FEXCore::Core::CpuStateFrame *Frame, const void *shmaddr) -> uint64_t {
// also implemented in ipc:OP_SHMDT
uint64_t Result = static_cast<FEX::HLE::x32::x32SyscallHandler*>(FEX::HLE::_SyscallHandler)->GetAllocator()->
Shmdt(shmaddr);
Expand Down
14 changes: 7 additions & 7 deletions Source/Tools/LinuxEmulation/LinuxSyscalls/x32/Semaphore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ namespace FEX::HLE::x32 {
else {
buf = *shmun.buf32;
}
Result = ::syscall(SYSCALL_DEF(_shmctl), shmid, cmd, &buf);
Result = ::syscall(SYSCALL_DEF(shmctl), shmid, cmd, &buf);
// IPC_SET sets the internal data structure that the kernel uses
// No need to writeback
break;
Expand All @@ -328,7 +328,7 @@ namespace FEX::HLE::x32 {
case SHM_STAT_ANY:
case IPC_STAT: {
struct shmid64_ds buf{};
Result = ::syscall(SYSCALL_DEF(_shmctl), shmid, cmd, &buf);
Result = ::syscall(SYSCALL_DEF(shmctl), shmid, cmd, &buf);
if (Result != -1) {
if (IPC64) {
*shmun.buf64 = buf;
Expand All @@ -341,7 +341,7 @@ namespace FEX::HLE::x32 {
}
case IPC_INFO: {
struct shminfo si{};
Result = ::syscall(SYSCALL_DEF(_shmctl), shmid, cmd, reinterpret_cast<struct shmid_ds*>(&si));
Result = ::syscall(SYSCALL_DEF(shmctl), shmid, cmd, reinterpret_cast<struct shmid_ds*>(&si));
if (Result != -1) {
if (IPC64) {
*shmun.__buf64 = si;
Expand All @@ -354,21 +354,21 @@ namespace FEX::HLE::x32 {
}
case SHM_INFO: {
struct shm_info si{};
Result = ::syscall(SYSCALL_DEF(_shmctl), shmid, cmd, reinterpret_cast<struct shmid_ds*>(&si));
Result = ::syscall(SYSCALL_DEF(shmctl), shmid, cmd, reinterpret_cast<struct shmid_ds*>(&si));
if (Result != -1) {
// SHM_INFO doesn't follow IPC64 behaviour
*shmun.__buf_info_32 = si;
}
break;
}
case SHM_LOCK:
Result = ::syscall(SYSCALL_DEF(_shmctl), shmid, cmd, nullptr);
Result = ::syscall(SYSCALL_DEF(shmctl), shmid, cmd, nullptr);
break;
case SHM_UNLOCK:
Result = ::syscall(SYSCALL_DEF(_shmctl), shmid, cmd, nullptr);
Result = ::syscall(SYSCALL_DEF(shmctl), shmid, cmd, nullptr);
break;
case IPC_RMID:
Result = ::syscall(SYSCALL_DEF(_shmctl), shmid, cmd, nullptr);
Result = ::syscall(SYSCALL_DEF(shmctl), shmid, cmd, nullptr);
break;

default:
Expand Down
8 changes: 4 additions & 4 deletions Source/Tools/LinuxEmulation/LinuxSyscalls/x32/SyscallsEnum.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,10 @@ enum Syscalls_x86 {
SYSCALL_x86_rseq = 386,
SYSCALL_x86_semget = 393,
SYSCALL_x86_semctl = 394,
SYSCALL_x86__shmget = 395,
SYSCALL_x86__shmctl = 396,
SYSCALL_x86__shmat = 397,
SYSCALL_x86__shmdt = 398,
SYSCALL_x86_shmget = 395,
SYSCALL_x86_shmctl = 396,
SYSCALL_x86_shmat = 397,
SYSCALL_x86_shmdt = 398,
SYSCALL_x86_msgget = 399,
SYSCALL_x86_msgsnd = 400,
SYSCALL_x86_msgrcv = 401,
Expand Down
4 changes: 2 additions & 2 deletions Source/Tools/LinuxEmulation/LinuxSyscalls/x64/Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ namespace FEX::HLE::x64 {
SYSCALL_ERRNO();
});

REGISTER_SYSCALL_IMPL_X64_FLAGS(_shmat, SyscallFlags::OPTIMIZETHROUGH | SyscallFlags::NOSYNCSTATEONENTRY,
REGISTER_SYSCALL_IMPL_X64_FLAGS(shmat, SyscallFlags::OPTIMIZETHROUGH | SyscallFlags::NOSYNCSTATEONENTRY,
[](FEXCore::Core::CpuStateFrame *Frame, int shmid, const void *shmaddr, int shmflg) -> uint64_t {
uint64_t Result = reinterpret_cast<uint64_t>(shmat(shmid, shmaddr, shmflg));

Expand All @@ -113,7 +113,7 @@ namespace FEX::HLE::x64 {
SYSCALL_ERRNO();
});

REGISTER_SYSCALL_IMPL_X64_FLAGS(_shmdt, SyscallFlags::OPTIMIZETHROUGH | SyscallFlags::NOSYNCSTATEONENTRY,
REGISTER_SYSCALL_IMPL_X64_FLAGS(shmdt, SyscallFlags::OPTIMIZETHROUGH | SyscallFlags::NOSYNCSTATEONENTRY,
[](FEXCore::Core::CpuStateFrame *Frame, const void *shmaddr) -> uint64_t {
uint64_t Result = ::shmdt(shmaddr);

Expand Down
8 changes: 4 additions & 4 deletions Source/Tools/LinuxEmulation/LinuxSyscalls/x64/SyscallsEnum.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ enum Syscalls_x64 {
SYSCALL_x64_msync = 26,
SYSCALL_x64_mincore = 27,
SYSCALL_x64_madvise = 28,
SYSCALL_x64__shmget = 29,
SYSCALL_x64__shmat = 30,
SYSCALL_x64__shmctl = 31,
SYSCALL_x64_shmget = 29,
SYSCALL_x64_shmat = 30,
SYSCALL_x64_shmctl = 31,
SYSCALL_x64_dup = 32,
SYSCALL_x64_dup2 = 33,
SYSCALL_x64_pause = 34,
Expand Down Expand Up @@ -76,7 +76,7 @@ enum Syscalls_x64 {
SYSCALL_x64_semget = 64,
SYSCALL_x64_semop = 65,
SYSCALL_x64_semctl = 66,
SYSCALL_x64__shmdt = 67,
SYSCALL_x64_shmdt = 67,
SYSCALL_x64_msgget = 68,
SYSCALL_x64_msgsnd = 69,
SYSCALL_x64_msgrcv = 70,
Expand Down
8 changes: 0 additions & 8 deletions docs/ReleaseProcess.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,6 @@ Follow the steps in: https://github.com/FEX-Emu/FEX-ppa/blob/main/README.md
* Jekyll will automatically regenerate the website with a github action
* Verify that the post shows up on the site at fex-emu.com

## Termux package update steps
* Clone https://github.com/termux/termux-packages
* Update the package script with thew new version tag (https://github.com/termux/termux-packages/blob/master/packages/fex/build.sh)
* ***!!! Test the build locally on an Android device !!!***
* Check the wiki for a command to run in the local changed repo on-device
* https://github.com/termux/termux-packages/wiki/Building-packages#how-to-build-package
* Submit a PR to upstream on github to get it picked up

## @FEX_Emu twitter account steps
* Requires @FEX_Emu twitter account access
* Create a tweet with some small blurb/sizzle text about some relevant changes in this tagged version
Expand Down

0 comments on commit 0c24aea

Please sign in to comment.