VirtualBox

Changeset 13751 in vbox for trunk


Ignore:
Timestamp:
Nov 3, 2008 2:53:11 PM (16 years ago)
Author:
vboxsync
Message:

UVM updates

Location:
trunk
Files:
6 edited

Legend:

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

    r8155 r13751  
    3535
    3636#include <VBox/types.h>
     37
     38/**
     39 * Per virtual CPU ring-3 (user mode) data.
     40 */
     41typedef struct UVMCPU
     42{
     43    uint32_t     uFiller;
     44} UVMCPU;
    3745
    3846/**
     
    94102    } stam;
    95103
     104    /* Per virtual CPU data. */
     105    UVMCPU                      aCpu[1];
    96106} UVM;
    97107
  • trunk/include/VBox/vm.h

    r13749 r13751  
    9393    PVMRC                   pVMRC;
    9494    /** The CPU ID.
    95      * This is the index into the VM::aCpus array. */
     95     * This is the index into the VM::aCpu array. */
    9696    VMCPUID                 idCpu;
    9797    /** The ring-3 thread handle of the emulation thread for this CPU.
     
    283283 */
    284284#ifdef VBOX_WITH_SMP_GUESTS
    285 # define VMCPU_FF_SET(pVM, idCpu, fFlag)    ASMAtomicOrU32(&(pVM)->aCpus[idCpu].fForcedActions, (fFlag))
     285# define VMCPU_FF_SET(pVM, idCpu, fFlag)    ASMAtomicOrU32(&(pVM)->aCpu[idCpu].fForcedActions, (fFlag))
    286286#else
    287287# define VMCPU_FF_SET(pVM, idCpu, fFlag)    VM_FF_SET(pVM, fFlag)
     
    311311 */
    312312#ifdef VBOX_WITH_SMP_GUESTS
    313 # define VMCPU_FF_CLEAR(pVM, idCpu, fFlag)  ASMAtomicAndU32(&(pVM)->aCpus[idCpu].fForcedActions, ~(fFlag))
     313# define VMCPU_FF_CLEAR(pVM, idCpu, fFlag)  ASMAtomicAndU32(&(pVM)->aCpu[idCpu].fForcedActions, ~(fFlag))
    314314#else
    315315# define VMCPU_FF_CLEAR(pVM, idCpu, fFlag)  VM_FF_CLEAR(pVM, fFlag)
     
    332332 */
    333333#ifdef VBOX_WITH_SMP_GUESTS
    334 # define VMCPU_FF_ISSET(pVM, idCpu, fFlag)  (((pVM)->aCpus[idCpu].fForcedActions & (fFlag)) == (fFlag))
     334# define VMCPU_FF_ISSET(pVM, idCpu, fFlag)  (((pVM)->aCpu[idCpu].fForcedActions & (fFlag)) == (fFlag))
    335335#else
    336336# define VMCPU_FF_ISSET(pVM, idCpu, fFlag)  VM_FF_ISSET(pVM, fFlag)
     
    353353 */
    354354#ifdef VBOX_WITH_SMP_GUESTS
    355 # define VMCPU_FF_ISPENDING(pVM, idCpu, fFlags) ((pVM)->aCpus[idCpu].fForcedActions & (fFlags))
     355# define VMCPU_FF_ISPENDING(pVM, idCpu, fFlags) ((pVM)->aCpu[idCpu].fForcedActions & (fFlags))
    356356#else
    357357# define VMCPU_FF_ISPENDING(pVM, idCpu, fFlags) VM_FF_ISPENDING(pVM, fFlags)
     
    775775
    776776    /** VMCPU array for the configured number of virtual CPUs. */
    777     VMCPU       aCpus[1];
     777    VMCPU       aCpu[1];
    778778} VM;
    779779
  • trunk/src/VBox/VMM/MMHyper.cpp

    r13749 r13751  
    105105         * Map the VM structure into the hypervisor space.
    106106         */
    107         AssertRelease(pVM->cbSelf == RT_OFFSETOF(VM, aCpus[pVM->cCPUs]));
     107        AssertRelease(pVM->cbSelf == RT_OFFSETOF(VM, aCpu[pVM->cCPUs]));
    108108
    109109        RTGCPTR GCPtr;
     
    114114            pVM->pVMGC = pVM->pVMRC;
    115115            for (uint32_t i = 0; i < pVM->cCPUs; i++)
    116                 pVM->aCpus[i].pVMRC = pVM->pVMRC;
     116                pVM->aCpu[i].pVMRC = pVM->pVMRC;
    117117
    118118            /* Reserve a page for fencing. */
     
    293293            pVM->pVMGC                          = pVM->pVMRC;
    294294            for (uint32_t i = 0; i < pVM->cCPUs; i++)
    295                 pVM->aCpus[i].pVMRC             = pVM->pVMRC;
     295                pVM->aCpu[i].pVMRC             = pVM->pVMRC;
    296296
    297297            pVM->mm.s.pvHyperAreaGC             += offDelta;
  • trunk/src/VBox/VMM/VM.cpp

    r13749 r13751  
    124124*   Internal Functions                                                         *
    125125*******************************************************************************/
    126 static int               vmR3CreateUVM(PUVM *ppUVM);
     126static int               vmR3CreateUVM(uint32_t cCPUs, PUVM *ppUVM);
    127127static int               vmR3CreateU(PUVM pUVM, uint32_t cCPUs, PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM);
    128128static int               vmR3InitRing3(PVM pVM, PUVM pUVM);
     
    212212     */
    213213    PUVM pUVM;
    214     int rc = vmR3CreateUVM(&pUVM);
     214    int rc = vmR3CreateUVM(cCPUs, &pUVM);
    215215    if (RT_FAILURE(rc))
    216216        return rc;
     
    363363 *
    364364 * @returns VBox status code.
     365 * @param   cCPUs   Number of virtual CPUs
    365366 * @param   ppUVM   Where to store the UVM pointer.
    366367 */
    367 static int vmR3CreateUVM(PUVM *ppUVM)
     368static int vmR3CreateUVM(uint32_t cCPUs, PUVM *ppUVM)
    368369{
    369370    /*
     
    371372     * and start the emulation thread (EMT).
    372373     */
    373     PUVM pUVM = (PUVM)RTMemAllocZ(sizeof(*pUVM));
     374    PUVM pUVM = (PUVM)RTMemAllocZ(RT_OFFSETOF(UVM, aCpu[cCPUs]));
    374375    AssertReturn(pUVM, VERR_NO_MEMORY);
    375376    pUVM->u32Magic = UVM_MAGIC;
     
    463464         */
    464465        pVM->pUVM = pUVM;
    465         pVM->ThreadEMT = pVM->aCpus[0].hThreadR3 = pUVM->vm.s.ThreadEMT;
    466         pVM->NativeThreadEMT = pVM->aCpus[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;
    467468
    468469        /*
     
    485486
    486487            /* Calculate the offset to the VMCPU array. */
    487             pVM->offVMCPU = RT_OFFSETOF(VM, aCpus);
     488            pVM->offVMCPU = RT_OFFSETOF(VM, aCpu);
    488489
    489490            /* Make sure the CPU count in the config data matches. */
  • trunk/src/VBox/VMM/VMMR0/GVMMR0.cpp

    r13749 r13751  
    575575                         * Allocate the shared VM structure and associated page array.
    576576                         */
    577                         const size_t cbVM   = RT_OFFSETOF(VM, aCpus[cCPUs]);
     577                        const size_t cbVM   = RT_OFFSETOF(VM, aCpu[cCPUs]);
    578578                        const size_t cPages = RT_ALIGN(cbVM, PAGE_SIZE) >> PAGE_SHIFT;
    579579                        rc = RTR0MemObjAllocLow(&pGVM->gvmm.s.VMMemObj, cPages << PAGE_SHIFT, false /* fExecutable */);
     
    612612                                    for (unsigned i=0;i<cCPUs;i++)
    613613                                    {
    614                                         pVM->aCpus[i].pVMR0 = pVM;
    615                                         pVM->aCpus[i].pVMR3 = pVM->pVMR3;
     614                                        pVM->aCpu[i].pVMR0 = pVM;
     615                                        pVM->aCpu[i].pVMR3 = pVM->pVMR3;
    616616                                    }
    617617
  • trunk/src/VBox/VMM/testcase/tstVMStructSize.cpp

    r13742 r13751  
    173173    CHECK_MEMBER_ALIGNMENT(VM, rem.s.StatsInQEMU, 8);
    174174    CHECK_MEMBER_ALIGNMENT(VM, rem.s.Env, 32);
    175     CHECK_MEMBER_ALIGNMENT(VM, aCpus, 64);
     175    CHECK_MEMBER_ALIGNMENT(VM, aCpu, 64);
    176176
    177177    /* vmcpu */
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