VirtualBox

Ignore:
Timestamp:
Jul 22, 2013 2:34:36 PM (11 years ago)
Author:
vboxsync
Message:

IEM: Implemented mfence, lfence, sfence.

File:
1 edited

Legend:

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

    r44529 r47307  
    2121#define LOG_GROUP LOG_GROUP_EM
    2222#include <VBox/vmm/iem.h>
     23#include <VBox/vmm/cpum.h>
    2324#include "IEMInternal.h"
    2425#include <VBox/vmm/vm.h>
    2526#include <VBox/err.h>
    2627
     28#include <iprt/asm-amd64-x86.h>
    2729#include <iprt/assert.h>
    2830
    2931
     32
     33/**
     34 * Initializes the interpreted execution manager.
     35 *
     36 * This must be called after CPUM as we're quering information from CPUM about
     37 * the guest and host CPUs.
     38 *
     39 * @returns VBox status code.
     40 * @param   pVM                 The cross context VM structure.
     41 */
    3042VMMR3DECL(int)      IEMR3Init(PVM pVM)
    3143{
     
    3951        pVCpu->iem.s.pCtxRC   = VM_RC_ADDR(pVM, pVCpu->iem.s.pCtxR3);
    4052
    41         STAMR3RegisterF(pVM, &pVCpu->iem.s.cInstructions,               STAMTYPE_U32,       STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     53        STAMR3RegisterF(pVM, &pVCpu->iem.s.cInstructions,             STAMTYPE_U32,       STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
    4254                        "Instructions interpreted",          "/IEM/CPU%u/cInstructions", idCpu);
    43         STAMR3RegisterF(pVM, &pVCpu->iem.s.cPotentialExits,             STAMTYPE_U32,       STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     55        STAMR3RegisterF(pVM, &pVCpu->iem.s.cPotentialExits,           STAMTYPE_U32,       STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
    4456                        "Potential exists",                  "/IEM/CPU%u/cPotentialExits", idCpu);
    45         STAMR3RegisterF(pVM, &pVCpu->iem.s.cRetAspectNotImplemented,    STAMTYPE_U32_RESET, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     57        STAMR3RegisterF(pVM, &pVCpu->iem.s.cRetAspectNotImplemented,  STAMTYPE_U32_RESET, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
    4658                        "VERR_IEM_ASPECT_NOT_IMPLEMENTED",   "/IEM/CPU%u/cRetAspectNotImplemented", idCpu);
    47         STAMR3RegisterF(pVM, &pVCpu->iem.s.cRetInstrNotImplemented,     STAMTYPE_U32_RESET, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     59        STAMR3RegisterF(pVM, &pVCpu->iem.s.cRetInstrNotImplemented,   STAMTYPE_U32_RESET, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
    4860                        "VERR_IEM_INSTR_NOT_IMPLEMENTED",    "/IEM/CPU%u/cRetInstrNotImplemented", idCpu);
    49         STAMR3RegisterF(pVM, &pVCpu->iem.s.cRetInfStatuses,             STAMTYPE_U32_RESET, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     61        STAMR3RegisterF(pVM, &pVCpu->iem.s.cRetInfStatuses,           STAMTYPE_U32_RESET, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
    5062                        "Informational statuses returned",   "/IEM/CPU%u/cRetInfStatuses", idCpu);
    51         STAMR3RegisterF(pVM, &pVCpu->iem.s.cRetErrStatuses,             STAMTYPE_U32_RESET, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     63        STAMR3RegisterF(pVM, &pVCpu->iem.s.cRetErrStatuses,           STAMTYPE_U32_RESET, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
    5264                        "Error statuses returned",           "/IEM/CPU%u/cRetErrStatuses", idCpu);
    53         STAMR3RegisterF(pVM, &pVCpu->iem.s.cbWritten,                   STAMTYPE_U32,       STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES,
     65        STAMR3RegisterF(pVM, &pVCpu->iem.s.cbWritten,                 STAMTYPE_U32,       STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES,
    5466                        "Approx bytes written",              "/IEM/CPU%u/cbWritten", idCpu);
     67
     68        /*
     69         * Host and guest CPU information.
     70         */
     71        if (idCpu == 0)
     72        {
     73            uint32_t uIgnored;
     74            CPUMGetGuestCpuId(pVCpu, 1, &uIgnored, &uIgnored,
     75                              &pVCpu->iem.s.fCpuIdStdFeaturesEcx, &pVCpu->iem.s.fCpuIdStdFeaturesEdx);
     76            pVCpu->iem.s.enmCpuVendor             = CPUMGetGuestCpuVendor(pVM);
     77
     78            ASMCpuId_ECX_EDX(1, &pVCpu->iem.s.fHostCpuIdStdFeaturesEcx, &pVCpu->iem.s.fHostCpuIdStdFeaturesEdx);
     79            pVCpu->iem.s.enmHostCpuVendor         = CPUMGetHostCpuVendor(pVM);
     80        }
     81        else
     82        {
     83            pVCpu->iem.s.fCpuIdStdFeaturesEcx     = pVM->aCpus[0].iem.s.fCpuIdStdFeaturesEcx;
     84            pVCpu->iem.s.fCpuIdStdFeaturesEdx     = pVM->aCpus[0].iem.s.fCpuIdStdFeaturesEdx;
     85            pVCpu->iem.s.enmCpuVendor             = pVM->aCpus[0].iem.s.enmCpuVendor;
     86            pVCpu->iem.s.fHostCpuIdStdFeaturesEcx = pVM->aCpus[0].iem.s.fHostCpuIdStdFeaturesEcx;
     87            pVCpu->iem.s.fHostCpuIdStdFeaturesEdx = pVM->aCpus[0].iem.s.fHostCpuIdStdFeaturesEdx;
     88            pVCpu->iem.s.enmHostCpuVendor         = pVM->aCpus[0].iem.s.enmHostCpuVendor;
     89        }
    5590    }
    5691    return VINF_SUCCESS;
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