HyperPlatform Programmer's Reference
|
Implements primitive utility functions. More...
#include "util.h"
#include <intrin.h>
#include "asm.h"
#include "common.h"
#include "log.h"
#include "util_page_constants.h"
Go to the source code of this file.
Classes | |
struct | LdrDataTableEntry |
Typedefs | |
using | RtlPcToFileHeaderType = decltype(RtlPcToFileHeader) |
using | MmAllocateContiguousNodeMemoryType = decltype(MmAllocateContiguousNodeMemory) |
Functions | |
NTKERNELAPI PVOID NTAPI | RtlPcToFileHeader (_In_ PVOID PcValue, _Out_ PVOID *BaseOfImage) |
NTKERNELAPI | _Post_writable_byte_size_ (NumberOfBytes)) PVOID MmAllocateContiguousNodeMemory(_In_ SIZE_T NumberOfBytes |
static NTSTATUS | UtilpInitializePageTableVariables () |
static NTSTATUS | UtilpInitializeRtlPcToFileHeader (_In_ PDRIVER_OBJECT driver_object) |
static PVOID NTAPI | UtilpUnsafePcToFileHeader (_In_ PVOID pc_value, _Out_ PVOID *base_of_image) |
static NTSTATUS | UtilpInitializePhysicalMemoryRanges () |
static PhysicalMemoryDescriptor * | UtilpBuildPhysicalMemoryRanges () |
static bool | UtilpIsCanonicalFormAddress (_In_ void *address) |
static HardwarePte * | UtilpAddressToPxe (_In_ const void *address) |
static HardwarePte * | UtilpAddressToPpe (_In_ const void *address) |
static HardwarePte * | UtilpAddressToPde (_In_ const void *address) |
static HardwarePte * | UtilpAddressToPte (_In_ const void *address) |
NTSTATUS | UtilInitialization (PDRIVER_OBJECT driver_object) |
void | UtilTermination () |
Frees all resources allocated for the sake of the Util functions. More... | |
static NTSTATUS | UtilpInitializeRtlPcToFileHeader (PDRIVER_OBJECT driver_object) |
static PVOID NTAPI | UtilpUnsafePcToFileHeader (PVOID pc_value, PVOID *base_of_image) |
void * | UtilPcToFileHeader (void *pc_value) |
const PhysicalMemoryDescriptor * | UtilGetPhysicalMemoryRanges () |
Returns ranges of physical memory on the system. More... | |
NTSTATUS | UtilForEachProcessor (NTSTATUS(*callback_routine)(void *), void *context) |
NTSTATUS | UtilForEachProcessorDpc (PKDEFERRED_ROUTINE deferred_routine, void *context) |
NTSTATUS | UtilSleep (LONG Millisecond) |
void * | UtilMemMem (const void *search_base, SIZE_T search_size, const void *pattern, SIZE_T pattern_size) |
void * | UtilGetSystemProcAddress (const wchar_t *proc_name) |
bool | UtilIsX86Pae () |
Checks if the system is a PAE-enabled x86 system. More... | |
bool | UtilIsAccessibleAddress (void *address) |
static bool | UtilpIsCanonicalFormAddress (void *address) |
static HardwarePte * | UtilpAddressToPxe (const void *address) |
static HardwarePte * | UtilpAddressToPpe (const void *address) |
static HardwarePte * | UtilpAddressToPde (const void *address) |
static HardwarePte * | UtilpAddressToPte (const void *address) |
ULONG64 | UtilPaFromVa (void *va) |
PFN_NUMBER | UtilPfnFromVa (void *va) |
PFN_NUMBER | UtilPfnFromPa (ULONG64 pa) |
void * | UtilVaFromPa (ULONG64 pa) |
ULONG64 | UtilPaFromPfn (PFN_NUMBER pfn) |
void * | UtilVaFromPfn (PFN_NUMBER pfn) |
void * | UtilAllocateContiguousMemory (SIZE_T number_of_bytes) |
void | UtilFreeContiguousMemory (void *base_address) |
NTSTATUS | UtilVmCall (HypercallNumber hypercall_number, void *context) |
void | UtilDumpGpRegisters (const AllRegisters *all_regs, ULONG_PTR stack_pointer) |
ULONG_PTR | UtilVmRead (VmcsField field) |
ULONG64 | UtilVmRead64 (VmcsField field) |
VmxStatus | UtilVmWrite (VmcsField field, ULONG_PTR field_value) |
VmxStatus | UtilVmWrite64 (VmcsField field, ULONG64 field_value) |
ULONG_PTR | UtilReadMsr (Msr msr) |
ULONG64 | UtilReadMsr64 (Msr msr) |
void | UtilWriteMsr (Msr msr, ULONG_PTR value) |
void | UtilWriteMsr64 (Msr msr, ULONG64 value) |
VmxStatus | UtilInveptGlobal () |
Executes the INVEPT instruction and invalidates EPT entry cache. More... | |
VmxStatus | UtilInvvpidIndividualAddress (USHORT vpid, void *address) |
VmxStatus | UtilInvvpidSingleContext (USHORT vpid) |
VmxStatus | UtilInvvpidAllContext () |
Executes the INVVPID instruction (type 2) More... | |
VmxStatus | UtilInvvpidSingleContextExceptGlobal (USHORT vpid) |
void | UtilLoadPdptes (ULONG_PTR cr3_value) |
NTSTATUS | UtilForceCopyMemory (void *destination, const void *source, SIZE_T length) |
Variables | |
static const auto | kUtilpUseRtlPcToFileHeader = false |
NTKERNELAPI _In_ PHYSICAL_ADDRESS | LowestAcceptableAddress |
NTKERNELAPI _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS | HighestAcceptableAddress |
NTKERNELAPI _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS | BoundaryAddressMultiple |
NTKERNELAPI _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS _In_ ULONG | Protect |
NTKERNELAPI _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS _In_ ULONG _In_ NODE_REQUIREMENT | PreferredNode |
static RtlPcToFileHeaderType * | g_utilp_RtlPcToFileHeader |
static LIST_ENTRY * | g_utilp_PsLoadedModuleList |
static PhysicalMemoryDescriptor * | g_utilp_physical_memory_ranges |
static MmAllocateContiguousNodeMemoryType * | g_utilp_MmAllocateContiguousNodeMemory |
static ULONG_PTR | g_utilp_pxe_base = 0 |
static ULONG_PTR | g_utilp_ppe_base = 0 |
static ULONG_PTR | g_utilp_pde_base = 0 |
static ULONG_PTR | g_utilp_pte_base = 0 |
static ULONG_PTR | g_utilp_pxi_shift = 0 |
static ULONG_PTR | g_utilp_ppi_shift = 0 |
static ULONG_PTR | g_utilp_pdi_shift = 0 |
static ULONG_PTR | g_utilp_pti_shift = 0 |
static ULONG_PTR | g_utilp_pxi_mask = 0 |
static ULONG_PTR | g_utilp_ppi_mask = 0 |
static ULONG_PTR | g_utilp_pdi_mask = 0 |
static ULONG_PTR | g_utilp_pti_mask = 0 |
Implements primitive utility functions.
Definition in file util.cpp.
using MmAllocateContiguousNodeMemoryType = decltype(MmAllocateContiguousNodeMemory) |
using RtlPcToFileHeaderType = decltype(RtlPcToFileHeader) |
NTKERNELAPI _Post_writable_byte_size_ | ( | NumberOfBytes | ) |
NTKERNELAPI PVOID NTAPI RtlPcToFileHeader | ( | _In_ PVOID | PcValue, |
_Out_ PVOID * | BaseOfImage | ||
) |
void* UtilAllocateContiguousMemory | ( | SIZE_T | number_of_bytes | ) |
void UtilDumpGpRegisters | ( | const AllRegisters * | all_regs, |
ULONG_PTR | stack_pointer | ||
) |
NTSTATUS UtilForceCopyMemory | ( | void * | destination, |
const void * | source, | ||
SIZE_T | length | ||
) |
NTSTATUS UtilForEachProcessor | ( | NTSTATUS(*)(void *) | callback_routine, |
void * | context | ||
) |
NTSTATUS UtilForEachProcessorDpc | ( | PKDEFERRED_ROUTINE | deferred_routine, |
void * | context | ||
) |
void UtilFreeContiguousMemory | ( | void * | base_address | ) |
const PhysicalMemoryDescriptor* UtilGetPhysicalMemoryRanges | ( | ) |
void* UtilGetSystemProcAddress | ( | const wchar_t * | proc_name | ) |
NTSTATUS UtilInitialization | ( | PDRIVER_OBJECT | driver_object | ) |
VmxStatus UtilInveptGlobal | ( | ) |
VmxStatus UtilInvvpidAllContext | ( | ) |
VmxStatus UtilInvvpidIndividualAddress | ( | USHORT | vpid, |
void * | address | ||
) |
VmxStatus UtilInvvpidSingleContext | ( | USHORT | vpid | ) |
VmxStatus UtilInvvpidSingleContextExceptGlobal | ( | USHORT | vpid | ) |
bool UtilIsAccessibleAddress | ( | void * | address | ) |
bool UtilIsX86Pae | ( | ) |
void UtilLoadPdptes | ( | ULONG_PTR | cr3_value | ) |
void* UtilMemMem | ( | const void * | search_base, |
SIZE_T | search_size, | ||
const void * | pattern, | ||
SIZE_T | pattern_size | ||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
ULONG64 UtilPaFromPfn | ( | PFN_NUMBER | pfn | ) |
ULONG64 UtilPaFromVa | ( | void * | va | ) |
|
static |
PFN_NUMBER UtilPfnFromPa | ( | ULONG64 | pa | ) |
PFN_NUMBER UtilPfnFromVa | ( | void * | va | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
ULONG_PTR UtilReadMsr | ( | Msr | msr | ) |
ULONG64 UtilReadMsr64 | ( | Msr | msr | ) |
void UtilTermination | ( | ) |
void* UtilVaFromPa | ( | ULONG64 | pa | ) |
void* UtilVaFromPfn | ( | PFN_NUMBER | pfn | ) |
NTSTATUS UtilVmCall | ( | HypercallNumber | hypercall_number, |
void * | context | ||
) |
ULONG_PTR UtilVmRead | ( | VmcsField | field | ) |
ULONG64 UtilVmRead64 | ( | VmcsField | field | ) |
void UtilWriteMsr64 | ( | Msr | msr, |
ULONG64 | value | ||
) |
NTKERNELAPI _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS BoundaryAddressMultiple |
|
static |
|
static |
|
static |
NTKERNELAPI _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS HighestAcceptableAddress |
NTKERNELAPI _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS _In_ ULONG _In_ NODE_REQUIREMENT PreferredNode |