diff --git a/FEXCore/Source/Interface/Core/JIT/JIT.cpp b/FEXCore/Source/Interface/Core/JIT/JIT.cpp index 5385d9978..eb9b59e1f 100644 --- a/FEXCore/Source/Interface/Core/JIT/JIT.cpp +++ b/FEXCore/Source/Interface/Core/JIT/JIT.cpp @@ -825,7 +825,7 @@ CPUBackend::CompiledCode Arm64JITCore::CompileCode(uint64_t Entry, uint64_t Size this->IR = IR; RequiresFarARM64Jumps = false; - switch (static_cast(FEXCore::LongJump::SetJump(RestartControl.RestartJump))) { + switch (static_cast(FEXCore::UncheckedLongJump::SetJump(RestartControl.RestartJump))) { case RestartOptions::Control::Incoming: // Nothing break; diff --git a/FEXCore/Source/Interface/Core/JIT/JITClass.h b/FEXCore/Source/Interface/Core/JIT/JITClass.h index 19ea2904f..cdee1f9dc 100644 --- a/FEXCore/Source/Interface/Core/JIT/JITClass.h +++ b/FEXCore/Source/Interface/Core/JIT/JITClass.h @@ -68,7 +68,7 @@ private: const bool HostSupportsAFP {}; struct RestartOptions { - FEXCore::LongJump::JumpBuf RestartJump; + FEXCore::UncheckedLongJump::JumpBuf RestartJump; enum class Control : uint64_t { Incoming = 0, EnableFarARM64Jumps = 1, @@ -360,7 +360,7 @@ private: // We can support this but currently unnecessary. ERROR_AND_DIE_FMT("Tried to branch larger than 128MB away!"); - FEXCore::LongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); + FEXCore::UncheckedLongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); } template @@ -371,7 +371,7 @@ private: // We can support this but currently unnecessary. ERROR_AND_DIE_FMT("Tried to branch larger than 128MB away!"); - FEXCore::LongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); + FEXCore::UncheckedLongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); } template @@ -392,7 +392,7 @@ private: return; } - FEXCore::LongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); + FEXCore::UncheckedLongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); } template @@ -413,7 +413,7 @@ private: return; } - FEXCore::LongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); + FEXCore::UncheckedLongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); } template @@ -434,7 +434,7 @@ private: return; } - FEXCore::LongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); + FEXCore::UncheckedLongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); } template @@ -455,7 +455,7 @@ private: return; } - FEXCore::LongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); + FEXCore::UncheckedLongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); } template @@ -476,7 +476,7 @@ private: return; } - FEXCore::LongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); + FEXCore::UncheckedLongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); } template @@ -487,7 +487,7 @@ private: // We can support this but currently unnecessary. ERROR_AND_DIE_FMT("Long ADR currently unsupported!"); - FEXCore::LongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); + FEXCore::UncheckedLongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); } template @@ -498,7 +498,7 @@ private: // We can support this but currently unnecessary. ERROR_AND_DIE_FMT("Long ADRP currently unsupported!"); - FEXCore::LongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); + FEXCore::UncheckedLongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); } template @@ -513,7 +513,7 @@ private: return; } - FEXCore::LongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); + FEXCore::UncheckedLongJump::LongJump(RestartControl.RestartJump, FEXCore::ToUnderlying(RestartOptions::Control::EnableFarARM64Jumps)); } // This is purely a debugging aid for developers to see if they are in JIT code space when inspecting raw memory diff --git a/FEXCore/Source/Utils/LongJump.cpp b/FEXCore/Source/Utils/LongJump.cpp index d062f9d43..b036c8d7d 100644 --- a/FEXCore/Source/Utils/LongJump.cpp +++ b/FEXCore/Source/Utils/LongJump.cpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT #include -namespace FEXCore::LongJump { +namespace FEXCore::UncheckedLongJump { #if defined(_M_ARM_64) [[nodiscard]] FEX_DEFAULT_VISIBILITY FEX_NAKED uint64_t SetJump(JumpBuf& Buffer) { @@ -116,4 +116,4 @@ FEX_DEFAULT_VISIBILITY FEX_NAKED void LongJump(JumpBuf& Buffer, uint64_t Value) } #endif -} // namespace FEXCore::LongJump +} // namespace FEXCore::UncheckedLongJump diff --git a/FEXCore/include/FEXCore/Utils/LongJump.h b/FEXCore/include/FEXCore/Utils/LongJump.h index c746247b5..fcd010330 100644 --- a/FEXCore/include/FEXCore/Utils/LongJump.h +++ b/FEXCore/include/FEXCore/Utils/LongJump.h @@ -6,7 +6,7 @@ // Reimplementation of longjmp without glibc fortification checks. // This is useful to avoid false positives reported by glibc. -namespace FEXCore::LongJump { +namespace FEXCore::UncheckedLongJump { // JumpBuf definition needs to be public because the frontend needs to understand it. #if defined(_M_ARM_64) struct JumpBuf { @@ -34,4 +34,4 @@ struct JumpBuf { [[nodiscard]] FEX_DEFAULT_VISIBILITY uint64_t SetJump(JumpBuf& Buffer); [[noreturn]] FEX_DEFAULT_VISIBILITY void LongJump(JumpBuf& Buffer, uint64_t Value); -} // namespace FEXCore::LongJump +} // namespace FEXCore::UncheckedLongJump diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/Utils/Threads.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/Utils/Threads.cpp index 0a9e13d2b..20b786f4e 100644 --- a/Source/Tools/LinuxEmulation/LinuxSyscalls/Utils/Threads.cpp +++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/Utils/Threads.cpp @@ -261,7 +261,7 @@ namespace PThreads { return STracker; } - void SetupLongJump(FEXCore::LongJump::JumpBuf* exit_resolver) { + void SetupLongJump(FEXCore::UncheckedLongJump::JumpBuf* exit_resolver) { _exit_resolver = exit_resolver; } @@ -269,7 +269,7 @@ namespace PThreads { void LongJumpExit(FEX::HLE::ThreadStateObject* ThreadObject, uint32_t Status) { this->Status = Status; this->ThreadObject = ThreadObject; - FEXCore::LongJump::LongJump(*_exit_resolver, 1); + FEXCore::UncheckedLongJump::LongJump(*_exit_resolver, 1); FEX_UNREACHABLE; } @@ -288,9 +288,9 @@ namespace PThreads { void* UserArg; void* Stack {}; - // Use FEXCore's LongJump to avoid fortification checks. + // Use FEXCore's UncheckedLongJump to avoid fortification checks. // This avoids a false positive since glibc does not understand stack pivots. - FEXCore::LongJump::JumpBuf* _exit_resolver {}; + FEXCore::UncheckedLongJump::JumpBuf* _exit_resolver {}; FEX::HLE::ThreadStateObject* ThreadObject {}; uint32_t Status {}; }; @@ -301,11 +301,11 @@ namespace PThreads { PThread* Thread {reinterpret_cast(Ptr)}; StackBase = Thread->GetPivotStack(); STracker = Thread->GetStackTracker(); - FEXCore::LongJump::JumpBuf exit_resolver {}; + FEXCore::UncheckedLongJump::JumpBuf exit_resolver {}; bool LongJumpExit {}; - if (FEXCore::LongJump::SetJump(exit_resolver) == 0) { + if (FEXCore::UncheckedLongJump::SetJump(exit_resolver) == 0) { Thread->SetupLongJump(&exit_resolver); // Run the user function. // `Thread` object is dead after this function returns.