Bitdefender Hypervisor Memory Introspection
|
#include "introtypes.h"
Go to the source code of this file.
Data Structures | |
struct | _MSR_HOOK_STATE |
struct | _HOOK_MSR |
Typedefs | |
typedef INTSTATUS(* | PFUNC_MsrReadWriteHookCallback) (DWORD Msr, DWORD Flags, INTRO_ACTION *Action, void *Context, QWORD OriginalValue, QWORD *NewValue) |
Model specific register access callback. More... | |
typedef struct _MSR_HOOK_STATE | MSR_HOOK_STATE |
typedef struct _MSR_HOOK_STATE * | PMSR_HOOK_STATE |
typedef struct _HOOK_MSR | HOOK_MSR |
typedef struct _HOOK_MSR * | PHOOK_MSR |
Functions | |
INTSTATUS | IntHookMsrSetHook (DWORD Msr, DWORD Flags, PFUNC_MsrReadWriteHookCallback Callback, void *Context, void **Hook) |
Set a model-specific register write hook. More... | |
INTSTATUS | IntHookMsrRemoveHook (HOOK_MSR *Hook) |
Remove a model specific register hook. More... | |
INTSTATUS | IntHookMsrCommit (void) |
Commit the model specific register hooks. More... | |
INTSTATUS | IntHookMsrInit (void) |
Initialize the model specific registers hook state. More... | |
INTSTATUS | IntHookMsrUninit (void) |
Uninit the model specific register hooks state. More... | |
typedef struct _MSR_HOOK_STATE MSR_HOOK_STATE |
Global MSR hooks state.
typedef INTSTATUS(* PFUNC_MsrReadWriteHookCallback) (DWORD Msr, DWORD Flags, INTRO_ACTION *Action, void *Context, QWORD OriginalValue, QWORD *NewValue) |
Model specific register access callback.
[in] | Msr | The accessed MSR. |
[in] | Flags | Indicates read or write access. See IG_MSR_HOOK_TYPE. |
[out] | Action | Desired action. |
[in] | Context | Optional context, as passed to the hook set function. |
[in] | OriginalValue | Original MSR value. |
[in,out] | NewValue | New MSR value. Can be overridden, but whether this is handled by the HV or not is implementation specific. It is advisable to not modify this value. |
Definition at line 23 of file hook_msr.h.
typedef struct _MSR_HOOK_STATE * PMSR_HOOK_STATE |
INTSTATUS IntHookMsrCommit | ( | void | ) |
Commit the model specific register hooks.
This function will iterate the list of MSR hooks, and it will delete all the hooks that were flagged for removal.
INT_STATUS_SUCCESS | On success. |
INT_STATUS_NOT_INITIALIZED | If the MSR hooks state is not initialized. |
Definition at line 224 of file hook_msr.c.
Referenced by IntGuestPreReturnCallback().
INTSTATUS IntHookMsrInit | ( | void | ) |
Initialize the model specific registers hook state.
INT_STATUS_SUCCESS | On success. |
INT_STATUS_INSUFFICIENT_RESOURCES | If a memory alloc fails. |
Definition at line 262 of file hook_msr.c.
Referenced by IntGuestInit().
Remove a model specific register hook.
Removes a MSR write hook. First of all, this function will mark the hook as being disabled (the callback will never be called again). If we are currently in the context of a MSR violation, we will wait for the commit phase to permanently delete the hook. Otherwise, the hook will be deleted immediately. NOTE: If this is the last hook set on this particular MSR, VM exits will be disabled on it.
[in] | Hook | The hook to be removed. |
INT_STATUS_SUCCESS | On success. |
INT_STATUS_INVALID_PARAMETER | If an invalid parameter is supplied. |
Definition at line 138 of file hook_msr.c.
Referenced by IntHandleMsrViolation(), IntHookMsrRemoveAllHooks(), and IntMsrSyscallUnprotect().
INTSTATUS IntHookMsrSetHook | ( | DWORD | Msr, |
DWORD | Flags, | ||
PFUNC_MsrReadWriteHookCallback | Callback, | ||
void * | Context, | ||
void ** | Hook | ||
) |
Set a model-specific register write hook.
Establishes a hook on the given MSR (Model Specific Register). Flags may indicate whether it is a read, write or both hook. When the first hook is set on a MSR, VM exits are enabled for it. When the first MSR hook is set, the MSR access callback is registered to the HV.
[in] | Msr | The MSR to be intercepted. |
[in] | Flags | IG_MSR_HOOK_WRITE for write access, IG_MSR_HOOK_READ for read access. |
[in] | Callback | The callback to be called when Msr is accessed. |
[in] | Context | Optional context, will be passed to the callback on calls. |
[in] | Hook | Handle to the newly placed MSR hook. |
INT_STATUS_SUCCESS | On success. |
INT_STATUS_INVALID_PARAMETER | If an invalid parameter is supplied. |
INT_STATUS_INSUFFICIENT_RESOURCES | If a memory alloc fails. |
Definition at line 11 of file hook_msr.c.
Referenced by IntMsrSyscallProtect().
INTSTATUS IntHookMsrUninit | ( | void | ) |
Uninit the model specific register hooks state.
INT_STATUS_SUCCESS | On success. |
INT_STATUS_NOT_INITIALIZED_HINT | If the MSR hooks state is not initialized. |
Definition at line 285 of file hook_msr.c.
Referenced by IntGuestUninit().