Changeset 25816 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Jan 13, 2010 9:05:35 PM (15 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/EM.cpp
r25732 r25816 437 437 } 438 438 439 VMMR3DECL(void) EMR3ResetCpu(PVMCPU pVCpu) 440 { 441 pVCpu->em.s.fForceRAW = false; 442 443 /* VMR3Reset may return VINF_EM_RESET or VINF_EM_SUSPEND, so transition 444 out of the HALTED state here so that enmPrevState doesn't end up as 445 HALTED when EMR3Execute returns. */ 446 if (pVCpu->em.s.enmState == EMSTATE_HALTED) 447 { 448 Log(("EMR3ResetCpu: Cpu#%u %s -> %s\n", pVCpu->idCpu, emR3GetStateName(pVCpu->em.s.enmState), pVCpu->idCpu == 0 ? "EMSTATE_NONE" : "EMSTATE_WAIT_SIPI")); 449 pVCpu->em.s.enmState = pVCpu->idCpu == 0 ? EMSTATE_NONE : EMSTATE_WAIT_SIPI; 450 } 451 } 439 452 440 453 /** … … 449 462 { 450 463 PVMCPU pVCpu = &pVM->aCpus[i]; 451 pVCpu->em.s.fForceRAW = false; 452 453 /* VMR3Reset may return VINF_EM_RESET or VINF_EM_SUSPEND, so transition 454 out of the HALTED state here so that enmPrevState doesn't end up as 455 HALTED when EMR3Execute returns. */ 456 if (pVCpu->em.s.enmState == EMSTATE_HALTED) 457 { 458 Log(("EMR3Reset: Cpu#%u %s -> %s\n", i, emR3GetStateName(pVCpu->em.s.enmState), i == 0 ? "EMSTATE_NONE" : "EMSTATE_WAIT_SIPI")); 459 pVCpu->em.s.enmState = i == 0 ? EMSTATE_NONE : EMSTATE_WAIT_SIPI; 460 } 464 EMR3ResetCpu(pVCpu); 461 465 } 462 466 } -
trunk/src/VBox/VMM/HWACCM.cpp
r25386 r25816 1458 1458 1459 1459 /** 1460 * Resets a virtual CPU. 1461 * 1462 * @param pVCpu The CPu to reset. 1463 */ 1464 VMMR3DECL(void) HWACCMR3ResetCPU(PVMCPU pVCpu) 1465 { 1466 /* On first entry we'll sync everything. */ 1467 pVCpu->hwaccm.s.fContextUseFlags = HWACCM_CHANGED_ALL; 1468 1469 pVCpu->hwaccm.s.vmx.cr0_mask = 0; 1470 pVCpu->hwaccm.s.vmx.cr4_mask = 0; 1471 1472 pVCpu->hwaccm.s.fActive = false; 1473 pVCpu->hwaccm.s.Event.fPending = false; 1474 1475 /* Reset state information for real-mode emulation in VT-x. */ 1476 pVCpu->hwaccm.s.vmx.enmLastSeenGuestMode = PGMMODE_REAL; 1477 pVCpu->hwaccm.s.vmx.enmPrevGuestMode = PGMMODE_REAL; 1478 pVCpu->hwaccm.s.vmx.enmCurrGuestMode = PGMMODE_REAL; 1479 1480 /* Reset the contents of the read cache. */ 1481 PVMCSCACHE pCache = &pVCpu->hwaccm.s.vmx.VMCSCache; 1482 for (unsigned j=0;j<pCache->Read.cValidEntries;j++) 1483 pCache->Read.aFieldVal[j] = 0; 1484 1485 #ifdef VBOX_WITH_CRASHDUMP_MAGIC 1486 /* Magic marker for searching in crash dumps. */ 1487 strcpy((char *)pCache->aMagic, "VMCSCACHE Magic"); 1488 pCache->uMagic = UINT64_C(0xDEADBEEFDEADBEEF); 1489 #endif 1490 } 1491 1492 /** 1460 1493 * The VM is being reset. 1461 1494 * … … 1476 1509 PVMCPU pVCpu = &pVM->aCpus[i]; 1477 1510 1478 /* On first entry we'll sync everything. */ 1479 pVCpu->hwaccm.s.fContextUseFlags = HWACCM_CHANGED_ALL; 1480 1481 pVCpu->hwaccm.s.vmx.cr0_mask = 0; 1482 pVCpu->hwaccm.s.vmx.cr4_mask = 0; 1483 1484 pVCpu->hwaccm.s.fActive = false; 1485 pVCpu->hwaccm.s.Event.fPending = false; 1486 1487 /* Reset state information for real-mode emulation in VT-x. */ 1488 pVCpu->hwaccm.s.vmx.enmLastSeenGuestMode = PGMMODE_REAL; 1489 pVCpu->hwaccm.s.vmx.enmPrevGuestMode = PGMMODE_REAL; 1490 pVCpu->hwaccm.s.vmx.enmCurrGuestMode = PGMMODE_REAL; 1491 1492 /* Reset the contents of the read cache. */ 1493 PVMCSCACHE pCache = &pVCpu->hwaccm.s.vmx.VMCSCache; 1494 for (unsigned j=0;j<pCache->Read.cValidEntries;j++) 1495 pCache->Read.aFieldVal[j] = 0; 1496 1497 #ifdef VBOX_WITH_CRASHDUMP_MAGIC 1498 /* Magic marker for searching in crash dumps. */ 1499 strcpy((char *)pCache->aMagic, "VMCSCACHE Magic"); 1500 pCache->uMagic = UINT64_C(0xDEADBEEFDEADBEEF); 1501 #endif 1511 HWACCMR3ResetCPU(pVCpu); 1502 1512 } 1503 1513 -
trunk/src/VBox/VMM/PDM.cpp
r25732 r25816 1153 1153 } 1154 1154 1155 VMMR3DECL(void) PDMR3ResetCpu(PVMCPU pVCpu) 1156 { 1157 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_APIC); 1158 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_PIC); 1159 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI); 1160 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_SMI); 1161 } 1155 1162 1156 1163 /** … … 1245 1252 { 1246 1253 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 1247 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_APIC); 1248 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_PIC); 1249 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI); 1250 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_SMI); 1254 PDMR3ResetCpu(pVCpu); 1251 1255 } 1252 1256 VM_FF_CLEAR(pVM, VM_FF_PDM_DMA); -
trunk/src/VBox/VMM/PGM.cpp
r25732 r25816 2172 2172 } 2173 2173 2174 VMMR3DECL(void) PGMR3ResetCpu(PVM pVM, PVMCPU pVCpu) 2175 { 2176 int rc = PGM_GST_PFN(Exit, pVCpu)(pVCpu); 2177 AssertRC(rc); 2178 2179 rc = PGMR3ChangeMode(pVM, pVCpu, PGMMODE_REAL); 2180 AssertRC(rc); 2181 2182 STAM_REL_COUNTER_RESET(&pVCpu->pgm.s.cGuestModeChanges); 2183 2184 pgmR3PoolResetCpu(pVM, pVCpu); 2185 2186 /* 2187 * Re-init other members. 2188 */ 2189 pVCpu->pgm.s.fA20Enabled = true; 2190 2191 /* 2192 * Clear the FFs PGM owns. 2193 */ 2194 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 2195 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL); 2196 } 2174 2197 2175 2198 /** -
trunk/src/VBox/VMM/PGMInternal.h
r25647 r25816 3285 3285 void pgmR3PoolRelocate(PVM pVM); 3286 3286 void pgmR3PoolReset(PVM pVM); 3287 void pgmR3PoolResetCpu(PVM pVM, PVMCPU pVCpu); 3287 3288 void pgmR3PoolClearAll(PVM pVM); 3288 3289 -
trunk/src/VBox/VMM/TRPM.cpp
r25647 r25816 713 713 } 714 714 715 VMMR3DECL(void) TRPMR3ResetCpu(PVMCPU pVCpu) 716 { 717 pVCpu->trpm.s.uActiveVector = ~0; 718 } 715 719 716 720 /** … … 746 750 { 747 751 PVMCPU pVCpu = &pVM->aCpus[i]; 748 pVCpu->trpm.s.uActiveVector = ~0;752 TRPMR3ResetCpu(pVCpu); 749 753 } 750 754 memcpy(&pVM->trpm.s.aIdt[0], &g_aIdt[0], sizeof(pVM->trpm.s.aIdt)); -
trunk/src/VBox/VMM/VM.cpp
r25238 r25816 4042 4042 } 4043 4043 4044 DECLCALLBACK(int) vmR3HotunplugCPU(PVM pVM, VMCPUID idCpu) 4045 { 4046 PVMCPU pVCpu = VMMGetCpuById(pVM, idCpu); 4047 VMCPU_ASSERT_EMT(pVCpu); 4048 4049 /* 4050 * Reset per CPU resources. 4051 * Actually only needed for VT-x because the CPU 4052 * seems to be still in some paged mode and startup 4053 * fails after a new hotplug event. 4054 * SVM works fine even without this. 4055 */ 4056 Log(("vmR3HotunplugCPU for VCPU %d\n", idCpu)); 4057 PGMR3ResetCpu(pVM, pVCpu); 4058 PDMR3ResetCpu(pVCpu); 4059 TRPMR3ResetCpu(pVCpu); 4060 CPUMR3ResetCpu(pVCpu); 4061 EMR3ResetCpu(pVCpu); 4062 HWACCMR3ResetCPU(pVCpu); 4063 return VINF_EM_WAIT_SIPI; 4064 } 4065 4066 /** 4067 * Return the package and core id of a CPU. 4068 * 4069 * @returns VBOX status code. 4070 * @param pVM The VM to operate on. 4071 * @param idCpu Virtual CPU to get the ID from. 4072 * @param pidCpuCore Where to store the core ID of the virtual CPU. 4073 * @param pidCpuPackage Where to store the package ID of the virtual CPU. 4074 */ 4075 VMMR3DECL(int) VMR3GetCPUCoreAndPackageIdFromCPUId(PVM pVM, VMCPUID idCpu, uint32_t *pidCpuCore, uint32_t *pidCpuPackage) 4076 { 4077 if (idCpu >= pVM->cCpus) 4078 return VERR_INVALID_CPU_ID; 4079 4080 #ifdef VBOX_WITH_MULTI_CORE 4081 *pidCpuCore = idCpu; 4082 *pidCpuPackage = 0; 4083 #else 4084 *pidCpuCore = 0; 4085 *pidCpuPackage = idCpu; 4086 #endif 4087 4088 return VINF_SUCCESS; 4089 } 4090 4091 /** 4092 * Unplugs a CPU from the guest. 4093 * 4094 * @returns VBox status code. 4095 * @param pVM The VM to operate on. 4096 * @param idCpu Virtual CPU to perform the unplug operation on. 4097 */ 4098 VMMR3DECL(int) VMR3HotunplugCPU(PVM pVM, VMCPUID idCpu) 4099 { 4100 AssertReturn(idCpu < pVM->cCpus, VERR_INVALID_CPU_ID); 4101 4102 /** @todo Destroy EMT and not needed resources. */ 4103 return VMR3ReqCallNoWaitU(pVM->pUVM, idCpu, (PFNRT)vmR3HotunplugCPU, 2, pVM, idCpu); 4104 } 4105 4106 /** 4107 * Hotplugs a CPU on the guest. 4108 * 4109 * @returns VBox status code. 4110 * @param pVM The VM to operate on. 4111 * @param idCpu Virtual CPU to perform the hotplug operation on. 4112 */ 4113 VMMR3DECL(int) VMR3HotplugCPU(PVM pVM, VMCPUID idCpu) 4114 { 4115 AssertReturn(idCpu < pVM->cCpus, VERR_INVALID_CPU_ID); 4116 4117 /** @todo start EMT and allocate needed resources. */ 4118 return VINF_SUCCESS; 4119 } 4120 -
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r25577 r25816 4767 4767 4768 4768 #ifdef IN_RING3 4769 4770 void pgmR3PoolResetCpu(PVM pVM, PVMCPU pVCpu) 4771 { 4772 pgmR3ExitShadowModeBeforePoolFlush(pVM, pVCpu); 4773 4774 pgmR3ReEnterShadowModeAfterPoolFlush(pVM, pVCpu); 4775 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 4776 VMCPU_FF_SET(pVCpu, VMCPU_FF_TLB_FLUSH); 4777 } 4778 4769 4779 /** 4770 4780 * Flushes the entire cache.
Note:
See TracChangeset
for help on using the changeset viewer.