Functions | Variables
test.cpp File Reference

Go to the source code of this file.

Functions

void setup_mock (MockRepository &mocks, memory_manager_x64 *mm)
 
void proc_ctl_allow1 (uint64_t mask)
 
void proc_ctl_allow0 (uint64_t mask)
 
void proc_ctl_disallow1 (uint64_t mask)
 
void proc_ctl2_allow1 (uint64_t mask)
 
void proc_ctl2_allow0 (uint64_t mask)
 
void proc_ctl2_disallow1 (uint64_t mask)
 
void pin_ctl_allow1 (uint64_t mask)
 
void pin_ctl_allow0 (uint64_t mask)
 
void exit_ctl_allow1 (uint64_t mask)
 
void exit_ctl_allow0 (uint64_t mask)
 
void entry_ctl_allow1 (uint64_t mask)
 
void entry_ctl_allow0 (uint64_t mask)
 
void vmfunc_ctl_allow1 (uint64_t mask)
 
uint64_t __read_msr (uint32_t addr) noexcept
 
void __write_msr (uint32_t addr, uint64_t val) noexcept
 
uint32_t __cpuid_eax (uint32_t val) noexcept
 
uint32_t __cpuid_ecx (uint32_t val) noexcept
 
void __cpuid (void *eax, void *ebx, void *ecx, void *edx) noexcept
 
bool __vmread (uint64_t field, uint64_t *val) noexcept
 
bool __vmwrite (uint64_t field, uint64_t val) noexcept
 
bool __vmclear (void *ptr) noexcept
 
bool __vmptrld (void *ptr) noexcept
 
bool __vmlaunch_demote (void) noexcept
 
uintptr_t virtptr_to_physint (void *ptr)
 
void * physint_to_virtptr (uintptr_t phys)
 
int main (int argc, char *argv[])
 

Variables

std::map< uint32_t, uint64_t > g_msrs
 
std::map< uint64_t, uint64_t > g_vmcs_fields
 
std::map< uint32_t, uint32_t > g_eax_cpuid
 
struct cpuid_regs g_cpuid_regs
 
bool g_vmclear_fails = false
 
bool g_vmload_fails = false
 
bool g_vmlaunch_fails = false
 
bool g_virt_to_phys_return_nullptr = false
 
bool g_phys_to_virt_return_nullptr = false
 
uint64_t g_test_addr = 0U
 
uint64_t g_virt_apic_addr = 0U
 
uint8_t g_virt_apic_mem [0x81] = {0U}
 
uint64_t g_vmcs_link_addr = 1U
 
uint32_t g_vmcs_link_mem [1] = {0U}
 
uint64_t g_pdpt_addr = 2U
 
uint64_t g_pdpt_mem [4] = {0U}
 
std::map< uint64_t, void * > g_mock_mem
 

Function Documentation

◆ setup_mock()

void setup_mock ( MockRepository &  mocks,
memory_manager_x64 mm 
)

Definition at line 63 of file test.cpp.

◆ proc_ctl_allow1()

void proc_ctl_allow1 ( uint64_t  mask)

Definition at line 70 of file test.cpp.

◆ proc_ctl_allow0()

void proc_ctl_allow0 ( uint64_t  mask)

Definition at line 74 of file test.cpp.

◆ proc_ctl_disallow1()

void proc_ctl_disallow1 ( uint64_t  mask)

Definition at line 78 of file test.cpp.

◆ proc_ctl2_allow1()

void proc_ctl2_allow1 ( uint64_t  mask)

Definition at line 82 of file test.cpp.

◆ proc_ctl2_allow0()

void proc_ctl2_allow0 ( uint64_t  mask)

Definition at line 86 of file test.cpp.

◆ proc_ctl2_disallow1()

void proc_ctl2_disallow1 ( uint64_t  mask)

Definition at line 90 of file test.cpp.

◆ pin_ctl_allow1()

void pin_ctl_allow1 ( uint64_t  mask)

Definition at line 94 of file test.cpp.

◆ pin_ctl_allow0()

void pin_ctl_allow0 ( uint64_t  mask)

Definition at line 98 of file test.cpp.

◆ exit_ctl_allow1()

void exit_ctl_allow1 ( uint64_t  mask)

Definition at line 102 of file test.cpp.

◆ exit_ctl_allow0()

void exit_ctl_allow0 ( uint64_t  mask)

Definition at line 106 of file test.cpp.

◆ entry_ctl_allow1()

void entry_ctl_allow1 ( uint64_t  mask)

Definition at line 110 of file test.cpp.

◆ entry_ctl_allow0()

void entry_ctl_allow0 ( uint64_t  mask)

Definition at line 114 of file test.cpp.

◆ vmfunc_ctl_allow1()

void vmfunc_ctl_allow1 ( uint64_t  mask)

Definition at line 118 of file test.cpp.

◆ __read_msr()

uint64_t __read_msr ( uint32_t  addr)
noexcept

Definition at line 122 of file test.cpp.

◆ __write_msr()

void __write_msr ( uint32_t  addr,
uint64_t  val 
)
noexcept

Definition at line 126 of file test.cpp.

◆ __cpuid_eax()

uint32_t __cpuid_eax ( uint32_t  val)
noexcept

Definition at line 130 of file test.cpp.

◆ __cpuid_ecx()

uint32_t __cpuid_ecx ( uint32_t  val)
noexcept

Definition at line 134 of file test.cpp.

◆ __cpuid()

void __cpuid ( void *  eax,
void *  ebx,
void *  ecx,
void *  edx 
)
noexcept

Definition at line 138 of file test.cpp.

◆ __vmread()

bool __vmread ( uint64_t  field,
uint64_t *  val 
)
noexcept

Definition at line 147 of file test.cpp.

◆ __vmwrite()

bool __vmwrite ( uint64_t  field,
uint64_t  val 
)
noexcept

Definition at line 154 of file test.cpp.

◆ __vmclear()

bool __vmclear ( void *  ptr)
noexcept

Definition at line 161 of file test.cpp.

◆ __vmptrld()

bool __vmptrld ( void *  ptr)
noexcept

Definition at line 165 of file test.cpp.

◆ __vmlaunch_demote()

bool __vmlaunch_demote ( void  )
noexcept

Definition at line 169 of file test.cpp.

◆ virtptr_to_physint()

uintptr_t virtptr_to_physint ( void *  ptr)

Definition at line 173 of file test.cpp.

◆ physint_to_virtptr()

void* physint_to_virtptr ( uintptr_t  phys)

Definition at line 184 of file test.cpp.

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 1501 of file test.cpp.

Variable Documentation

◆ g_msrs

std::map<uint32_t, uint64_t> g_msrs

Definition at line 31 of file test.cpp.

◆ g_vmcs_fields

std::map<uint64_t, uint64_t> g_vmcs_fields

Definition at line 32 of file test.cpp.

◆ g_eax_cpuid

std::map<uint32_t, uint32_t> g_eax_cpuid

Definition at line 33 of file test.cpp.

◆ g_cpuid_regs

struct cpuid_regs g_cpuid_regs

Definition at line 35 of file test.cpp.

◆ g_vmclear_fails

bool g_vmclear_fails = false

Definition at line 37 of file test.cpp.

◆ g_vmload_fails

bool g_vmload_fails = false

Definition at line 38 of file test.cpp.

◆ g_vmlaunch_fails

bool g_vmlaunch_fails = false

Definition at line 39 of file test.cpp.

◆ g_virt_to_phys_return_nullptr

bool g_virt_to_phys_return_nullptr = false

Definition at line 40 of file test.cpp.

◆ g_phys_to_virt_return_nullptr

bool g_phys_to_virt_return_nullptr = false

Definition at line 41 of file test.cpp.

◆ g_test_addr

uint64_t g_test_addr = 0U

Definition at line 43 of file test.cpp.

◆ g_virt_apic_addr

uint64_t g_virt_apic_addr = 0U

Definition at line 44 of file test.cpp.

◆ g_virt_apic_mem

uint8_t g_virt_apic_mem[0x81] = {0U}

Definition at line 45 of file test.cpp.

◆ g_vmcs_link_addr

uint64_t g_vmcs_link_addr = 1U

Definition at line 47 of file test.cpp.

◆ g_vmcs_link_mem

uint32_t g_vmcs_link_mem[1] = {0U}

Definition at line 48 of file test.cpp.

◆ g_pdpt_addr

uint64_t g_pdpt_addr = 2U

Definition at line 50 of file test.cpp.

◆ g_pdpt_mem

uint64_t g_pdpt_mem[4] = {0U}

Definition at line 51 of file test.cpp.

◆ g_mock_mem

std::map<uint64_t, void *> g_mock_mem
Initial value:
{
{
{g_virt_apic_addr, static_cast<void *>(&g_virt_apic_mem)},
{g_vmcs_link_addr, static_cast<void *>(&g_vmcs_link_mem)},
{g_pdpt_addr, static_cast<void *>(&g_pdpt_mem)}
}
}
uint64_t g_pdpt_mem[4]
Definition: test.cpp:51
uint64_t g_pdpt_addr
Definition: test.cpp:50
uint8_t g_virt_apic_mem[0x81]
Definition: test.cpp:45
uint64_t g_vmcs_link_addr
Definition: test.cpp:47
uint64_t g_virt_apic_addr
Definition: test.cpp:44
uint32_t g_vmcs_link_mem[1]
Definition: test.cpp:48

Definition at line 54 of file test.cpp.