mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-13 03:00:42 +02:00
Windows: Use FrontendPtr for extra TLS space on WOW64/ARM64EC
We have run out of EmulatorData slots on ARM64EC, so introduce this for less-frequently accessed TLS data for which the additional cost doesn't matter.
This commit is contained in:
1 parent
e97b18e244
commit
ec13e5d503
2 files changed
+24
No files matched your search
@@ -126,6 +126,10 @@ struct ThreadCPUArea {
|
||||
}
|
||||
};
|
||||
|
||||
struct FrontendThreadData {
|
||||
bool InLockedRWXRead {};
|
||||
};
|
||||
|
||||
namespace {
|
||||
fextl::unique_ptr<FEXCore::Context::Context> CTX;
|
||||
fextl::unique_ptr<FEX::DummyHandlers::DummySignalDelegator> SignalDelegator;
|
||||
@@ -150,6 +154,10 @@ ThreadCPUArea GetCPUArea() {
|
||||
return ThreadCPUArea(NtCurrentTeb());
|
||||
}
|
||||
|
||||
FrontendThreadData* GetFrontendThreadData(FEXCore::Core::InternalThreadState* Thread) {
|
||||
return static_cast<FrontendThreadData*>(Thread->FrontendPtr);
|
||||
}
|
||||
|
||||
bool IsEmulatorStackAddress(const ThreadCPUArea CPUArea, uint64_t Address) {
|
||||
return Address <= CPUArea.EmulatorStackBase() && Address >= CPUArea.EmulatorStackLimit();
|
||||
}
|
||||
@@ -928,6 +936,8 @@ NTSTATUS ThreadInit() {
|
||||
.AMD64_ControlWord = 0x27f};
|
||||
Exception::LoadStateFromECContext(Thread, CPUArea.ContextAmd64().AMD64_Context);
|
||||
|
||||
Thread->FrontendPtr = new FrontendThreadData();
|
||||
|
||||
{
|
||||
auto ThreadTID = GetCurrentThreadId();
|
||||
Threads.emplace(ThreadTID, Thread);
|
||||
@@ -983,6 +993,8 @@ NTSTATUS ThreadTerm(HANDLE Thread, LONG ExitCode) {
|
||||
}
|
||||
auto ThreadState = CPUArea.ThreadState();
|
||||
|
||||
delete GetFrontendThreadData(ThreadState);
|
||||
|
||||
// GDT and LDT are mirrored, only free one.
|
||||
delete[] ThreadState->CurrentFrame->State.segment_arrays[FEXCore::Core::CPUState::SEGMENT_ARRAY_INDEX_GDT];
|
||||
|
||||
|
||||
Reference in new issue
Block a user