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

Function GetRegPtr

Kernel-Bridge/API/Hypervisor.cpp:2041–2081  ·  view source on GitHub ↗

Returns NULL if RegNum is RSP:

Source from the content-addressed store, hash-verified

2039
2040 // Returns NULL if RegNum is RSP:
2041 unsigned long long* GetRegPtr(unsigned char RegNum, __in GUEST_CONTEXT* Context)
2042 {
2043 switch (RegNum)
2044 {
2045 case 0:
2046 return &Context->Rax;
2047 case 1:
2048 return &Context->Rcx;
2049 case 2:
2050 return &Context->Rdx;
2051 case 3:
2052 return &Context->Rbx;
2053 case 4:
2054 // RSP (must be obtained by __vmx_vmread(VMCS_FIELD_GUEST_RSP)):
2055 return nullptr;
2056 case 5:
2057 return &Context->Rbp;
2058 case 6:
2059 return &Context->Rsi;
2060 case 7:
2061 return &Context->Rdi;
2062 case 8:
2063 return &Context->R8;
2064 case 9:
2065 return &Context->R9;
2066 case 10:
2067 return &Context->R10;
2068 case 11:
2069 return &Context->R11;
2070 case 12:
2071 return &Context->R12;
2072 case 13:
2073 return &Context->R13;
2074 case 14:
2075 return &Context->R14;
2076 case 15:
2077 return &Context->R15;
2078 default:
2079 return nullptr;
2080 }
2081 }
2082
2083 namespace VmexitHandlers
2084 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected