MCPcopy Create free account
hub / github.com/HoShiMin/Kernel-Bridge / GetPhysicalAddress

Function GetPhysicalAddress

Kernel-Bridge/API/MemoryUtils.cpp:368–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366
367 _IRQL_requires_max_(APC_LEVEL)
368 PVOID64 GetPhysicalAddress(PVOID VirtualAddress, OPTIONAL PEPROCESS Process) {
369 if (!Process || Process == PsGetCurrentProcess()) {
370 return MmIsAddressValid(VirtualAddress)
371 ? reinterpret_cast<PVOID64>(MmGetPhysicalAddress(VirtualAddress).QuadPart)
372 : NULL;
373 }
374
375 KAPC_STATE ApcState;
376 KeStackAttachProcess(Process, &ApcState);
377 PVOID64 PhysicalAddress = MmIsAddressValid(VirtualAddress)
378 ? reinterpret_cast<PVOID64>(MmGetPhysicalAddress(VirtualAddress).QuadPart)
379 : NULL;
380 KeUnstackDetachProcess(&ApcState);
381 return PhysicalAddress;
382 }
383
384 PVOID GetVirtualForPhysical(PVOID64 PhysicalAddress) {
385 return MmGetVirtualForPhysical(*reinterpret_cast<PPHYSICAL_ADDRESS>(&PhysicalAddress));

Callers 6

IsPagePresentFunction · 0.85
BuildNestedPagingTablesFunction · 0.85
VirtualizeProcessorFunction · 0.85
InitializeEptTablesFunction · 0.85
InterceptPageMethod · 0.85
KbGetPhysicalAddressFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected