Bitdefender Hypervisor Memory Introspection
winpfn.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Bitdefender
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 #ifndef _WINPFN_H_
6 #define _WINPFN_H_
7 
8 #include "introtypes.h"
9 
11 #define WIN_PFN_INC_VALUE 0xbd
12 
14 #define WIN_PFN_REF_MAX 0xffff
15 
19 typedef struct _WIN_PFN_LOCK
20 {
32 
36  void *SwapHook;
37 
53 
60 #define WIN_PFN_GET_STRUCT_VA(MmPfn, Gpa) \
61  ((MmPfn) + \
62  ((((gGuest.Guest64 || !gGuest.PaeEnabled)) ? \
63  WIN_KM_FIELD(Mmpfn, Size) : WIN_KM_FIELD(Mmpfn, PaeSize)) * ((Gpa) >> 12)))
64 
69 typedef enum
70 {
80 
83  _In_ QWORD MmPfnDatabase
84  );
85 
88  _In_ QWORD Gva,
89  _Out_opt_ WIN_PFN_LOCK **PfnLock
90  );
91 
94  _In_ QWORD Gpa,
95  _Out_opt_ WIN_PFN_LOCK **PfnLock
96  );
97 
100  _Inout_ WIN_PFN_LOCK *PfnLock,
101  _In_ BOOLEAN Force
102  );
103 
104 void
106  void
107  );
108 
109 void
111  void
112  );
113 
114 #endif
The page is active and valid, but not part of any list (ActiveAndValid).
Definition: winpfn.h:77
struct _WIN_PFN_LOCK * PWIN_PFN_LOCK
_Bool BOOLEAN
Definition: intro_types.h:58
WORD RefCount
The reference count.
Definition: winpfn.h:42
#define _In_
Definition: intro_sal.h:21
uint16_t WORD
Definition: intro_types.h:48
void IntWinPfnUnInit(void)
Uninits the PFN locks.
Definition: winpfn.c:922
A page from the BadPageList.
Definition: winpfn.h:76
BOOLEAN Present
True if Page is present.
Definition: winpfn.h:46
INTSTATUS IntWinPfnRemoveLock(WIN_PFN_LOCK *PfnLock, BOOLEAN Force)
Removes a PFN lock.
Definition: winpfn.c:838
int INTSTATUS
The status data type.
Definition: introstatus.h:24
A page from the ZeroedPageList.
Definition: winpfn.h:71
BOOLEAN LargePage
True if Page is a large page.
Definition: winpfn.h:51
A page from the ModifiedNoWritePageList.
Definition: winpfn.h:75
struct _WIN_PFN_LOCK WIN_PFN_LOCK
A PFN lock.
void * SwapHook
The swap hook used for Page, is Page is a virtual address.
Definition: winpfn.h:36
#define _Inout_
Definition: intro_sal.h:20
A page from the FreePageList.
Definition: winpfn.h:72
#define _Out_opt_
Definition: intro_sal.h:30
unsigned long long QWORD
Definition: intro_types.h:53
INTSTATUS IntWinPfnIsMmPfnDatabase(QWORD MmPfnDatabase)
Checks if a a guest virtual address points to MmPfnDatabase.
Definition: winpfn.c:24
A PFN lock.
Definition: winpfn.h:19
WIN_PFN_PAGE_LOCATION
Page location value, as defined by the _MMLISTS kernel enum.
Definition: winpfn.h:69
LIST_ENTRY Link
Entry inside the gWinPfns list.
Definition: winpfn.h:22
INTSTATUS IntWinPfnLockGva(QWORD Gva, WIN_PFN_LOCK **PfnLock)
Locks a guest virtual address.
Definition: winpfn.c:799
void IntWinPfnDump(void)
Prints all the PFN locks.
Definition: winpfn.c:901
A page from the StandbyPageList.
Definition: winpfn.h:73
QWORD GpaPage
The guest physical page that is locked.
Definition: winpfn.h:31
INTSTATUS IntWinPfnLockGpa(QWORD Gpa, WIN_PFN_LOCK **PfnLock)
Locks a guest physical address.
Definition: winpfn.c:820
QWORD Page
The locked page.
Definition: winpfn.h:26
A page from the ModifiedPageList.
Definition: winpfn.h:74
A temporary state, while waiting for I/O (TransitionPage).
Definition: winpfn.h:78