Changeset 988 in vbox
- Timestamp:
- Feb 19, 2007 6:19:14 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 18802
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/Makefile
r960 r988 237 237 VMMAll/TRPMAll.cpp \ 238 238 VMMAll/VMAll.cpp \ 239 VMMAll/VMMAll.cpp \ 239 240 PATM/VMMGC/CSAMGC.cpp \ 240 241 PATM/VMMAll/CSAMAll.cpp \ -
trunk/src/VBox/VMM/VMM.cpp
r914 r988 2595 2595 fDump = true; 2596 2596 } 2597 else if ( u8Trap != 8 /* double fault doesn't dare setting TrapNo. */ 2597 else if ( rcExpect != VINF_SUCCESS 2598 && u8Trap != 8 /* double fault doesn't dare set TrapNo. */ 2598 2599 && u8Trap != 3 /* guest only, we're not in guest. */ 2599 2600 && u8Trap != 1 /* guest only, we're not in guest. */ … … 2615 2616 } 2616 2617 } 2617 else 2618 else if (rcExpect != VINF_SUCCESS) 2618 2619 { 2619 2620 if (CPUMGetHyperSS(pVM) == SELMGetHyperDS(pVM)) … … 2693 2694 vmmR3DoTrapTest(pVM, 0xe, 0, VERR_TRPM_DONT_PANIC, 0x00000000, "vmmGCTestTrap0e_FaultEIP", "#PF (NULL)"); 2694 2695 vmmR3DoTrapTest(pVM, 0xe, 1, VERR_TRPM_DONT_PANIC, 0x00000000, "vmmGCTestTrap0e_FaultEIP", "#PF (NULL) WP"); 2696 vmmR3DoTrapTest(pVM, 0xe, 2, VINF_SUCCESS, 0x00000000, NULL, "#PF w/Tmp Handler"); 2697 vmmR3DoTrapTest(pVM, 0xe, 4, VINF_SUCCESS, 0x00000000, NULL, "#PF w/Tmp Handler and bad fs"); 2695 2698 2696 2699 /* -
trunk/src/VBox/VMM/VMMGC/TRPMGCHandlers.cpp
r716 r988 37 37 #include "TRPMInternal.h" 38 38 #include <VBox/vm.h> 39 #include <VBox/param.h> 39 40 40 41 #include <VBox/err.h> … … 978 979 { 979 980 /* 980 * Just zero the register in question.981 * We're ASSUMING that esp points to it.981 * Check that there is still some stack left, if not we'll flag 982 * a guru meditation (the alternative is a triple fault). 982 983 */ 984 RTGCUINTPTR cbStackUsed = (RTGCUINTPTR)VMMGetStackGC(pVM) - pRegFrame->esp; 985 if (cbStackUsed > VMM_STACK_SIZE - _1K) 986 { 987 LogRel(("trpmGCTrapInGeneric: ran out of stack: esp=#x cbStackUsed=%#x\n", pRegFrame->esp, cbStackUsed)); 988 return VERR_TRPM_DONT_PANIC; 989 } 990 991 /* 992 * Just zero the register containing the selector in question. 993 * We'll deal with the actual stale or troublesome selector value in 994 * the outermost trap frame. 995 */ 996 PCPUMCTXCORE pCoreCtx = (PCPUMCTXCORE)pRegFrame->esp; 983 997 switch (uUser & TRPM_TRAP_IN_OP_MASK) 984 998 { 985 999 case TRPM_TRAP_IN_MOV_GS: 1000 pRegFrame->eax = 0; 1001 pRegFrame->gs = 0; /* prevent recursive trouble. */ 1002 break; 986 1003 case TRPM_TRAP_IN_MOV_FS: 987 *(PRTSEL)pRegFrame->esp = 0; 1004 pRegFrame->eax = 0; 1005 pRegFrame->fs = 0; /* prevent recursive trouble. */ 988 1006 return VINF_SUCCESS; 989 1007 … … 1014 1032 case TRPM_TRAP_IN_MOV_DS: 1015 1033 { 1016 PCPUMCTXCORE pTempGuestCtx = (PCPUMCTXCORE) 1034 PCPUMCTXCORE pTempGuestCtx = (PCPUMCTXCORE)pEsp; 1017 1035 1018 1036 /* Just copy the whole thing; several selector registers, eip (etc) and eax are not yet in pRegFrame. */ -
trunk/src/VBox/VMM/VMMGC/VMMGC.cpp
r847 r988 26 26 #define LOG_GROUP LOG_GROUP_VMM 27 27 #include <VBox/vmm.h> 28 #include <VBox/trpm.h> 28 29 #include "VMMInternal.h" 29 30 #include <VBox/vm.h> … … 47 48 *******************************************************************************/ 48 49 static int vmmGCTest(PVM pVM, unsigned uOperation, unsigned uArg); 50 static DECLCALLBACK(int) vmmGCTestTmpPFHandler(PVM pVM, PCPUMCTXCORE pRegFrame); 51 static DECLCALLBACK(int) vmmGCTestTmpPFHandlerCorruptFS(PVM pVM, PCPUMCTXCORE pRegFrame); 49 52 50 53 … … 264 267 if (uArg <= 1) 265 268 rc = vmmGCTestTrap0e(); 269 else if (uArg == 2 || uArg == 4) 270 { 271 /* 272 * Test the use of a temporary #PF handler. 273 */ 274 rc = TRPMGCSetTempHandler(pVM, X86_XCPT_PF, uArg != 4 ? vmmGCTestTmpPFHandler : vmmGCTestTmpPFHandlerCorruptFS); 275 if (VBOX_SUCCESS(rc)) 276 { 277 rc = vmmGCTestTrap0e(); 278 279 /* in case it didn't fire. */ 280 int rc2 = TRPMGCSetTempHandler(pVM, X86_XCPT_PF, NULL); 281 if (VBOX_FAILURE(rc2) && VBOX_SUCCESS(rc)) 282 rc = rc2; 283 } 284 } 266 285 break; 267 286 } … … 277 296 } 278 297 298 299 /** 300 * Temporary #PF trap handler for the #PF test case. 301 * 302 * @returns VBox status code (appropriate for GC return). 303 * In this context VBOX_SUCCESS means to restart the instruction. 304 * @param pVM VM handle. 305 * @param pRegFrame Trap register frame. 306 */ 307 static DECLCALLBACK(int) vmmGCTestTmpPFHandler(PVM pVM, PCPUMCTXCORE pRegFrame) 308 { 309 if (pRegFrame->eip == (uintptr_t)vmmGCTestTrap0e_FaultEIP) 310 { 311 pRegFrame->eip = (uintptr_t)vmmGCTestTrap0e_ResumeEIP; 312 return VINF_SUCCESS; 313 } 314 return VERR_INTERNAL_ERROR; 315 } 316 317 318 /** 319 * Temporary #PF trap handler for the #PF test case, this one messes up the fs selector. 320 * 321 * @returns VBox status code (appropriate for GC return). 322 * In this context VBOX_SUCCESS means to restart the instruction. 323 * @param pVM VM handle. 324 * @param pRegFrame Trap register frame. 325 */ 326 static DECLCALLBACK(int) vmmGCTestTmpPFHandlerCorruptFS(PVM pVM, PCPUMCTXCORE pRegFrame) 327 { 328 int rc = vmmGCTestTmpPFHandler(pVM, pRegFrame); 329 pRegFrame->fs = 0x30; 330 return rc; 331 } 332 -
trunk/src/VBox/VMM/VMMGC/VMMGCA.asm
r19 r988 210 210 mov eax, 0ffffffffh 211 211 ret 212 213 EXPORTEDNAME vmmGCTestTrap0e_ResumeEIP 214 RestoreAll 215 xor eax, eax 216 ret 212 217 ENDPROC vmmGCTestTrap0e 213 218 -
trunk/src/VBox/VMM/VMMInternal.h
r914 r988 451 451 VMMGCDECL(int) vmmGCLoggerFlush(PRTLOGGERGC pLogger); 452 452 453 /** @name Trap testcases 453 /** @name Trap testcases and related labels. 454 454 * @{ */ 455 455 DECLASM(void) vmmGCEnableWP(void); … … 459 459 DECLASM(int) vmmGCTestTrap0d(void); 460 460 DECLASM(int) vmmGCTestTrap0e(void); 461 DECLASM(int) vmmGCTestTrap0e_FaultEIP(void); /**< a label */ 462 DECLASM(int) vmmGCTestTrap0e_ResumeEIP(void); /**< a label */ 461 463 /** @} */ 462 464
Note:
See TracChangeset
for help on using the changeset viewer.