67 if (Cr == pListHook->Cr)
69 bCrAlreadyHooked =
TRUE;
74 if (!bCrAlreadyHooked)
79 ERROR(
"[ERROR] IntEnableCrWriteExit failed: 0x%08x\n", status);
160 if (NULL == pCrHooksState)
165 Hook->Disabled =
TRUE;
170 if ((pHook != Hook) && (pHook->Cr == Hook->Cr))
172 bCrStillHooked =
TRUE;
182 ERROR(
"[ERROR] IntDisableCrWriteExit failed: 0x%08x\n", status);
193 ERROR(
"[ERROR] IntHookCrDeleteHook failed: 0x%08x\n", status);
215 if (NULL == pCrHookState)
225 ERROR(
"[ERROR] IntHookCrRemoveHook failed: 0x%08x\n", status);
262 ERROR(
"[ERROR] IntHookCrDeleteHook failed: 0x%08x\n", status);
LIST_ENTRY Link
List entry link.
INT64 HooksCount
Total number of CR hooks.
INTSTATUS IntHookCrUninit(void)
Uninit the control register hooks state.
static INTSTATUS IntDisableCrNotifications(void)
void * Context
Optional context, will be passed to the callback.
#define INT_STATUS_SUCCESS
CR_HOOK_STATE * CrHooks
CR hook state.
#define INT_SUCCESS(Status)
#define HpAllocWithTag(Len, Tag)
INTSTATUS IntDisableCrWriteExit(DWORD Cr)
int INTSTATUS
The status data type.
INTSTATUS(* PFUNC_CrWriteHookCallback)(void *Context, DWORD Cr, QWORD OldValue, QWORD NewValue, INTRO_ACTION *Action)
Called when a control-register write takes place.
INTSTATUS IntHookCrInit(void)
Initialize the control registers hook state.
#define INT_STATUS_NOT_INITIALIZED
static BOOLEAN RemoveEntryList(LIST_ENTRY *Entry)
CPU_STATE State
The state of this VCPU. Describes what action is the VCPU currently doing.
INTSTATUS IntHookCrCommit(void)
Commit the control register hooks.
static INTSTATUS IntEnableCrNotifications(void)
#define HpFreeAndNullWithTag(Add, Tag)
INTSTATUS IntEnableCrWriteExit(DWORD Cr)
static INTSTATUS IntHookCrRemoveAllHooks(void)
Remove all control register write hooks.
static void InsertTailList(LIST_ENTRY *ListHead, LIST_ENTRY *Entry)
INTSTATUS IntHookCrRemoveHook(HOOK_CR *Hook)
Remove a control register hook.
static void InitializeListHead(LIST_ENTRY *ListHead)
PFUNC_CrWriteHookCallback Callback
Callback.
GUEST_STATE gGuest
The current guest state.
BOOLEAN Disabled
If true, the hook is disabled, and the callback will no longer be called.
static INTSTATUS IntHookCrDeleteHook(HOOK_CR *Hook)
Permanently delete a control register hook.
#define INT_STATUS_NOT_INITIALIZED_HINT
#define INT_STATUS_INVALID_PARAMETER_1
VCPU_STATE * gVcpu
The state of the current VCPU.
LIST_HEAD CrHooksList
The list of CR hooks.
DWORD Flags
Flags. Can be used by the caller.
#define list_for_each(_head, _struct_type, _var)
INTSTATUS IntHookCrSetHook(DWORD Cr, DWORD Flags, PFUNC_CrWriteHookCallback Callback, void *Context, HOOK_CR **Hook)
Set a control register write hook.
#define INT_STATUS_INSUFFICIENT_RESOURCES
#define INT_STATUS_INVALID_PARAMETER_3