mirror of
https://github.com/gwdevhub/gMod.git
synced 2026-07-21 01:49:31 +00:00
Flush instruction cache after (un)hooking so the ARM64 emulator re-JITs
MinHook flushes only the 5 patched bytes; under the x86-on-ARM64 emulator (xtajit) that can leave a stale JIT translation of the modified prologue and trap with a non-continuable breakpoint. Flush the whole prologue and the trampoline on install, and the restored prologue on teardown, so the emulator re-translates them. No-op on native x86. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -252,6 +252,10 @@ void InitInstance(HINSTANCE hModule)
|
||||
if (GetProcAddress_fn) {
|
||||
MH_CreateHook(GetProcAddress_fn, OnGetProcAddress, (void**)&GetProcAddress_ret);
|
||||
MH_EnableHook(GetProcAddress_fn);
|
||||
// Re-JIT the patched prologue + trampoline under the x86-on-ARM64 emulator (no-op native).
|
||||
const HANDLE proc = GetCurrentProcess();
|
||||
FlushInstructionCache(proc, (void*)GetProcAddress_fn, 64);
|
||||
if (GetProcAddress_ret) FlushInstructionCache(proc, (void*)GetProcAddress_ret, 64);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user