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

Method AdjustAddrForSpecialRegion

FEXCore/Source/Interface/Core/Frontend.cpp:1287–1302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1285}
1286
1287const uint8_t* Decoder::AdjustAddrForSpecialRegion(const uint8_t* _InstStream, uint64_t EntryPoint, uint64_t RIP) {
1288 constexpr uint64_t VSyscall_Base = 0xFFFF'FFFF'FF60'0000ULL;
1289 constexpr uint64_t VSyscall_End = VSyscall_Base + 0x1000;
1290
1291 if (OSABI == FEXCore::HLE::SyscallOSABI::OS_LINUX64 && RIP >= VSyscall_Base && RIP < VSyscall_End) {
1292 // VSyscall
1293 // This doesn't exist on AArch64 and on x86_64 hosts this is emulated with faults to a region mapped with --xp permissions
1294 // Offset 0: vgettimeofday
1295 // Offset 0x400: vtime
1296 // Offset 0x800: vgetcpu
1297 uint64_t Offset = RIP - VSyscall_Base;
1298 return VSyscallData + Offset;
1299 }
1300
1301 return _InstStream - EntryPoint + RIP;
1302}
1303
1304void Decoder::DecodeInstructionsAtEntry(FEXCore::Core::InternalThreadState *Thread, const uint8_t* _InstStream, uint64_t PC, uint64_t MaxInst) {
1305 FEXCORE_PROFILE_SCOPED("DecodeInstructions");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected