Changeset 36864 in vbox for trunk/src/VBox/VMM/testcase
- Timestamp:
- Apr 28, 2011 12:55:05 AM (14 years ago)
- Location:
- trunk/src/VBox/VMM/testcase
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/testcase/Makefile.kmk
r36862 r36864 44 44 tstVMMR0CallHost-1 \ 45 45 tstVMMR0CallHost-2 46 ifn1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.amd64solaris.x86 solaris.amd64 win.amd64 ) ## TODO: Fix the code.46 ifn1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), solaris.x86 solaris.amd64 win.amd64 ) ## TODO: Fix the code. 47 47 PROGRAMS += tstX86-1 48 48 endif -
trunk/src/VBox/VMM/testcase/tstX86-1.cpp
r36862 r36864 51 51 typedef TRAPINFO const *PCTRAPINFO; 52 52 53 53 54 /******************************************************************************* 54 55 * Global Variables * … … 91 92 # if defined(RT_ARCH_AMD64) && defined(RT_OS_DARWIN) 92 93 uintptr_t *puPC = (uintptr_t *)&pCtx->uc_mcontext->__ss.__rip; 93 uintptr_t uSP = pCtx->uc_mcontext->__ss.__rsp; 94 uintptr_t *puSP = (uintptr_t *)&pCtx->uc_mcontext->__ss.__rsp; 95 uintptr_t uTrapNo = pCtx->uc_mcontext->__es.__trapno; 96 uintptr_t uErr = pCtx->uc_mcontext->__es.__err; 97 98 # elif defined(RT_ARCH_AMD64) && defined(RT_OS_FREEBSD) 99 uintptr_t *puPC = (uintptr_t *)&pCtx->uc_mcontext.mc_rip; 100 uintptr_t *puSP = (uintptr_t *)&pCtx->uc_mcontext.mc_rsp; 94 101 uintptr_t uTrapNo = ~(uintptr_t)0; 95 102 uintptr_t uErr = ~(uintptr_t)0; 96 103 97 # elif defined(RT_ARCH_AMD64) && defined(RT_OS_FREEBSD) 98 uintptr_t *puPC = (uintptr_t *)&pCtx->uc_mcontext.mc_rip; 99 uintptr_t uSP = pCtx->uc_mcontext.mc_rsp; 104 # elif defined(RT_ARCH_AMD64) 105 uintptr_t *puPC = (uintptr_t *)&pCtx->uc_mcontext.gregs[REG_RIP]; 106 uintptr_t *puSP = &pCtx->uc_mcontext.gregs[REG_RSP]; 107 uintptr_t uTrapNo = pCtx->uc_mcontext.gregs[REG_TRAPNO]; 108 uintptr_t uErr = pCtx->uc_mcontext.gregs[REG_ERR]; 109 110 # elif defined(RT_ARCH_X86) && defined(RT_OS_DARWIN) 111 uintptr_t *puPC = (uintptr_t *)&pCtx->uc_mcontext->__ss.__eip; 112 uintptr_t *puSP = (uintptr_t *)&pCtx->uc_mcontext->__ss.__esp; 113 uintptr_t uTrapNo = pCtx->uc_mcontext->__es.__trapno; 114 uintptr_t uErr = pCtx->uc_mcontext->__es.__err; 115 116 # elif defined(RT_ARCH_X86) && defined(RT_OS_FREEBSD) 117 uintptr_t *puPC = (uintptr_t *)&pCtx->uc_mcontext.mc_eip; 118 uintptr_t *puSP = (uintptr_t *)&pCtx->uc_mcontext.mc_esp; 100 119 uintptr_t uTrapNo = ~(uintptr_t)0; 101 120 uintptr_t uErr = ~(uintptr_t)0; 102 121 103 # elif defined(RT_ARCH_ AMD64)104 uintptr_t *puPC = (uintptr_t *)&pCtx->uc_mcontext.gregs[REG_ RIP];105 uintptr_t uSP = pCtx->uc_mcontext.gregs[REG_RSP];122 # elif defined(RT_ARCH_X86) 123 uintptr_t *puPC = (uintptr_t *)&pCtx->uc_mcontext.gregs[REG_EIP]; 124 uintptr_t *puSP = (uintptr_t *)&pCtx->uc_mcontext.gregs[REG_ESP]; 106 125 uintptr_t uTrapNo = pCtx->uc_mcontext.gregs[REG_TRAPNO]; 107 126 uintptr_t uErr = pCtx->uc_mcontext.gregs[REG_ERR]; 108 127 109 # elif defined(RT_ARCH_X86) && defined(RT_OS_DARWIN)110 uintptr_t *puPC = (uintptr_t *)&pCtx->uc_mcontext->__ss.__eip;111 uintptr_t uSP = pCtx->uc_mcontext->__ss.__esp;112 uintptr_t uTrapNo = ~(uintptr_t)0;113 uintptr_t uErr = ~(uintptr_t)0;114 115 # elif defined(RT_ARCH_X86) && defined(RT_OS_FREEBSD)116 uintptr_t *puPC = (uintptr_t *)&pCtx->uc_mcontext.mc_eip;117 uintptr_t uSP = pCtx->uc_mcontext.mc_esp;118 uintptr_t uTrapNo = ~(uintptr_t)0;119 uintptr_t uErr = ~(uintptr_t)0;120 121 # elif defined(RT_ARCH_X86)122 uintptr_t *puPC = (uintptr_t *)&pCtx->uc_mcontext.gregs[REG_EIP];123 uintptr_t uSP = pCtx->uc_mcontext.gregs[REG_ESP];124 uintptr_t uTrapNo = pCtx->uc_mcontext.gregs[REG_TRAPNO];125 uintptr_t uErr = pCtx->uc_mcontext.gregs[REG_ERR];126 127 128 # else 128 129 uintptr_t *puPC = NULL; 130 uintptr_t *puSP = NULL; 129 131 uintptr_t uTrapNo = ~(uintptr_t)0; 130 132 uintptr_t uErr = ~(uintptr_t)0; … … 132 134 RTAssertMsg2("tstX86-1: Trap #%#04x err=%#06x at %p\n", uTrapNo, uErr, *puPC); 133 135 134 PCTRAPINFO pTrapInfo = findTrapInfo(*puPC,uSP);136 PCTRAPINFO pTrapInfo = findTrapInfo(*puPC, *puSP); 135 137 if (pTrapInfo) 136 138 { 137 /** @todo verify the kind of trap */ 138 *puPC = pTrapInfo->uResumePC; 139 return; 139 if (pTrapInfo->u8Trap != uTrapNo && uTrapNo != ~(uintptr_t)0) 140 RTAssertMsg2("tstX86-1: Expected #%#04x, got #%#04x\n", pTrapInfo->u8Trap, uTrapNo); 141 else 142 { 143 if (*puPC != pTrapInfo->uTrapPC) 144 *puSP += sizeof(uintptr_t); 145 *puPC = pTrapInfo->uResumePC; 146 return; 147 } 140 148 } 149 else 150 RTAssertMsg2("tstX86-1: Unexpected trap!\n"); 141 151 142 152 /* die */ … … 183 193 if (!RTTestErrorCount(hTest)) 184 194 { 185 186 195 /* 187 196 * Do the testing. -
trunk/src/VBox/VMM/testcase/tstX86-1A.asm
r36862 r36864 468 468 mov eax, __LINE__ 469 469 mov xDI, REF_GLOBAL(g_pbEfExecPage) 470 add xDI, 1000h - 4h 471 mov byte [xDI+0], 0f0h 472 mov byte [xDI+1], 002h 473 mov byte [xDI+2], 08Fh 474 mov byte [xDI+3], 000h 475 ShouldTrap X86_XCPT_PF, call xDI 470 add xDI, 1000h - 8h 471 mov byte [xDI+0], 0f0h 472 mov byte [xDI+1], 002h 473 mov byte [xDI+2], 08Fh 474 mov dword [xDI+3], 000000000h 475 mov byte [xDI+7], 0ccFh 476 ShouldTrap X86_XCPT_UD, call xDI 476 477 477 478 mov eax, __LINE__ … … 483 484 mov dword [xDI+3], 000000000h 484 485 ShouldTrap X86_XCPT_UD, call xDI 486 487 mov eax, __LINE__ 488 mov xDI, REF_GLOBAL(g_pbEfExecPage) 489 add xDI, 1000h - 4h 490 mov byte [xDI+0], 0f0h 491 mov byte [xDI+1], 002h 492 mov byte [xDI+2], 08Fh 493 mov byte [xDI+3], 000h 494 ShouldTrap X86_XCPT_PF, call xDI 495 496 mov eax, __LINE__ 497 mov xDI, REF_GLOBAL(g_pbEfExecPage) 498 add xDI, 1000h - 6h 499 mov byte [xDI+0], 0f0h 500 mov byte [xDI+1], 002h 501 mov byte [xDI+2], 08Fh 502 mov byte [xDI+3], 00h 503 mov byte [xDI+4], 00h 504 mov byte [xDI+5], 00h 505 ShouldTrap X86_XCPT_PF, call xDI 506 507 mov eax, __LINE__ 508 mov xDI, REF_GLOBAL(g_pbEfExecPage) 509 add xDI, 1000h - 5h 510 mov byte [xDI+0], 0f0h 511 mov byte [xDI+1], 002h 512 mov byte [xDI+2], 08Fh 513 mov byte [xDI+3], 00h 514 mov byte [xDI+4], 00h 515 ShouldTrap X86_XCPT_PF, call xDI 516 517 mov eax, __LINE__ 518 mov xDI, REF_GLOBAL(g_pbEfExecPage) 519 add xDI, 1000h - 4h 520 mov byte [xDI+0], 0f0h 521 mov byte [xDI+1], 002h 522 mov byte [xDI+2], 08Fh 523 mov byte [xDI+3], 00h 524 ShouldTrap X86_XCPT_PF, call xDI 525 526 mov eax, __LINE__ 527 mov xDI, REF_GLOBAL(g_pbEfExecPage) 528 add xDI, 1000h - 3h 529 mov byte [xDI+0], 0f0h 530 mov byte [xDI+1], 002h 531 mov byte [xDI+2], 08Fh 532 ShouldTrap X86_XCPT_PF, call xDI 533 534 mov eax, __LINE__ 535 mov xDI, REF_GLOBAL(g_pbEfExecPage) 536 add xDI, 1000h - 2h 537 mov byte [xDI+0], 0f0h 538 mov byte [xDI+1], 002h 539 ShouldTrap X86_XCPT_PF, call xDI 540 541 mov eax, __LINE__ 542 mov xDI, REF_GLOBAL(g_pbEfExecPage) 543 add xDI, 1000h - 1h 544 mov byte [xDI+0], 0f0h 545 ShouldTrap X86_XCPT_PF, call xDI 485 546 486 547
Note:
See TracChangeset
for help on using the changeset viewer.