VirtualBox

Changeset 41985 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Jul 2, 2012 3:00:27 PM (13 years ago)
Author:
vboxsync
Message:

VMM: Fixed tstVMM (single stepping ++ in raw-mode code).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/VMMTests.cpp

    r41965 r41985  
    4343#include <iprt/x86.h>
    4444
     45static void vmmR3TestClearStack(PVMCPU pVCpu)
     46{
     47    /* We leave the first 64 bytes of the stack alone because of strict
     48       ring-0 long jump code uses it. */
     49    memset(pVCpu->vmm.s.pbEMTStackR3 + 64, 0xaa, VMM_STACK_SIZE - 64);
     50}
     51
    4552
    4653/**
     
    6168        return rc;
    6269
    63     memset(pVCpu->vmm.s.pbEMTStackR3, 0xaa, VMM_STACK_SIZE);
    64     CPUMSetHyperESP(pVCpu, pVCpu->vmm.s.pbEMTStackBottomRC); /* Clear the stack. */
     70    CPUMSetHyperState(pVCpu, pVM->vmm.s.pfnCallTrampolineRC, pVCpu->vmm.s.pbEMTStackBottomRC, 0, 0);
     71    vmmR3TestClearStack(pVCpu);
    6572    CPUMPushHyper(pVCpu, uVariation);
    6673    CPUMPushHyper(pVCpu, enmTestcase);
     
    6875    CPUMPushHyper(pVCpu, 3 * sizeof(RTRCPTR));    /* stack frame size */
    6976    CPUMPushHyper(pVCpu, RCPtrEP);                /* what to call */
    70     CPUMSetHyperEIP(pVCpu, pVM->vmm.s.pfnCallTrampolineRC);
    7177    Assert(CPUMGetHyperCR3(pVCpu) && CPUMGetHyperCR3(pVCpu) == PGMGetHyperCR3(pVCpu));
    7278    rc = SUPR3CallVMMR0Fast(pVM->pVMR0, VMMR0_DO_RAW_RUN, 0);
     
    100106        return rc;
    101107
    102     memset(pVCpu->vmm.s.pbEMTStackR3, 0xaa, VMM_STACK_SIZE);
    103     CPUMSetHyperESP(pVCpu, pVCpu->vmm.s.pbEMTStackBottomRC); /* Clear the stack. */
     108    CPUMSetHyperState(pVCpu, pVM->vmm.s.pfnCallTrampolineRC, pVCpu->vmm.s.pbEMTStackBottomRC, 0, 0);
     109    vmmR3TestClearStack(pVCpu);
    104110    CPUMPushHyper(pVCpu, uVariation);
    105111    CPUMPushHyper(pVCpu, u8Trap + VMMGC_DO_TESTCASE_TRAP_FIRST);
     
    107113    CPUMPushHyper(pVCpu, 3 * sizeof(RTRCPTR));    /* stack frame size */
    108114    CPUMPushHyper(pVCpu, RCPtrEP);                /* what to call */
    109     CPUMSetHyperEIP(pVCpu, pVM->vmm.s.pfnCallTrampolineRC);
    110115    Assert(CPUMGetHyperCR3(pVCpu) && CPUMGetHyperCR3(pVCpu) == PGMGetHyperCR3(pVCpu));
    111116    rc = SUPR3CallVMMR0Fast(pVM->pVMR0, VMMR0_DO_RAW_RUN, 0);
     
    221226        vmmR3DoTrapTest(pVM, 0xe, 1, VERR_TRPM_DONT_PANIC,  0x00000000, "vmmGCTestTrap0e_FaultEIP", "#PF (NULL) WP");
    222227        vmmR3DoTrapTest(pVM, 0xe, 2, VINF_SUCCESS,          0x00000000, NULL,                       "#PF w/Tmp Handler");
     228        /* This test is no longer relevant as fs and gs are loaded with NULL
     229           selectors and we will always return to HC if a #GP occurs while
     230           returning to guest code.
    223231        vmmR3DoTrapTest(pVM, 0xe, 4, VINF_SUCCESS,          0x00000000, NULL,                       "#PF w/Tmp Handler and bad fs");
     232        */
    224233
    225234        /*
     
    266275        if (rc != VINF_SUCCESS)
    267276        {
    268             RTPrintf("VMM: failed to resume on hyper breakpoint, rc=%Rrc\n", rc);
     277            RTPrintf("VMM: failed to resume on hyper breakpoint, rc=%Rrc = KNOWN BUG\n", rc); /** @todo fix VMMR3ResumeHyper */
    269278            return rc;
    270279        }
     
    337346         * Interrupt forwarding.
    338347         */
    339         CPUMSetHyperESP(pVCpu, pVCpu->vmm.s.pbEMTStackBottomRC); /* Clear the stack. */
     348        CPUMSetHyperState(pVCpu, pVM->vmm.s.pfnCallTrampolineRC, pVCpu->vmm.s.pbEMTStackBottomRC, 0, 0);
    340349        CPUMPushHyper(pVCpu, 0);
    341350        CPUMPushHyper(pVCpu, VMMGC_DO_TESTCASE_HYPER_INTERRUPT);
     
    343352        CPUMPushHyper(pVCpu, 3 * sizeof(RTRCPTR));    /* stack frame size */
    344353        CPUMPushHyper(pVCpu, RCPtrEP);                /* what to call */
    345         CPUMSetHyperEIP(pVCpu, pVM->vmm.s.pfnCallTrampolineRC);
    346354        Log(("trampoline=%x\n", pVM->vmm.s.pfnCallTrampolineRC));
    347355
     
    400408        for (i = 0; i < 1000000; i++)
    401409        {
    402             CPUMSetHyperESP(pVCpu, pVCpu->vmm.s.pbEMTStackBottomRC); /* Clear the stack. */
     410            CPUMSetHyperState(pVCpu, pVM->vmm.s.pfnCallTrampolineRC, pVCpu->vmm.s.pbEMTStackBottomRC, 0, 0);
    403411            CPUMPushHyper(pVCpu, 0);
    404412            CPUMPushHyper(pVCpu, VMMGC_DO_TESTCASE_NOP);
     
    406414            CPUMPushHyper(pVCpu, 3 * sizeof(RTRCPTR));    /* stack frame size */
    407415            CPUMPushHyper(pVCpu, RCPtrEP);                /* what to call */
    408             CPUMSetHyperEIP(pVCpu, pVM->vmm.s.pfnCallTrampolineRC);
    409416
    410417            uint64_t TickThisStart = ASMReadTSC();
     
    533540        for (i = 0; i < 1000000; i++)
    534541        {
    535             CPUMSetHyperESP(pVCpu, pVCpu->vmm.s.pbEMTStackBottomRC); /* Clear the stack. */
     542            CPUMSetHyperState(pVCpu, pVM->vmm.s.pfnCallTrampolineRC, pVCpu->vmm.s.pbEMTStackBottomRC, 0, 0);
    536543            CPUMPushHyper(pVCpu, 0);
    537544            CPUMPushHyper(pVCpu, VMMGC_DO_TESTCASE_HWACCM_NOP);
     
    539546            CPUMPushHyper(pVCpu, 3 * sizeof(RTRCPTR));    /* stack frame size */
    540547            CPUMPushHyper(pVCpu, RCPtrEP);                /* what to call */
    541             CPUMSetHyperEIP(pVCpu, pVM->vmm.s.pfnCallTrampolineRC);
    542548
    543549            pHyperCtx = CPUMGetHyperCtxPtr(pVCpu);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette