Main Vmcall Handler. 
  137{
  139 
  140    
  141    
  142    
  144    {
  146        {
  147            return STATUS_SUCCESS;
  148        }
  149        else
  150        {
  152        }
  153    }
  154 
  155    
  156    
  157    
  158    switch (VmcallNumber)
  159    {
  161    {
  162        VmcallStatus = 
VmcallTest(OptionalParam1, OptionalParam2, OptionalParam3);
 
  163        break;
  164    }
  166    {
  168        VmcallStatus = STATUS_SUCCESS;
  169 
  170        break;
  171    }
  173    {
  176 
  178                                                                (PVOID)OptionalParam1 ,
  179                                                                ProcCr3 ,
  181 
  183 
  184        break;
  185    }
  187    {
  189        VmcallStatus = STATUS_SUCCESS;
  190        break;
  191    }
  193    {
  195        VmcallStatus = STATUS_SUCCESS;
  196        break;
  197    }
  199    {
  201        VmcallStatus = STATUS_SUCCESS;
  202        break;
  203    }
  205    {
  207            VmcallStatus = STATUS_SUCCESS;
  208        else
  210 
  211        break;
  212    }
  214    {
  216        VmcallStatus = STATUS_SUCCESS;
  217        break;
  218    }
  220    {
  222        VmcallStatus = STATUS_SUCCESS;
  223        break;
  224    }
  226    {
  228        VmcallStatus = STATUS_SUCCESS;
  229        break;
  230    }
  232    {
  234        VmcallStatus = STATUS_SUCCESS;
  235        break;
  236    }
  238    {
  240        VmcallStatus = STATUS_SUCCESS;
  241        break;
  242    }
  244    {
  246        VmcallStatus = STATUS_SUCCESS;
  247        break;
  248    }
  250    {
  252        VmcallStatus = STATUS_SUCCESS;
  253        break;
  254    }
  256    {
  258        VmcallStatus = STATUS_SUCCESS;
  259        break;
  260    }
  262    {
  264        VmcallStatus = STATUS_SUCCESS;
  265        break;
  266    }
  268    {
  270        VmcallStatus = STATUS_SUCCESS;
  271        break;
  272    }
  274    {
  277 
  279                                            (PVOID)OptionalParam1, 
  280                                            ProcCr3);              
  281 
  283 
  284        break;
  285    }
  287    {
  289        VmcallStatus = STATUS_SUCCESS;
  290        break;
  291    }
  293    {
  295        VmcallStatus = STATUS_SUCCESS;
  296        break;
  297 
  298        break;
  299    }
  301    {
  303        VmcallStatus = STATUS_SUCCESS;
  304        break;
  305    }
  307    {
  309        VmcallStatus = STATUS_SUCCESS;
  310        break;
  311    }
  313    {
  315        VmcallStatus = STATUS_SUCCESS;
  316        break;
  317    }
  319    {
  321        VmcallStatus = STATUS_SUCCESS;
  322        break;
  323    }
  325    {
  327        VmcallStatus = STATUS_SUCCESS;
  328        break;
  329    }
  331    {
  333        VmcallStatus = STATUS_SUCCESS;
  334        break;
  335    }
  337    {
  339        VmcallStatus = STATUS_SUCCESS;
  340        break;
  341    }
  343    {
  345        VmcallStatus = STATUS_SUCCESS;
  346        break;
  347    }
  349    {
  351        VmcallStatus = STATUS_SUCCESS;
  352        break;
  353    }
  355    {
  357        VmcallStatus = STATUS_SUCCESS;
  358        break;
  359    }
  361    {
  363        VmcallStatus = STATUS_SUCCESS;
  364        break;
  365    }
  367    {
  369        VmcallStatus = STATUS_SUCCESS;
  370        break;
  371    }
  373    {
  375        VmcallStatus = STATUS_SUCCESS;
  376        break;
  377    }
  379    {
  381        VmcallStatus = STATUS_SUCCESS;
  382        break;
  383    }
  385    {
  387        VmcallStatus = STATUS_SUCCESS;
  388        break;
  389    }
  391    {
  393        VmcallStatus = STATUS_SUCCESS;
  394        break;
  395    }
  397    {
  399        VmcallStatus = STATUS_SUCCESS;
  400        break;
  401    }
  403    {
  405        VmcallStatus = STATUS_SUCCESS;
  406        break;
  407    }
  409    {
  411        VmcallStatus = STATUS_SUCCESS;
  412        break;
  413    }
  415    {
  417        VmcallStatus = STATUS_SUCCESS;
  418        break;
  419    }
  421    {
  423        {
  424            VmcallStatus = STATUS_SUCCESS;
  425        }
  426        else
  427        {
  429        }
  430 
  431        break;
  432    }
  434    {
  436 
  437        VmcallStatus = STATUS_SUCCESS;
  438        break;
  439    }
  441    {
  443 
  444        VmcallStatus = STATUS_SUCCESS;
  445        break;
  446    }
  448    {
  450 
  451        VmcallStatus = STATUS_SUCCESS;
  452        break;
  453    }
  455    {
  457 
  458        VmcallStatus = STATUS_SUCCESS;
  459        break;
  460    }
  461    default:
  462    {
  463        LogError(
"Err, unsupported VMCALL");
 
  465        break;
  466    }
  467    }
  468 
  469    return VmcallStatus;
  470}
unsigned int UINT32
Definition BasicTypes.h:48
BOOLEAN VmmCallbackVmcallHandler(UINT32 CoreId, UINT64 VmcallNumber, UINT64 OptionalParam1, UINT64 OptionalParam2, UINT64 OptionalParam3)
routine callback to handle external VMCALLs
Definition Callback.c:200
#define TOP_LEVEL_DRIVERS_VMCALL_ENDING_NUMBER
The start number of VMCALL number allowed to be used by top-level drivers.
Definition Constants.h:348
#define TOP_LEVEL_DRIVERS_VMCALL_STARTING_NUMBER
The start number of VMCALL number allowed to be used by top-level drivers.
Definition Constants.h:341
VOID DirtyLoggingDisable(VIRTUAL_MACHINE_STATE *VCpu)
Disables the dirty logging mechanism in VMX-root mode.
Definition DirtyLogging.c:156
BOOLEAN DirtyLoggingEnable(VIRTUAL_MACHINE_STATE *VCpu)
Enables the dirty logging mechanism in VMX-root mode.
Definition DirtyLogging.c:105
VOID SyscallHookConfigureEFER(VIRTUAL_MACHINE_STATE *VCpu, BOOLEAN EnableEFERSyscallHook)
This function enables or disables EFER syscall hoo.
Definition EferHook.c:31
BOOLEAN EptHookRestoreSingleHookToOriginalEntry(VIRTUAL_MACHINE_STATE *VCpu, SIZE_T PhysicalAddress, UINT64 OriginalEntry)
Remove and Invalidate Hook in TLB (Hidden Detours and if counter of hidden breakpoint is zero)
Definition EptHook.c:656
VOID EptHookRestoreAllHooksToOriginalEntry(VIRTUAL_MACHINE_STATE *VCpu)
Remove and Invalidate Hook in TLB.
Definition EptHook.c:704
BOOLEAN EptHookPerformPageHook(VIRTUAL_MACHINE_STATE *VCpu, PVOID TargetAddress, CR3_TYPE ProcessCr3)
The main function that performs EPT page hook with hidden breakpoint.
Definition EptHook.c:474
BOOLEAN EptHookPerformPageHookMonitorAndInlineHook(VIRTUAL_MACHINE_STATE *VCpu, PVOID HookingDetails, CR3_TYPE ProcessCr3, UINT32 PageHookMask)
The main function that performs EPT page hook with hidden detours and monitor.
Definition EptHook.c:980
VOID ExecTrapRestoreToNormalEptp(VIRTUAL_MACHINE_STATE *VCpu)
restore to normal EPTP
Definition ExecTrap.c:671
VOID ExecTrapChangeToUserDisabledMbecEptp(VIRTUAL_MACHINE_STATE *VCpu)
change to user-disabled MBEC EPTP
Definition ExecTrap.c:711
VOID HvSetPmcVmexit(BOOLEAN Set)
Set vm-exit for rdpmc instructions.
Definition Hv.c:509
VOID HvSetNmiExiting(BOOLEAN Set)
Set the NMI Exiting.
Definition Hv.c:953
VOID HvUnsetExceptionBitmap(VIRTUAL_MACHINE_STATE *VCpu, UINT32 IdtIndex)
Unset exception bitmap in VMCS.
Definition Hv.c:1039
VOID HvSetMovDebugRegsExiting(VIRTUAL_MACHINE_STATE *VCpu, BOOLEAN Set)
Set or unset the Mov to Debug Registers Exiting.
Definition Hv.c:1121
VOID HvSetSaveDebugControls(BOOLEAN Set)
Set SAVE DEBUG CONTROLS on Vm-exit controls.
Definition Hv.c:433
VOID HvSetExternalInterruptExiting(VIRTUAL_MACHINE_STATE *VCpu, BOOLEAN Set)
Set the External Interrupt Exiting.
Definition Hv.c:1055
VOID HvSetMovControlRegsExiting(BOOLEAN Set, UINT64 ControlRegister, UINT64 MaskRegister)
Set vm-exit for mov-to-cr0/4.
Definition Hv.c:543
VOID HvSetRdtscExiting(VIRTUAL_MACHINE_STATE *VCpu, BOOLEAN Set)
Set the RDTSC/P Exiting.
Definition Hv.c:1108
VOID HvSetMovToCr3Vmexit(VIRTUAL_MACHINE_STATE *VCpu, BOOLEAN Set)
Set vm-exit for mov-to-cr3.
Definition Hv.c:558
VOID HvSetLoadDebugControls(BOOLEAN Set)
Set LOAD DEBUG CONTROLS on Vm-entry controls.
Definition Hv.c:402
VOID HvSetExceptionBitmap(VIRTUAL_MACHINE_STATE *VCpu, UINT32 IdtIndex)
Set exception bitmap in VMCS.
Definition Hv.c:1022
#define LogError(format,...)
Log in the case of error.
Definition HyperDbgHyperLogIntrinsics.h:113
UCHAR EptInveptAllContexts()
Invalidates all contexts in EPT cache table.
Definition Invept.c:54
VOID IoHandlePerformIoBitmapReset(VIRTUAL_MACHINE_STATE *VCpu)
Reset I/O Bitmap.
Definition IoHandler.c:268
VOID IoHandlePerformIoBitmapChange(VIRTUAL_MACHINE_STATE *VCpu, UINT32 Port)
Change I/O Bitmap.
Definition IoHandler.c:241
VOID ModeBasedExecHookEnableOrDisable(VIRTUAL_MACHINE_STATE *VCpu, UINT32 State)
Enable/disable MBEC.
Definition ModeBasedExecHook.c:161
VOID MsrHandlePerformMsrBitmapWriteChange(VIRTUAL_MACHINE_STATE *VCpu, UINT32 MsrMask)
Change MSR Bitmap for write.
Definition MsrHandlers.c:469
VOID MsrHandlePerformMsrBitmapWriteReset(VIRTUAL_MACHINE_STATE *VCpu)
Reset MSR Bitmap for write.
Definition MsrHandlers.c:500
VOID MsrHandlePerformMsrBitmapReadChange(VIRTUAL_MACHINE_STATE *VCpu, UINT32 MsrMask)
Change MSR Bitmap for read.
Definition MsrHandlers.c:422
VOID MsrHandlePerformMsrBitmapReadReset(VIRTUAL_MACHINE_STATE *VCpu)
Reset MSR Bitmap for read.
Definition MsrHandlers.c:453
VOID ProtectedHvDisableRdtscExitingForDisablingTscCommands(VIRTUAL_MACHINE_STATE *VCpu)
Clear events of !tsc.
Definition ProtectedHv.c:570
VOID ProtectedHvResetExceptionBitmapToClearEvents(VIRTUAL_MACHINE_STATE *VCpu)
Reset exception bitmap in VMCS because of clearing !exception commands.
Definition ProtectedHv.c:141
VOID ProtectedHvExternalInterruptExitingForDisablingInterruptCommands(VIRTUAL_MACHINE_STATE *VCpu)
Clear events of !interrupt.
Definition ProtectedHv.c:269
VOID ProtectedHvDisableMovControlRegsExitingForDisablingCrCommands(VIRTUAL_MACHINE_STATE *VCpu, UINT64 ControlRegister, UINT64 MaskRegister)
Clear events of !crwrite.
Definition ProtectedHv.c:609
VOID ProtectedHvDisableMovDebugRegsExitingForDisablingDrCommands(VIRTUAL_MACHINE_STATE *VCpu)
Clear events of !dr.
Definition ProtectedHv.c:595
NTSTATUS VmcallTest(_In_ UINT64 Param1, _In_ UINT64 Param2, _In_ UINT64 Param3)
Test Vmcall (VMCALL_TEST)
Definition Vmcall.c:481
#define VMCALL_SET_VM_ENTRY_LOAD_DEBUG_CONTROLS
VMCALL to set VM-entry LOAD DEBUG CONTROLS.
Definition Vmcall.h:200
#define VMCALL_UNSET_VM_ENTRY_LOAD_DEBUG_CONTROLS
VMCALL to unset VM-entry LOAD DEBUG CONTROLS.
Definition Vmcall.h:208
#define VMCALL_DISABLE_MOV_TO_DEBUG_REGS_EXITING
VMCALL to disable mov to debug registers exiting.
Definition Vmcall.h:148
#define VMCALL_INVEPT_ALL_CONTEXTS
VMCALL to invalidate EPT (All Contexts)
Definition Vmcall.h:40
#define VMCALL_SET_RDPMC_EXITING
VMCALL to enable rdpmc exiting in primary cpu-based controls.
Definition Vmcall.h:94
#define VMCALL_SET_VM_EXIT_SAVE_DEBUG_CONTROLS
VMCALL to set VM-exit SAVE DEBUG CONTROLS.
Definition Vmcall.h:216
#define VMCALL_RESET_MSR_BITMAP_WRITE
VMCALL to reset MSR Bitmap Write.
Definition Vmcall.h:160
#define VMCALL_DISABLE_DIRTY_LOGGING_MECHANISM
VMCALL to disable dirty logging (PML) mechanism.
Definition Vmcall.h:280
#define VMCALL_CHANGE_PAGE_ATTRIB
VMCALL to Hook Change the attribute bits of the EPT Table.
Definition Vmcall.h:34
#define VMCALL_RESET_EXCEPTION_BITMAP_ONLY_ON_CLEARING_EXCEPTION_EVENTS
VMCALL to reset exception bitmap on VMCS.
Definition Vmcall.h:168
#define VMCALL_RESET_MSR_BITMAP_READ
VMCALL to reset MSR Bitmap Read.
Definition Vmcall.h:154
#define VMCALL_INVEPT_SINGLE_CONTEXT
VMCALL to invalidate EPT (A Single Context)
Definition Vmcall.h:46
#define VMCALL_UNSET_EXCEPTION_BITMAP
VMCALL to unset exception bitmap on VMCS.
Definition Vmcall.h:192
#define VMCALL_SET_VM_EXIT_ON_NMIS
VMCALL to cause vm-exit on NMIs.
Definition Vmcall.h:230
#define VMCALL_VMXOFF
VMCALL to Call VMXOFF to turn off the hypervisor.
Definition Vmcall.h:28
#define VMCALL_CHANGE_MSR_BITMAP_WRITE
VMCALL to change MSR Bitmap Write.
Definition Vmcall.h:82
#define VMCALL_ENABLE_DIRTY_LOGGING_MECHANISM
VMCALL to enable dirty logging (PML) mechanism.
Definition Vmcall.h:274
#define VMCALL_TEST
VMCALL to test hypervisor.
Definition Vmcall.h:22
#define VMCALL_ENABLE_MOV_TO_CR3_EXITING
VMCALL to enable cr3 exiting.
Definition Vmcall.h:180
#define VMCALL_DISABLE_MOV_TO_CONTROL_REGS_EXITING
VMCALL to disable mov to CR exiting.
Definition Vmcall.h:261
#define VMCALL_SET_RDTSC_EXITING
VMCALL to enable rdtsc/rdtscp exiting in primary cpu-based controls.
Definition Vmcall.h:88
#define VMCALL_CHANGE_IO_BITMAP
VMCALL to change I/O Bitmaps (A & B)
Definition Vmcall.h:118
#define VMCALL_UNSET_VM_EXIT_ON_NMIS
VMCALL to not cause vm-exit on NMIs.
Definition Vmcall.h:236
#define VMCALL_SET_EXCEPTION_BITMAP
VMCALL to set exception bitmap on VMCS.
Definition Vmcall.h:100
#define VMCALL_UNHOOK_ALL_PAGES
VMCALL to remove a all physical addresses from hook list.
Definition Vmcall.h:52
#define VMCALL_SET_HIDDEN_CC_BREAKPOINT
VMCALL to put hidden breakpoints (using EPT)
Definition Vmcall.h:124
#define VMCALL_RESTORE_TO_NORMAL_EPTP
VMCALL to restore EPTP to normal EPTP.
Definition Vmcall.h:292
#define VMCALL_DISABLE_OR_ENABLE_MBEC
VMCALL to enable/disable MBEC.
Definition Vmcall.h:298
#define VMCALL_ENABLE_SYSCALL_HOOK_EFER
VMCALL to enable syscall hook using EFER SCE bit.
Definition Vmcall.h:64
#define VMCALL_UNSET_VM_EXIT_SAVE_DEBUG_CONTROLS
VMCALL to unset VM-exit SAVE DEBUG CONTROLS.
Definition Vmcall.h:224
#define VMCALL_ENABLE_MOV_TO_DEBUG_REGS_EXITING
VMCALL to enable mov to debug registers exiting.
Definition Vmcall.h:106
#define VMCALL_UNSET_RDTSC_EXITING
VMCALL to disable rdtsc/rdtscp exiting in primary cpu-based controls.
Definition Vmcall.h:130
#define VMCALL_UNSET_RDPMC_EXITING
VMCALL to disable rdpmc exiting in primary cpu-based controls.
Definition Vmcall.h:142
#define VMCALL_ENABLE_EXTERNAL_INTERRUPT_EXITING
VMCALL to enable external interrupt exiting.
Definition Vmcall.h:112
#define VMCALL_DISABLE_SYSCALL_HOOK_EFER
VMCALL to disable syscall hook using EFER SCE bit.
Definition Vmcall.h:70
#define VMCALL_CHANGE_TO_MBEC_SUPPORTED_EPTP
VMCALL to change EPTP to an MBEC-supported EPTP.
Definition Vmcall.h:286
#define VMCALL_DISABLE_MOV_TO_CR_EXITING_ONLY_FOR_CR_EVENTS
VMCALL to clear mov 2 cr exiting bit ONLY in the case of disabling the events for !...
Definition Vmcall.h:268
#define VMCALL_ENABLE_MOV_TO_CONTROL_REGS_EXITING
VMCALL to enable mov to CR exiting.
Definition Vmcall.h:255
#define VMCALL_DISABLE_RDTSC_EXITING_ONLY_FOR_TSC_EVENTS
VMCALL to clear rdtsc exiting bit ONLY in the case of disabling the events for !tsc command.
Definition Vmcall.h:243
#define VMCALL_DISABLE_EXTERNAL_INTERRUPT_EXITING_ONLY_TO_CLEAR_INTERRUPT_COMMANDS
VMCALL to disable external interrupt exiting only to clear !interrupt commands.
Definition Vmcall.h:136
#define VMCALL_RESET_IO_BITMAP
VMCALL to reset I/O Bitmaps (A & B)
Definition Vmcall.h:174
#define VMCALL_UNHOOK_SINGLE_PAGE
VMCALL to restore a single EPT entry and invalidate EPT cache.
Definition Vmcall.h:58
#define VMCALL_DISABLE_MOV_TO_HW_DR_EXITING_ONLY_FOR_DR_EVENTS
VMCALL to clear mov 2 hw dr exiting bit ONLY in the case of disabling the events for !...
Definition Vmcall.h:250
#define VMCALL_DISABLE_MOV_TO_CR3_EXITING
VMCALL to disable cr3 exiting.
Definition Vmcall.h:186
#define VMCALL_CHANGE_MSR_BITMAP_READ
VMCALL to change MSR Bitmap Read.
Definition Vmcall.h:76
VOID VmxVmxoff(VIRTUAL_MACHINE_STATE *VCpu)
Prepare and execute Vmxoff instruction.
Definition Vmx.c:1101
#define STATUS_UNSUCCESSFUL
Definition Windows.h:172
CR3 Structure.
Definition BasicTypes.h:130
UINT64 Flags
Definition BasicTypes.h:133
UINT32 CoreId
Definition State.h:306