mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 17:00:19 +02:00
FEXCore: Rename LongJump to UncheckedLongJump
This better reflects the difference to std::longjmp.
This commit is contained in:
1 parent
a61ab2803c
commit
79a685c15e
5 files changed
+22
-22
No files matched your search
@@ -825,7 +825,7 @@ CPUBackend::CompiledCode Arm64JITCore::CompileCode(uint64_t Entry, uint64_t Size
|
||||
this->IR = IR;
|
||||
RequiresFarARM64Jumps = false;
|
||||
|
||||
switch (static_cast<RestartOptions::Control>(FEXCore::LongJump::SetJump(RestartControl.RestartJump))) {
|
||||
switch (static_cast<RestartOptions::Control>(FEXCore::UncheckedLongJump::SetJump(RestartControl.RestartJump))) {
|
||||
case RestartOptions::Control::Incoming:
|
||||
// Nothing
|
||||
break;
|
||||
|
||||
@@ -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<ARMEmitter::IsLabel T>
|
||||
@@ -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<ARMEmitter::IsLabel T>
|
||||
@@ -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<ARMEmitter::IsLabel T>
|
||||
@@ -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<ARMEmitter::IsLabel T>
|
||||
@@ -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<ARMEmitter::IsLabel T>
|
||||
@@ -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<ARMEmitter::IsLabel T>
|
||||
@@ -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<ARMEmitter::IsLabel T>
|
||||
@@ -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<ARMEmitter::IsLabel T>
|
||||
@@ -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<ARMEmitter::IsLabel T>
|
||||
@@ -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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
#include <FEXCore/Utils/LongJump.h>
|
||||
|
||||
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
|
||||
@@ -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
|
||||
@@ -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<PThread*>(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.
|
||||
|
||||
Reference in new issue
Block a user