VirtualBox

Changeset 19478 in vbox


Ignore:
Timestamp:
May 7, 2009 11:31:37 AM (16 years ago)
Author:
vboxsync
Message:

Finished up init IPI processing. (untested)

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/cpum.h

    r19076 r19478  
    989989VMMR3DECL(int)          CPUMR3TermCPU(PVM pVM);
    990990VMMR3DECL(void)         CPUMR3Reset(PVM pVM);
     991VMMR3DECL(void)         CPUMR3ResetCpu(PVMCPU pVCpu);
    991992# ifdef DEBUG
    992993VMMR3DECL(void)         CPUMR3SaveEntryCtx(PVM pVM);
  • trunk/include/VBox/err.h

    r19406 r19478  
    164164/** PARAV call */
    165165#define VINF_EM_RESCHEDULE_PARAV            1119
     166/** Go back into wait for SIPI mode */
     167#define VINF_EM_WAIT_SIPI                   1120
    166168/** Last scheduling related status code. (inclusive) */
    167 #define VINF_EM_LAST                        1119
     169#define VINF_EM_LAST                        1120
    168170
    169171/** Reason for leaving GC: Guest trap which couldn't be handled in GC.
  • trunk/src/VBox/VMM/CPUM.cpp

    r19463 r19478  
    720720}
    721721
     722VMMR3DECL(void) CPUMR3ResetCpu(PVMCPU pVCpu)
     723{
     724    /* @todo anything different for VCPU > 0? */
     725    PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu);
     726
     727    /*
     728     * Initialize everything to ZERO first.
     729     */
     730    uint32_t    fUseFlags =  pVCpu->cpum.s.fUseFlags & ~CPUM_USED_FPU_SINCE_REM;
     731    memset(pCtx, 0, sizeof(*pCtx));
     732    pVCpu->cpum.s.fUseFlags  = fUseFlags;
     733
     734    pCtx->cr0                       = X86_CR0_CD | X86_CR0_NW | X86_CR0_ET;  //0x60000010
     735    pCtx->eip                       = 0x0000fff0;
     736    pCtx->edx                       = 0x00000600;   /* P6 processor */
     737    pCtx->eflags.Bits.u1Reserved0   = 1;
     738
     739    pCtx->cs                        = 0xf000;
     740    pCtx->csHid.u64Base             = UINT64_C(0xffff0000);
     741    pCtx->csHid.u32Limit            = 0x0000ffff;
     742    pCtx->csHid.Attr.n.u1DescType   = 1; /* code/data segment */
     743    pCtx->csHid.Attr.n.u1Present    = 1;
     744    pCtx->csHid.Attr.n.u4Type       = X86_SEL_TYPE_READ | X86_SEL_TYPE_CODE;
     745
     746    pCtx->dsHid.u32Limit            = 0x0000ffff;
     747    pCtx->dsHid.Attr.n.u1DescType   = 1; /* code/data segment */
     748    pCtx->dsHid.Attr.n.u1Present    = 1;
     749    pCtx->dsHid.Attr.n.u4Type       = X86_SEL_TYPE_RW;
     750
     751    pCtx->esHid.u32Limit            = 0x0000ffff;
     752    pCtx->esHid.Attr.n.u1DescType   = 1; /* code/data segment */
     753    pCtx->esHid.Attr.n.u1Present    = 1;
     754    pCtx->esHid.Attr.n.u4Type       = X86_SEL_TYPE_RW;
     755
     756    pCtx->fsHid.u32Limit            = 0x0000ffff;
     757    pCtx->fsHid.Attr.n.u1DescType   = 1; /* code/data segment */
     758    pCtx->fsHid.Attr.n.u1Present    = 1;
     759    pCtx->fsHid.Attr.n.u4Type       = X86_SEL_TYPE_RW;
     760
     761    pCtx->gsHid.u32Limit            = 0x0000ffff;
     762    pCtx->gsHid.Attr.n.u1DescType   = 1; /* code/data segment */
     763    pCtx->gsHid.Attr.n.u1Present    = 1;
     764    pCtx->gsHid.Attr.n.u4Type       = X86_SEL_TYPE_RW;
     765
     766    pCtx->ssHid.u32Limit            = 0x0000ffff;
     767    pCtx->ssHid.Attr.n.u1Present    = 1;
     768    pCtx->ssHid.Attr.n.u1DescType   = 1; /* code/data segment */
     769    pCtx->ssHid.Attr.n.u4Type       = X86_SEL_TYPE_RW;
     770
     771    pCtx->idtr.cbIdt                = 0xffff;
     772    pCtx->gdtr.cbGdt                = 0xffff;
     773
     774    pCtx->ldtrHid.u32Limit          = 0xffff;
     775    pCtx->ldtrHid.Attr.n.u1Present  = 1;
     776    pCtx->ldtrHid.Attr.n.u4Type     = X86_SEL_TYPE_SYS_LDT;
     777
     778    pCtx->trHid.u32Limit            = 0xffff;
     779    pCtx->trHid.Attr.n.u1Present    = 1;
     780    pCtx->trHid.Attr.n.u4Type       = X86_SEL_TYPE_SYS_286_TSS_BUSY;
     781
     782    pCtx->dr[6]                     = X86_DR6_INIT_VAL;
     783    pCtx->dr[7]                     = X86_DR7_INIT_VAL;
     784
     785    pCtx->fpu.FTW                   = 0xff;         /* All tags are set, i.e. the regs are empty. */
     786    pCtx->fpu.FCW                   = 0x37f;
     787
     788    /* Intel 64 and IA-32 Architectures Software Developer's Manual Volume 3A, Table 8-1. IA-32 Processor States Following Power-up, Reset, or INIT */
     789    pCtx->fpu.MXCSR                 = 0x1F80;
     790
     791    /* Init PAT MSR */
     792    pCtx->msrPAT                    = UINT64_C(0x0007040600070406); /** @todo correct? */
     793
     794    /* Reset EFER; see AMD64 Architecture Programmer's Manual Volume 2: Table 14-1. Initial Processor State
     795    * The Intel docs don't mention it.
     796    */
     797    pCtx->msrEFER                   = 0;
     798}
    722799
    723800/**
     
    729806VMMR3DECL(void) CPUMR3Reset(PVM pVM)
    730807{
    731     /* @todo anything different for VCPU > 0? */
    732808    for (unsigned i=0;i<pVM->cCPUs;i++)
    733809    {
     810        CPUMR3ResetCpu(&pVM->aCpus[i]);
     811
     812#ifdef VBOX_WITH_CRASHDUMP_MAGIC
    734813        PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(&pVM->aCpus[i]);
    735814
    736         /*
    737          * Initialize everything to ZERO first.
    738          */
    739         uint32_t    fUseFlags =  pVM->aCpus[i].cpum.s.fUseFlags & ~CPUM_USED_FPU_SINCE_REM;
    740         memset(pCtx, 0, sizeof(*pCtx));
    741         pVM->aCpus[i].cpum.s.fUseFlags  = fUseFlags;
    742 
    743         pCtx->cr0                       = X86_CR0_CD | X86_CR0_NW | X86_CR0_ET;  //0x60000010
    744         pCtx->eip                       = 0x0000fff0;
    745         pCtx->edx                       = 0x00000600;   /* P6 processor */
    746         pCtx->eflags.Bits.u1Reserved0   = 1;
    747 
    748         pCtx->cs                        = 0xf000;
    749         pCtx->csHid.u64Base             = UINT64_C(0xffff0000);
    750         pCtx->csHid.u32Limit            = 0x0000ffff;
    751         pCtx->csHid.Attr.n.u1DescType   = 1; /* code/data segment */
    752         pCtx->csHid.Attr.n.u1Present    = 1;
    753         pCtx->csHid.Attr.n.u4Type       = X86_SEL_TYPE_READ | X86_SEL_TYPE_CODE;
    754 
    755         pCtx->dsHid.u32Limit            = 0x0000ffff;
    756         pCtx->dsHid.Attr.n.u1DescType   = 1; /* code/data segment */
    757         pCtx->dsHid.Attr.n.u1Present    = 1;
    758         pCtx->dsHid.Attr.n.u4Type       = X86_SEL_TYPE_RW;
    759 
    760         pCtx->esHid.u32Limit            = 0x0000ffff;
    761         pCtx->esHid.Attr.n.u1DescType   = 1; /* code/data segment */
    762         pCtx->esHid.Attr.n.u1Present    = 1;
    763         pCtx->esHid.Attr.n.u4Type       = X86_SEL_TYPE_RW;
    764 
    765         pCtx->fsHid.u32Limit            = 0x0000ffff;
    766         pCtx->fsHid.Attr.n.u1DescType   = 1; /* code/data segment */
    767         pCtx->fsHid.Attr.n.u1Present    = 1;
    768         pCtx->fsHid.Attr.n.u4Type       = X86_SEL_TYPE_RW;
    769 
    770         pCtx->gsHid.u32Limit            = 0x0000ffff;
    771         pCtx->gsHid.Attr.n.u1DescType   = 1; /* code/data segment */
    772         pCtx->gsHid.Attr.n.u1Present    = 1;
    773         pCtx->gsHid.Attr.n.u4Type       = X86_SEL_TYPE_RW;
    774 
    775         pCtx->ssHid.u32Limit            = 0x0000ffff;
    776         pCtx->ssHid.Attr.n.u1Present    = 1;
    777         pCtx->ssHid.Attr.n.u1DescType   = 1; /* code/data segment */
    778         pCtx->ssHid.Attr.n.u4Type       = X86_SEL_TYPE_RW;
    779 
    780         pCtx->idtr.cbIdt                = 0xffff;
    781         pCtx->gdtr.cbGdt                = 0xffff;
    782 
    783         pCtx->ldtrHid.u32Limit          = 0xffff;
    784         pCtx->ldtrHid.Attr.n.u1Present  = 1;
    785         pCtx->ldtrHid.Attr.n.u4Type     = X86_SEL_TYPE_SYS_LDT;
    786 
    787         pCtx->trHid.u32Limit            = 0xffff;
    788         pCtx->trHid.Attr.n.u1Present    = 1;
    789         pCtx->trHid.Attr.n.u4Type       = X86_SEL_TYPE_SYS_286_TSS_BUSY;
    790 
    791         pCtx->dr[6]                     = X86_DR6_INIT_VAL;
    792         pCtx->dr[7]                     = X86_DR7_INIT_VAL;
    793 
    794         pCtx->fpu.FTW                   = 0xff;         /* All tags are set, i.e. the regs are empty. */
    795         pCtx->fpu.FCW                   = 0x37f;
    796 
    797         /* Intel 64 and IA-32 Architectures Software Developer's Manual Volume 3A, Table 8-1. IA-32 Processor States Following Power-up, Reset, or INIT */
    798         pCtx->fpu.MXCSR                 = 0x1F80;
    799 
    800         /* Init PAT MSR */
    801         pCtx->msrPAT                    = UINT64_C(0x0007040600070406); /** @todo correct? */
    802 
    803         /* Reset EFER; see AMD64 Architecture Programmer's Manual Volume 2: Table 14-1. Initial Processor State
    804         * The Intel docs don't mention it.
    805         */
    806         pCtx->msrEFER                   = 0;
    807 
    808 #ifdef VBOX_WITH_CRASHDUMP_MAGIC
    809815        /* Magic marker for searching in crash dumps. */
    810816        strcpy((char *)pVM->aCpus[i].cpum.s.aMagic, "CPUMCPU Magic");
  • trunk/src/VBox/VMM/EM.cpp

    r19442 r19478  
    25582558        case VINF_EM_RESCHEDULE:
    25592559        case VINF_EM_RESCHEDULE_REM:
     2560        case VINF_EM_WAIT_SIPI:
    25602561            break;
    25612562
     
    37313732                    break;
    37323733
     3734                /*
     3735                 * Switch to the wait for SIPI state (application processor only)
     3736                 */
     3737                case VINF_EM_WAIT_SIPI:
     3738                    Assert(pVCpu->idCpu != 0);
     3739                    Log2(("EMR3ExecuteVM: VINF_EM_WAIT_SIPI: %d -> %d\n", pVCpu->em.s.enmState, EMSTATE_WAIT_SIPI));
     3740                    pVCpu->em.s.enmState = EMSTATE_WAIT_SIPI;
     3741                    break;
     3742
     3743
    37333744                /*
    37343745                 * Suspend.
  • trunk/src/VBox/VMM/VMM.cpp

    r19476 r19478  
    11771177    VMCPU_ASSERT_EMT(pVCpu);
    11781178
    1179     /** @todo: reset CPU and halt till SIPI */
    1180 
    1181     return VINF_SUCCESS;
     1179    CPUMR3ResetCpu(pVCpu);
     1180    return VINF_EM_WAIT_SIPI;
    11821181}
    11831182
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