29 #define BF_NX_TAG 'BFNX' 38 ALERT(
"platform_alloc: invalid length\n");
42 addr = ExAllocatePoolWithTag(NonPagedPool, len,
BF_TAG);
45 ALERT(
"platform_alloc_rw: failed to ExAllocatePoolWithTag mem: %lld\n", len);
57 ALERT(
"platform_alloc: invalid length\n");
61 addr = ExAllocatePoolWithTag(NonPagedPoolExecute, len,
BF_TAG);
64 ALERT(
"platform_alloc_rw: failed to ExAllocatePoolWithTag mem: %lld\n", len);
72 PHYSICAL_ADDRESS
addr = MmGetPhysicalAddress(virt);
74 return (
void *)addr.QuadPart;
84 ALERT(
"platform_free_rw: invalid address %p\n", addr);
88 ExFreePoolWithTag(addr,
BF_TAG);
98 ALERT(
"platform_free_rw: invalid address %p\n", addr);
102 ExFreePoolWithTag(addr,
BF_TAG);
111 RtlFillMemory(ptr, num, value);
120 RtlCopyMemory(dst, src, num);
139 return (int64_t)KeQueryActiveProcessorCount(&k_affin);
145 KAFFINITY new_affinity = (1ULL << affinity);
146 return (int64_t)KeSetSystemAffinityThreadEx(new_affinity);
152 KeRevertToUserAffinityThreadEx((KAFFINITY)(affinity));
constexpr const auto addr
constexpr page_table_x64::integer_pointer virt