- Timestamp:
- Nov 3, 2008 2:53:11 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/uvm.h
r8155 r13751 35 35 36 36 #include <VBox/types.h> 37 38 /** 39 * Per virtual CPU ring-3 (user mode) data. 40 */ 41 typedef struct UVMCPU 42 { 43 uint32_t uFiller; 44 } UVMCPU; 37 45 38 46 /** … … 94 102 } stam; 95 103 104 /* Per virtual CPU data. */ 105 UVMCPU aCpu[1]; 96 106 } UVM; 97 107 -
trunk/include/VBox/vm.h
r13749 r13751 93 93 PVMRC pVMRC; 94 94 /** The CPU ID. 95 * This is the index into the VM::aCpu sarray. */95 * This is the index into the VM::aCpu array. */ 96 96 VMCPUID idCpu; 97 97 /** The ring-3 thread handle of the emulation thread for this CPU. … … 283 283 */ 284 284 #ifdef VBOX_WITH_SMP_GUESTS 285 # define VMCPU_FF_SET(pVM, idCpu, fFlag) ASMAtomicOrU32(&(pVM)->aCpu s[idCpu].fForcedActions, (fFlag))285 # define VMCPU_FF_SET(pVM, idCpu, fFlag) ASMAtomicOrU32(&(pVM)->aCpu[idCpu].fForcedActions, (fFlag)) 286 286 #else 287 287 # define VMCPU_FF_SET(pVM, idCpu, fFlag) VM_FF_SET(pVM, fFlag) … … 311 311 */ 312 312 #ifdef VBOX_WITH_SMP_GUESTS 313 # define VMCPU_FF_CLEAR(pVM, idCpu, fFlag) ASMAtomicAndU32(&(pVM)->aCpu s[idCpu].fForcedActions, ~(fFlag))313 # define VMCPU_FF_CLEAR(pVM, idCpu, fFlag) ASMAtomicAndU32(&(pVM)->aCpu[idCpu].fForcedActions, ~(fFlag)) 314 314 #else 315 315 # define VMCPU_FF_CLEAR(pVM, idCpu, fFlag) VM_FF_CLEAR(pVM, fFlag) … … 332 332 */ 333 333 #ifdef VBOX_WITH_SMP_GUESTS 334 # define VMCPU_FF_ISSET(pVM, idCpu, fFlag) (((pVM)->aCpu s[idCpu].fForcedActions & (fFlag)) == (fFlag))334 # define VMCPU_FF_ISSET(pVM, idCpu, fFlag) (((pVM)->aCpu[idCpu].fForcedActions & (fFlag)) == (fFlag)) 335 335 #else 336 336 # define VMCPU_FF_ISSET(pVM, idCpu, fFlag) VM_FF_ISSET(pVM, fFlag) … … 353 353 */ 354 354 #ifdef VBOX_WITH_SMP_GUESTS 355 # define VMCPU_FF_ISPENDING(pVM, idCpu, fFlags) ((pVM)->aCpu s[idCpu].fForcedActions & (fFlags))355 # define VMCPU_FF_ISPENDING(pVM, idCpu, fFlags) ((pVM)->aCpu[idCpu].fForcedActions & (fFlags)) 356 356 #else 357 357 # define VMCPU_FF_ISPENDING(pVM, idCpu, fFlags) VM_FF_ISPENDING(pVM, fFlags) … … 775 775 776 776 /** VMCPU array for the configured number of virtual CPUs. */ 777 VMCPU aCpu s[1];777 VMCPU aCpu[1]; 778 778 } VM; 779 779 -
trunk/src/VBox/VMM/MMHyper.cpp
r13749 r13751 105 105 * Map the VM structure into the hypervisor space. 106 106 */ 107 AssertRelease(pVM->cbSelf == RT_OFFSETOF(VM, aCpu s[pVM->cCPUs]));107 AssertRelease(pVM->cbSelf == RT_OFFSETOF(VM, aCpu[pVM->cCPUs])); 108 108 109 109 RTGCPTR GCPtr; … … 114 114 pVM->pVMGC = pVM->pVMRC; 115 115 for (uint32_t i = 0; i < pVM->cCPUs; i++) 116 pVM->aCpu s[i].pVMRC = pVM->pVMRC;116 pVM->aCpu[i].pVMRC = pVM->pVMRC; 117 117 118 118 /* Reserve a page for fencing. */ … … 293 293 pVM->pVMGC = pVM->pVMRC; 294 294 for (uint32_t i = 0; i < pVM->cCPUs; i++) 295 pVM->aCpu s[i].pVMRC = pVM->pVMRC;295 pVM->aCpu[i].pVMRC = pVM->pVMRC; 296 296 297 297 pVM->mm.s.pvHyperAreaGC += offDelta; -
trunk/src/VBox/VMM/VM.cpp
r13749 r13751 124 124 * Internal Functions * 125 125 *******************************************************************************/ 126 static int vmR3CreateUVM( PUVM *ppUVM);126 static int vmR3CreateUVM(uint32_t cCPUs, PUVM *ppUVM); 127 127 static int vmR3CreateU(PUVM pUVM, uint32_t cCPUs, PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM); 128 128 static int vmR3InitRing3(PVM pVM, PUVM pUVM); … … 212 212 */ 213 213 PUVM pUVM; 214 int rc = vmR3CreateUVM( &pUVM);214 int rc = vmR3CreateUVM(cCPUs, &pUVM); 215 215 if (RT_FAILURE(rc)) 216 216 return rc; … … 363 363 * 364 364 * @returns VBox status code. 365 * @param cCPUs Number of virtual CPUs 365 366 * @param ppUVM Where to store the UVM pointer. 366 367 */ 367 static int vmR3CreateUVM( PUVM *ppUVM)368 static int vmR3CreateUVM(uint32_t cCPUs, PUVM *ppUVM) 368 369 { 369 370 /* … … 371 372 * and start the emulation thread (EMT). 372 373 */ 373 PUVM pUVM = (PUVM)RTMemAllocZ( sizeof(*pUVM));374 PUVM pUVM = (PUVM)RTMemAllocZ(RT_OFFSETOF(UVM, aCpu[cCPUs])); 374 375 AssertReturn(pUVM, VERR_NO_MEMORY); 375 376 pUVM->u32Magic = UVM_MAGIC; … … 463 464 */ 464 465 pVM->pUVM = pUVM; 465 pVM->ThreadEMT = pVM->aCpu s[0].hThreadR3 = pUVM->vm.s.ThreadEMT;466 pVM->NativeThreadEMT = pVM->aCpu s[0].hNativeThreadR3 = pUVM->vm.s.NativeThreadEMT;466 pVM->ThreadEMT = pVM->aCpu[0].hThreadR3 = pUVM->vm.s.ThreadEMT; 467 pVM->NativeThreadEMT = pVM->aCpu[0].hNativeThreadR3 = pUVM->vm.s.NativeThreadEMT; 467 468 468 469 /* … … 485 486 486 487 /* Calculate the offset to the VMCPU array. */ 487 pVM->offVMCPU = RT_OFFSETOF(VM, aCpu s);488 pVM->offVMCPU = RT_OFFSETOF(VM, aCpu); 488 489 489 490 /* Make sure the CPU count in the config data matches. */ -
trunk/src/VBox/VMM/VMMR0/GVMMR0.cpp
r13749 r13751 575 575 * Allocate the shared VM structure and associated page array. 576 576 */ 577 const size_t cbVM = RT_OFFSETOF(VM, aCpu s[cCPUs]);577 const size_t cbVM = RT_OFFSETOF(VM, aCpu[cCPUs]); 578 578 const size_t cPages = RT_ALIGN(cbVM, PAGE_SIZE) >> PAGE_SHIFT; 579 579 rc = RTR0MemObjAllocLow(&pGVM->gvmm.s.VMMemObj, cPages << PAGE_SHIFT, false /* fExecutable */); … … 612 612 for (unsigned i=0;i<cCPUs;i++) 613 613 { 614 pVM->aCpu s[i].pVMR0 = pVM;615 pVM->aCpu s[i].pVMR3 = pVM->pVMR3;614 pVM->aCpu[i].pVMR0 = pVM; 615 pVM->aCpu[i].pVMR3 = pVM->pVMR3; 616 616 } 617 617 -
trunk/src/VBox/VMM/testcase/tstVMStructSize.cpp
r13742 r13751 173 173 CHECK_MEMBER_ALIGNMENT(VM, rem.s.StatsInQEMU, 8); 174 174 CHECK_MEMBER_ALIGNMENT(VM, rem.s.Env, 32); 175 CHECK_MEMBER_ALIGNMENT(VM, aCpu s, 64);175 CHECK_MEMBER_ALIGNMENT(VM, aCpu, 64); 176 176 177 177 /* vmcpu */
Note:
See TracChangeset
for help on using the changeset viewer.