Changeset 44385 in vbox for trunk/include/VBox
- Timestamp:
- Jan 25, 2013 6:00:16 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/csam.h
r44373 r44385 4 4 5 5 /* 6 * Copyright (C) 2006-201 0Oracle Corporation6 * Copyright (C) 2006-2013 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 35 35 36 36 /** 37 * CSAM monitoring tag 37 * CSAM monitoring tag. 38 38 * For use with CSAMR3MonitorPage 39 39 */ … … 52 52 53 53 /** 54 * Check if this page needs to be analysed by CSAM.55 *56 * This function should only be called for supervisor pages and57 * only when CSAM is enabled. Leaving these selection criteria58 * to the caller simplifies the interface (PTE passing).59 *60 * Note the the page has not yet been synced, so the TLB trick61 * (which wasn't ever active anyway) cannot be applied.62 *63 * @returns true if the page should be marked not present because64 * CSAM want need to scan it.65 * @returns false if the page was already scanned.66 * @param pVM The VM to operate on.67 * @param GCPtr GC pointer of page table entry68 */69 VMMDECL(bool) CSAMDoesPageNeedScanning(PVM pVM, RTRCUINTPTR GCPtr);70 71 /**72 * Check if this page was previously scanned by CSAM73 *74 * @returns true -> scanned, false -> not scanned75 * @param pVM The VM to operate on.76 * @param pPage GC page address77 */78 VMMDECL(bool) CSAMIsPageScanned(PVM pVM, RTRCPTR pPage);79 80 /**81 * Mark a page as scanned/not scanned82 *83 * @note: we always mark it as scanned, even if we haven't completely done so84 *85 * @returns VBox status code.86 * @param pVM The VM to operate on.87 * @param pPage GC page address (not necessarily aligned)88 * @param fScanned Mark as scanned or not scanned89 *90 */91 VMMDECL(int) CSAMMarkPage(PVM pVM, RTRCUINTPTR pPage, bool fScanned);92 93 94 /**95 * Remember a possible code page for later inspection96 *97 * @returns VBox status code.98 * @param pVM The VM to operate on.99 * @param GCPtr GC pointer of page100 */101 VMMDECL(void) CSAMMarkPossibleCodePage(PVM pVM, RTRCPTR GCPtr);102 103 /**104 54 * Query CSAM state (enabled/disabled) 105 55 * 106 * @returns 0 - disabled, 1 - enabled 107 * @param pVM The VM to operate on. 56 * @returns true / false. 57 * @param a_pVM The shared VM handle. 58 * @internal 108 59 */ 109 #define CSAMIsEnabled( pVM) (pVM->fCSAMEnabled && EMIsRawRing0Enabled(pVM))60 #define CSAMIsEnabled(a_pVM) ((a_pVM)->fCSAMEnabled && EMIsRawRing0Enabled(a_pVM)) 110 61 111 /** 112 * Turn on code scanning 113 * 114 * @returns VBox status code. (trap handled or not) 115 * @param pVM The VM to operate on. 116 */ 117 VMMDECL(int) CSAMEnableScanning(PVM pVM); 118 119 /** 120 * Turn off code scanning 121 * 122 * @returns VBox status code. (trap handled or not) 123 * @param pVM The VM to operate on. 124 */ 125 VMMDECL(int) CSAMDisableScanning(PVM pVM); 126 127 128 /** 129 * Check if this page needs to be analysed by CSAM 130 * 131 * @returns 0 - disabled, 1 - enabled 132 * @param pVM The VM to operate on. 133 * @param pvFault Fault address 134 */ 135 VMMDECL(int) CSAMExecFault(PVM pVM, RTRCPTR pvFault); 136 137 /** 138 * Check if we've scanned this instruction before. If true, then we can emulate 139 * it instead of returning to ring 3. 140 * 141 * @returns boolean 142 * @param pVM The VM to operate on. 143 * @param GCPtr GC pointer of page table entry 144 */ 145 VMMDECL(bool) CSAMIsKnownDangerousInstr(PVM pVM, RTRCUINTPTR GCPtr); 62 VMM_INT_DECL(bool) CSAMDoesPageNeedScanning(PVM pVM, RTRCUINTPTR GCPtr); 63 VMM_INT_DECL(bool) CSAMIsPageScanned(PVM pVM, RTRCPTR pPage); 64 VMM_INT_DECL(int) CSAMMarkPage(PVM pVM, RTRCUINTPTR pPage, bool fScanned); 65 VMM_INT_DECL(void) CSAMMarkPossibleCodePage(PVM pVM, RTRCPTR GCPtr); 66 VMM_INT_DECL(int) CSAMEnableScanning(PVM pVM); 67 VMM_INT_DECL(int) CSAMDisableScanning(PVM pVM); 68 VMM_INT_DECL(int) CSAMExecFault(PVM pVM, RTRCPTR pvFault); 69 VMM_INT_DECL(bool) CSAMIsKnownDangerousInstr(PVM pVM, RTRCUINTPTR GCPtr); 146 70 147 71 … … 152 76 */ 153 77 154 VMMR3DECL(bool) CSAMR3IsEnabled(PUVM pUVM); 78 VMMR3DECL(bool) CSAMR3IsEnabled(PUVM pUVM); 79 VMMR3DECL(int) CSAMR3SetScanningEnabled(PUVM pUVM, bool fEnabled); 155 80 156 /** 157 * Initializes the csam. 158 * 159 * @returns VBox status code. 160 * @param pVM The VM to operate on. 161 */ 162 VMMR3DECL(int) CSAMR3Init(PVM pVM); 81 VMMR3_INT_DECL(int) CSAMR3Init(PVM pVM); 82 VMMR3_INT_DECL(void) CSAMR3Relocate(PVM pVM, RTGCINTPTR offDelta); 83 VMMR3_INT_DECL(int) CSAMR3Term(PVM pVM); 84 VMMR3_INT_DECL(int) CSAMR3Reset(PVM pVM); 163 85 164 /** 165 * Applies relocations to data and code managed by this 166 * component. This function will be called at init and 167 * whenever the VMM need to relocate it self inside the GC. 168 * 169 * The csam will update the addresses used by the switcher. 170 * 171 * @param pVM The VM. 172 * @param offDelta Relocation delta. 173 */ 174 VMMR3DECL(void) CSAMR3Relocate(PVM pVM, RTGCINTPTR offDelta); 86 VMMR3_INT_DECL(int) CSAMR3FlushPage(PVM pVM, RTRCPTR addr); 87 VMMR3_INT_DECL(int) CSAMR3RemovePage(PVM pVM, RTRCPTR addr); 88 VMMR3_INT_DECL(int) CSAMR3CheckCode(PVM pVM, RTRCPTR pInstrGC); 89 VMMR3_INT_DECL(int) CSAMR3CheckCodeEx(PVM pVM, PCPUMCTXCORE pCtxCore, RTRCPTR pInstrGC); 90 VMMR3_INT_DECL(int) CSAMR3MarkCode(PVM pVM, RTRCPTR pInstr, uint32_t cbInstr, bool fScanned); 91 VMMR3_INT_DECL(int) CSAMR3DoPendingAction(PVM pVM, PVMCPU pVCpu); 92 VMMR3_INT_DECL(int) CSAMR3CheckGates(PVM pVM, uint32_t iGate, uint32_t cGates); 175 93 176 /** 177 * Terminates the csam. 178 * 179 * Termination means cleaning up and freeing all resources, 180 * the VM it self is at this point powered off or suspended. 181 * 182 * @returns VBox status code. 183 * @param pVM The VM to operate on. 184 */ 185 VMMR3DECL(int) CSAMR3Term(PVM pVM); 186 187 /** 188 * CSAM reset callback. 189 * 190 * @returns VBox status code. 191 * @param pVM The VM which is reset. 192 */ 193 VMMR3DECL(int) CSAMR3Reset(PVM pVM); 194 195 196 /** 197 * Notify CSAM of a page flush 198 * 199 * @returns VBox status code 200 * @param pVM The VM to operate on. 201 * @param addr GC address of the page to flush 202 */ 203 VMMR3DECL(int) CSAMR3FlushPage(PVM pVM, RTRCPTR addr); 204 205 /** 206 * Remove a CSAM monitored page. Use with care! 207 * 208 * @returns VBox status code 209 * @param pVM The VM to operate on. 210 * @param addr GC address of the page to flush 211 */ 212 VMMR3DECL(int) CSAMR3RemovePage(PVM pVM, RTRCPTR addr); 213 214 /** 215 * Scan and analyse code 216 * 217 * @returns VBox status code. 218 * @param pVM The VM to operate on. 219 * @param pCtxCore CPU context 220 * @param pInstrGC Instruction pointer 221 */ 222 VMMR3DECL(int) CSAMR3CheckCodeEx(PVM pVM, PCPUMCTXCORE pCtxCore, RTRCPTR pInstrGC); 223 224 /** 225 * Scan and analyse code 226 * 227 * @returns VBox status code. 228 * @param pVM The VM to operate on. 229 * @param pInstrGC Instruction pointer (0:32 virtual address) 230 */ 231 VMMR3DECL(int) CSAMR3CheckCode(PVM pVM, RTRCPTR pInstrGC); 232 233 /** 234 * Mark an instruction in a page as scanned/not scanned 235 * 236 * @returns VBox status code. 237 * @param pVM The VM to operate on. 238 * @param pInstr Instruction pointer 239 * @param cbInstr Instruction size 240 * @param fScanned Mark as scanned or not 241 */ 242 VMMR3DECL(int) CSAMR3MarkCode(PVM pVM, RTRCPTR pInstr, uint32_t cbInstr, bool fScanned); 243 244 /** 245 * Perform any pending actions 246 * 247 * @returns VBox status code. 248 * @param pVM The VM to operate on. 249 * @param pVCpu The VMCPU to operate on. 250 */ 251 VMMR3DECL(int) CSAMR3DoPendingAction(PVM pVM, PVMCPU pVCpu); 252 253 /** 254 * Monitors a code page (if not already monitored) 255 * 256 * @returns VBox status code 257 * @param pVM The VM to operate on. 258 * @param pPageAddrGC The page to monitor 259 * @param enmTag Monitor tag 260 */ 261 VMMR3DECL(int) CSAMR3MonitorPage(PVM pVM, RTRCPTR pPageAddrGC, CSAMTAG enmTag); 262 263 /** 264 * Unmonitors a code page 265 * 266 * @returns VBox status code 267 * @param pVM The VM to operate on. 268 * @param pPageAddrGC The page to monitor 269 * @param enmTag Monitor tag 270 */ 271 VMMR3DECL(int) CSAMR3UnmonitorPage(PVM pVM, RTRCPTR pPageAddrGC, CSAMTAG enmTag); 272 273 /** 274 * Analyse interrupt and trap gates 275 * 276 * @returns VBox status code. 277 * @param pVM The VM to operate on. 278 * @param iGate Start gate 279 * @param cGates Number of gates to check 280 */ 281 VMMR3DECL(int) CSAMR3CheckGates(PVM pVM, uint32_t iGate, uint32_t cGates); 282 283 /** 284 * Record previous call instruction addresses 285 * 286 * @returns VBox status code. 287 * @param pVM The VM to operate on. 288 * @param GCPtrCall Call address 289 */ 290 VMMR3DECL(int) CSAMR3RecordCallAddress(PVM pVM, RTRCPTR GCPtrCall); 94 VMMR3DECL(int) CSAMR3MonitorPage(PVM pVM, RTRCPTR pPageAddrGC, CSAMTAG enmTag); 95 VMMR3DECL(int) CSAMR3UnmonitorPage(PVM pVM, RTRCPTR pPageAddrGC, CSAMTAG enmTag); 96 VMMR3DECL(int) CSAMR3RecordCallAddress(PVM pVM, RTRCPTR GCPtrCall); 291 97 292 98 /** @} */ … … 298 104 299 105 #endif 106
Note:
See TracChangeset
for help on using the changeset viewer.