FEXCore: Split GDT and LDT prep work

Taking this very slowly because this is very fickle code. The frontend
needs to manage GDT and LDT, but before we get there, we need to
actually add support for LDT in the backend. Split the segments to two
arrays so the JIT can actually update their cached values correctly.

Still treats GDT and LDT as mirrors like how the JIT previously did (By
it ignoring the selector's TI bit).
This commit is contained in:
Ryan Houdek committed 2025-08-11 20:45:51 -07:00
1 parent b3d1aade71
commit 3f9df49e3e
8 files changed
+72 -42

No files matched your search

+3 -2
View File
@@ -382,8 +382,9 @@ static void LoadStateFromECContext(FEXCore::Core::InternalThreadState* Thread, C
// The TEB is the only populated GDT entry by default
const auto TEB = reinterpret_cast<uint64_t>(NtCurrentTeb());
State.SetGDTBase(&State.gdt[(Context.SegGs & 0xffff) >> 3], TEB);
State.SetGDTLimit(&State.gdt[(Context.SegGs & 0xffff) >> 3], 0xF'FFFFU);
auto GDT = State.GetSegmentFromIndex(State, (Context.SegGs & 0xffff));
State.SetGDTBase(GDT, TEB);
State.SetGDTLimit(GDT, 0xF'FFFFU);
State.gs_cached = TEB;
State.fs_cached = 0;
State.es_cached = 0;