MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / IsAddressInCodeBuffer

Method IsAddressInCodeBuffer

FEXCore/Source/Interface/Core/CPUBackend.cpp:422–439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420
421
422 bool CPUBackend::IsAddressInCodeBuffer(uintptr_t Address) const {
423 auto CheckCodeBuffer = [](CodeBuffer& Buffer, uintptr_t Address) {
424 // The last page of the code buffer is protected, so we need to exclude it from the valid range
425 // when checking if the address is in the code buffer.
426 uintptr_t LastPageAddr = AlignDown(reinterpret_cast<uintptr_t>(Buffer.Ptr) + Buffer.Size - 1, FEXCore::Utils::FEX_PAGE_SIZE);
427 return (Address >= reinterpret_cast<uintptr_t>(Buffer.Ptr) && Address < LastPageAddr);
428 };
429
430 if (CheckCodeBuffer(*CurrentCodeBuffer, Address)) {
431 return true;
432 }
433 for (auto& Buffer : SignalHandlerCodeBuffers) {
434 if (CheckCodeBuffer(*Buffer, Address)) {
435 return true;
436 }
437 }
438 return false;
439 }
440
441} // namespace CPU
442} // namespace FEXCore

Callers

nothing calls this directly

Calls 1

AlignDownFunction · 0.85

Tested by

no test coverage detected