vbox的更動 13635 路徑 trunk/include
- 時間撮記:
- 2008-10-28 下午08:27:33 (16 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/include/VBox/trpm.h
r12989 r13635 74 74 #define TRPM_INVALID_HANDLER 0 75 75 76 /** 77 * Query info about the current active trap/interrupt. 78 * If no trap is active active an error code is returned. 79 * 80 * @returns VBox status code. 81 * @param pVM The virtual machine. 82 * @param pu8TrapNo Where to store the trap number. 83 * @param pEnmType Where to store the trap type. 84 */ 85 VMMDECL(int) TRPMQueryTrap(PVM pVM, uint8_t *pu8TrapNo, PTRPMEVENT pEnmType); 86 87 /** 88 * Gets the trap number for the current trap. 89 * 90 * The caller is responsible for making sure there is an active trap which 91 * takes an error code when making this request. 92 * 93 * @returns The current trap number. 94 * @param pVM VM handle. 95 */ 96 VMMDECL(uint8_t) TRPMGetTrapNo(PVM pVM); 97 98 /** 99 * Gets the error code for the current trap. 100 * 101 * The caller is responsible for making sure there is an active trap which 102 * takes an error code when making this request. 103 * 104 * @returns Error code. 105 * @param pVM VM handle. 106 */ 107 VMMDECL(RTGCUINT) TRPMGetErrorCode(PVM pVM); 108 109 /** 110 * Gets the fault address for the current trap. 111 * 112 * The caller is responsible for making sure there is an active trap 0x0e when 113 * making this request. 114 * 115 * @returns Fault address associated with the trap. 116 * @param pVM VM handle. 117 */ 76 VMMDECL(int) TRPMQueryTrap(PVM pVM, uint8_t *pu8TrapNo, PTRPMEVENT pEnmType); 77 VMMDECL(uint8_t) TRPMGetTrapNo(PVM pVM); 78 VMMDECL(RTGCUINT) TRPMGetErrorCode(PVM pVM); 118 79 VMMDECL(RTGCUINTPTR) TRPMGetFaultAddress(PVM pVM); 119 120 /** 121 * Clears the current active trap/exception/interrupt. 122 * 123 * The caller is responsible for making sure there is an active trap 124 * when making this request. 125 * 126 * @returns VBox status code. 127 * @param pVM The virtual machine handle. 128 */ 129 VMMDECL(int) TRPMResetTrap(PVM pVM); 130 131 /** 132 * Assert trap/exception/interrupt. 133 * 134 * The caller is responsible for making sure there is no active trap 135 * when making this request. 136 * 137 * @returns VBox status code. 138 * @param pVM The virtual machine. 139 * @param u8TrapNo The trap vector to assert. 140 * @param enmType Trap type. 141 */ 142 VMMDECL(int) TRPMAssertTrap(PVM pVM, uint8_t u8TrapNo, TRPMEVENT enmType); 143 144 /** 145 * Sets the error code of the current trap. 146 * (This function is for use in trap handlers and such.) 147 * 148 * The caller is responsible for making sure there is an active trap 149 * which takes an errorcode when making this request. 150 * 151 * @param pVM The virtual machine. 152 * @param uErrorCode The new error code. 153 */ 154 VMMDECL(void) TRPMSetErrorCode(PVM pVM, RTGCUINT uErrorCode); 155 156 /** 157 * Sets the error code of the current trap. 158 * (This function is for use in trap handlers and such.) 159 * 160 * The caller is responsible for making sure there is an active trap 0e 161 * when making this request. 162 * 163 * @param pVM The virtual machine. 164 * @param uCR2 The new fault address (cr2 register). 165 */ 166 VMMDECL(void) TRPMSetFaultAddress(PVM pVM, RTGCUINTPTR uCR2); 167 168 /** 169 * Checks if the current active trap/interrupt/exception/fault/whatever is a software 170 * interrupt or not. 171 * 172 * The caller is responsible for making sure there is an active trap 173 * when making this request. 174 * 175 * @returns true if software interrupt, false if not. 176 * 177 * @param pVM VM handle. 178 */ 179 VMMDECL(bool) TRPMIsSoftwareInterrupt(PVM pVM); 180 181 /** 182 * Check if there is an active trap. 183 * 184 * @returns true if trap active, false if not. 185 * @param pVM The virtual machine. 186 */ 187 VMMDECL(bool) TRPMHasTrap(PVM pVM); 188 189 /** 190 * Query all info about the current active trap/interrupt. 191 * If no trap is active active an error code is returned. 192 * 193 * @returns VBox status code. 194 * @param pVM The virtual machine. 195 * @param pu8TrapNo Where to store the trap number. 196 * @param pEnmType Where to store the trap type. 197 * @param puErrorCode Where to store the error code associated with some traps. 198 * ~0U is stored if the trap have no error code. 199 * @param puCR2 Where to store the CR2 associated with a trap 0E. 200 */ 201 VMMDECL(int) TRPMQueryTrapAll(PVM pVM, uint8_t *pu8TrapNo, PTRPMEVENT pEnmType, PRTGCUINT puErrorCode, PRTGCUINTPTR puCR2); 202 203 204 /** 205 * Save the active trap. 206 * 207 * This routine useful when doing try/catch in the hypervisor. 208 * Any function which uses temporary trap handlers should 209 * probably also use this facility to save the original trap. 210 * 211 * @param pVM VM handle. 212 */ 213 VMMDECL(void) TRPMSaveTrap(PVM pVM); 214 215 /** 216 * Restore a saved trap. 217 * 218 * Multiple restores of a saved trap is possible. 219 * 220 * @param pVM VM handle. 221 */ 222 VMMDECL(void) TRPMRestoreTrap(PVM pVM); 223 224 /** 225 * Forward trap or interrupt to the guest's handler 226 * 227 * 228 * @returns VBox status code. 229 * or does not return at all (when the trap is actually forwarded) 230 * 231 * @param pVM The VM to operate on. 232 * @param pRegFrame Pointer to the register frame for the trap. 233 * @param iGate Trap or interrupt gate number 234 * @param opsize Instruction size (only relevant for software interrupts) 235 * @param enmError TRPM_TRAP_HAS_ERRORCODE or TRPM_TRAP_NO_ERRORCODE. 236 * @param enmType TRPM event type 237 * @param iOrgTrap Original trap. 238 * @internal 239 */ 240 VMMDECL(int) TRPMForwardTrap(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t iGate, uint32_t opsize, TRPMERRORCODE enmError, TRPMEVENT enmType, int32_t iOrgTrap); 241 242 /** 243 * Raises a cpu exception which doesn't take an error code. 244 * 245 * This function may or may not dispatch the exception before returning. 246 * 247 * @returns VBox status code fit for scheduling. 248 * @retval VINF_EM_RAW_GUEST_TRAP if the exception was left pending. 249 * @retval VINF_TRPM_XCPT_DISPATCHED if the exception was raised and dispatched for raw-mode execution. 250 * @retval VINF_EM_RESCHEDULE_REM if the exception was dispatched and cannot be executed in raw-mode. 251 * 252 * @param pVM The VM handle. 253 * @param pCtxCore The CPU context core. 254 * @param enmXcpt The exception. 255 */ 256 VMMDECL(int) TRPMRaiseXcpt(PVM pVM, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt); 257 258 /** 259 * Raises a cpu exception with an errorcode. 260 * 261 * This function may or may not dispatch the exception before returning. 262 * 263 * @returns VBox status code fit for scheduling. 264 * @retval VINF_EM_RAW_GUEST_TRAP if the exception was left pending. 265 * @retval VINF_TRPM_XCPT_DISPATCHED if the exception was raised and dispatched for raw-mode execution. 266 * @retval VINF_EM_RESCHEDULE_REM if the exception was dispatched and cannot be executed in raw-mode. 267 * 268 * @param pVM The VM handle. 269 * @param pCtxCore The CPU context core. 270 * @param enmXcpt The exception. 271 * @param uErr The error code. 272 */ 273 VMMDECL(int) TRPMRaiseXcptErr(PVM pVM, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt, uint32_t uErr); 274 275 /** 276 * Raises a cpu exception with an errorcode and CR2. 277 * 278 * This function may or may not dispatch the exception before returning. 279 * 280 * @returns VBox status code fit for scheduling. 281 * @retval VINF_EM_RAW_GUEST_TRAP if the exception was left pending. 282 * @retval VINF_TRPM_XCPT_DISPATCHED if the exception was raised and dispatched for raw-mode execution. 283 * @retval VINF_EM_RESCHEDULE_REM if the exception was dispatched and cannot be executed in raw-mode. 284 * 285 * @param pVM The VM handle. 286 * @param pCtxCore The CPU context core. 287 * @param enmXcpt The exception. 288 * @param uErr The error code. 289 * @param uCR2 The CR2 value. 290 */ 291 VMMDECL(int) TRPMRaiseXcptErrCR2(PVM pVM, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt, uint32_t uErr, RTGCUINTPTR uCR2); 80 VMMDECL(int) TRPMResetTrap(PVM pVM); 81 VMMDECL(int) TRPMAssertTrap(PVM pVM, uint8_t u8TrapNo, TRPMEVENT enmType); 82 VMMDECL(void) TRPMSetErrorCode(PVM pVM, RTGCUINT uErrorCode); 83 VMMDECL(void) TRPMSetFaultAddress(PVM pVM, RTGCUINTPTR uCR2); 84 VMMDECL(bool) TRPMIsSoftwareInterrupt(PVM pVM); 85 VMMDECL(bool) TRPMHasTrap(PVM pVM); 86 VMMDECL(int) TRPMQueryTrapAll(PVM pVM, uint8_t *pu8TrapNo, PTRPMEVENT pEnmType, PRTGCUINT puErrorCode, PRTGCUINTPTR puCR2); 87 VMMDECL(void) TRPMSaveTrap(PVM pVM); 88 VMMDECL(void) TRPMRestoreTrap(PVM pVM); 89 VMMDECL(int) TRPMForwardTrap(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t iGate, uint32_t opsize, TRPMERRORCODE enmError, TRPMEVENT enmType, int32_t iOrgTrap); 90 VMMDECL(int) TRPMRaiseXcpt(PVM pVM, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt); 91 VMMDECL(int) TRPMRaiseXcptErr(PVM pVM, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt, uint32_t uErr); 92 VMMDECL(int) TRPMRaiseXcptErrCR2(PVM pVM, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt, uint32_t uErr, RTGCUINTPTR uCR2); 292 93 293 94 … … 297 98 * @{ 298 99 */ 299 300 /** 301 * Initializes the SELM. 302 * 303 * @returns VBox status code. 304 * @param pVM The VM to operate on. 305 */ 306 VMMR3DECL(int) TRPMR3Init(PVM pVM); 307 308 /** 309 * Applies relocations to data and code managed by this component. 310 * 311 * This function will be called at init and whenever the VMM need 312 * to relocate itself inside the GC. 313 * 314 * @param pVM The VM handle. 315 * @param offDelta Relocation delta relative to old location. 316 */ 317 VMMR3DECL(void) TRPMR3Relocate(PVM pVM, RTGCINTPTR offDelta); 318 319 /** 320 * The VM is being reset. 321 * 322 * For the TRPM component this means that any IDT write monitors 323 * needs to be removed, any pending trap cleared, and the IDT reset. 324 * 325 * @param pVM VM handle. 326 */ 327 VMMR3DECL(void) TRPMR3Reset(PVM pVM); 328 329 /** 330 * Set interrupt gate handler 331 * Used for setting up interrupt gates used for kernel calls. 332 * 333 * @returns VBox status code. 334 * @param pVM The VM to operate on. 335 * @param iTrap Interrupt number. 336 */ 337 VMMR3DECL(int) TRPMR3EnableGuestTrapHandler(PVM pVM, unsigned iTrap); 338 339 /** 340 * Set guest trap/interrupt gate handler 341 * Used for setting up trap gates used for kernel calls. 342 * 343 * @returns VBox status code. 344 * @param pVM The VM to operate on. 345 * @param iTrap Interrupt/trap number. 346 * @parapm pHandler GC handler pointer 347 */ 348 VMMR3DECL(int) TRPMR3SetGuestTrapHandler(PVM pVM, unsigned iTrap, RTRCPTR pHandler); 349 350 /** 351 * Get guest trap/interrupt gate handler 352 * 353 * @returns Guest trap handler address or TRPM_INVALID_HANDLER if none installed 354 * @param pVM The VM to operate on. 355 * @param iTrap Interrupt/trap number. 356 */ 357 VMMR3DECL(RTRCPTR) TRPMR3GetGuestTrapHandler(PVM pVM, unsigned iTrap); 358 359 /** 360 * Disable IDT monitoring and syncing 361 * 362 * @param pVM The VM to operate on. 363 */ 364 VMMR3DECL(void) TRPMR3DisableMonitoring(PVM pVM); 365 366 /** 367 * Check if gate handlers were updated 368 * 369 * @returns VBox status code. 370 * @param pVM The VM to operate on. 371 */ 372 VMMR3DECL(int) TRPMR3SyncIDT(PVM pVM); 373 374 /** 375 * Check if address is a gate handler (interrupt/trap/task/anything). 376 * 377 * @returns True is gate handler, false if not. 378 * 379 * @param pVM VM handle. 380 * @param GCPtr GC address to check. 381 */ 382 VMMR3DECL(bool) TRPMR3IsGateHandler(PVM pVM, RTRCPTR GCPtr); 383 384 /** 385 * Check if address is a gate handler (interrupt or trap). 386 * 387 * @returns gate nr or ~0 is not found 388 * 389 * @param pVM VM handle. 390 * @param GCPtr GC address to check. 391 */ 100 VMMR3DECL(int) TRPMR3Init(PVM pVM); 101 VMMR3DECL(void) TRPMR3Relocate(PVM pVM, RTGCINTPTR offDelta); 102 VMMR3DECL(void) TRPMR3Reset(PVM pVM); 103 VMMR3DECL(int) TRPMR3Term(PVM pVM); 104 VMMR3DECL(int) TRPMR3EnableGuestTrapHandler(PVM pVM, unsigned iTrap); 105 VMMR3DECL(int) TRPMR3SetGuestTrapHandler(PVM pVM, unsigned iTrap, RTRCPTR pHandler); 106 VMMR3DECL(RTRCPTR) TRPMR3GetGuestTrapHandler(PVM pVM, unsigned iTrap); 107 VMMR3DECL(void) TRPMR3DisableMonitoring(PVM pVM); 108 VMMR3DECL(int) TRPMR3SyncIDT(PVM pVM); 109 VMMR3DECL(bool) TRPMR3IsGateHandler(PVM pVM, RTRCPTR GCPtr); 392 110 VMMR3DECL(uint32_t) TRPMR3QueryGateByHandler(PVM pVM, RTRCPTR GCPtr); 393 394 /** 395 * Initializes the SELM. 396 * 397 * @returns VBox status code. 398 * @param pVM The VM to operate on. 399 */ 400 VMMR3DECL(int) TRPMR3Term(PVM pVM); 401 402 403 /** 404 * Inject event (such as external irq or trap) 405 * 406 * @returns VBox status code. 407 * @param pVM The VM to operate on. 408 * @param enmEvent Trpm event type 409 */ 410 VMMR3DECL(int) TRPMR3InjectEvent(PVM pVM, TRPMEVENT enmEvent); 411 111 VMMR3DECL(int) TRPMR3InjectEvent(PVM pVM, TRPMEVENT enmEvent); 412 112 /** @} */ 413 113 #endif … … 432 132 typedef FNTRPMGCTRAPHANDLER *PFNTRPMGCTRAPHANDLER; 433 133 434 /** 435 * Arms a temporary trap handler for traps in Hypervisor code. 436 * 437 * The operation is similar to a System V signal handler. I.e. when the handler 438 * is called it is first set to default action. So, if you need to handler more 439 * than one trap, you must reinstall the handler. 440 * 441 * To uninstall the temporary handler, call this function with pfnHandler set to NULL. 442 * 443 * @returns VBox status. 444 * @param pVM VM handle. 445 * @param iTrap Trap number to install handler [0..255]. 446 * @param pfnHandler Pointer to the handler. Use NULL for uninstalling the handler. 447 */ 448 VMMRCDECL(int) TRPMGCSetTempHandler(PVM pVM, unsigned iTrap, PFNTRPMGCTRAPHANDLER pfnHandler); 449 450 /** 451 * Return to host context from a hypervisor trap handler. 452 * It will also reset any traps that are pending. 453 * 454 * This function will *never* return. 455 * 456 * @param pVM The VM handle. 457 * @param rc The return code for host context. 458 */ 459 VMMRCDECL(void) TRPMGCHyperReturnToHost(PVM pVM, int rc); 460 134 VMMRCDECL(int) TRPMGCSetTempHandler(PVM pVM, unsigned iTrap, PFNTRPMGCTRAPHANDLER pfnHandler); 135 VMMRCDECL(void) TRPMGCHyperReturnToHost(PVM pVM, int rc); 461 136 /** @} */ 462 137 #endif … … 468 143 * @{ 469 144 */ 470 471 /** 472 * Dispatches an interrupt that arrived while we were in the guest context. 473 * 474 * @param pVM The VM handle. 475 * @remark Must be called with interrupts disabled. 476 */ 477 VMMR0DECL(void) TRPMR0DispatchHostInterrupt(PVM pVM); 478 479 /** 480 * Changes the VMMR0Entry() call frame and stack used by the IDT patch code 481 * so that we'll dispatch an interrupt rather than returning directly to Ring-3 482 * when VMMR0Entry() returns. 483 * 484 * @param pVM Pointer to the VM. 485 * @param pvRet Pointer to the return address of VMMR0Entry() on the stack. 486 */ 487 VMMR0DECL(void) TRPMR0SetupInterruptDispatcherFrame(PVM pVM, void *pvRet); 488 145 VMMR0DECL(void) TRPMR0DispatchHostInterrupt(PVM pVM); 146 VMMR0DECL(void) TRPMR0SetupInterruptDispatcherFrame(PVM pVM, void *pvRet); 489 147 /** @} */ 490 148 #endif
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器