Files
AnyPS5/core/libs/tests/GuestUnwindModuleInfoFixture.cpp
T
JAB-devandClaude Sonnet 5.5 61ed25d9ed fix(libkernel): drop the cached unwind tables when the loader frees a module
The cache key of relinked images has no time stamp or check sum, so a
different module of the same size loaded at the same base was served the
old tables. The loader now forgets the image when it frees the module, the
cache has a separate valid flag, and the sysmodule name cache is left out
of this change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-13 18:13:12 +02:00

26 lines
860 B
C++

#include "tests/GuestUnwindModuleInfoFixture.hpp"
#include <cstdint>
#include <windows.h>
asm(".section .ehmeta,\"dw\"\n"
".globl UnwindFixtureMeta\n"
".p2align 2\n"
"UnwindFixtureMeta:\n"
" .long 0\n"
".text\n");
extern "C" IMAGE_DOS_HEADER __ImageBase;
extern "C" std::uint32_t UnwindFixtureMeta;
static UnwindFixture fixture;
extern "C" UnwindFixture* GetUnwindFixture() {
const auto base = reinterpret_cast<std::uintptr_t>(&__ImageBase);
fixture.header.frames = static_cast<std::int32_t>(reinterpret_cast<std::intptr_t>(&fixture.frames) - reinterpret_cast<std::intptr_t>(&fixture.header.frames));
UnwindFixtureMeta = static_cast<std::uint32_t>(reinterpret_cast<std::uintptr_t>(&fixture.header) - base);
return &fixture;
}
extern "C" UnwindFixture* GetUnwindFixture_nid_no_patch() { return GetUnwindFixture(); }