Skip to content

Instantly share code, notes, and snippets.

View hLunaaa's full-sized avatar
💤
Sleeping

hLunaaa

💤
Sleeping
View GitHub Profile
void InstrumentationCallback(CONTEXT *context)
{
TEB *teb = NtCurrentTeb();
context->Rip = teb->InstrumentationCallbackPreviousPc;
context->Rsp = teb->InstrumentationCallbackPreviousSp;
context->Rcx = context->R10;
// Prevent recursion
if (!teb->InstrumentationCallbackDisabled) {
@hLunaaa
hLunaaa / ia32e.hpp
Last active April 25, 2025 21:23
complete IA-32e paging for vtop
#pragma once
//
// https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-3a-part-1-manual.pdf
//
#define __pfn_to_page(pfn) (pfn << PAGE_SHIFT)
#define __page_to_pfn(pfn) (pfn >> PAGE_SHIFT)
union virt_addr_t
@hLunaaa
hLunaaa / cpuid_rdtsc.hpp
Last active April 17, 2025 19:17
vm cpu detection via cpuid and rdtsc
#include <iostream>
#include <thread>
static constexpr u32 dynamic_cycles = 10,
standard_sleep = 500,
vm_cycle_ratio = 100,
cycle_ratio = 75;
// -- rdtsc --
// https://github.com/hfiref0x/VBoxHardenedLoader