Invalidate code that HLE and the debugger write over

Helper thread stubs, fake syscall stubs and the module start trampoline go into memory that may
have held code (freed kernel memory, a reused thread stack), and the debugger memory views can
edit code. Invalidate what they write, which so far only happened by accident when the write hit
the first instruction of a JIT block.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-11 10:33:30 +02:00
1 parent 59fed92dac
commit 0a8ec4d8f1
5 files changed
+21 -2

No files matched your search

+2
View File
@@ -788,6 +788,8 @@ static void __KernelWriteFakeSysCall(u32 nid, u32 *ptr, u32 &pos) {
*ptr = pos;
pos += 8;
WriteHLESyscall("FakeSysCalls", nid, *ptr);
// The memory may have held code that's already compiled.
currentMIPS->InvalidateICacheRangeDeferred(*ptr, 8);
}
u32 HLEMipsCallReturnAddress() {