VirtualBox

Changeset 101104 in vbox


Ignore:
Timestamp:
Sep 13, 2023 11:43:30 AM (18 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
159073
Message:

VMM/NEMR3Native-darwin-armv8.cpp: Use the CPUMIDREGS structure to query the host ID registers and pass them on to CPUM for configuration, bugre:10525 bugref:10390

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/NEMR3Native-darwin-armv8.cpp

    r100764 r101104  
    3636#define LOG_GROUP LOG_GROUP_NEM
    3737#define VMCPU_INCL_CPUM_GST_CTX
    38 #define CPUM_WITH_NONCONST_HOST_FEATURES /* required for initializing parts of the g_CpumHostFeatures structure here. */
    3938#include <VBox/vmm/nem.h>
    4039#include <VBox/vmm/iem.h>
     
    280279} s_aIdRegs[] =
    281280{
    282     { HV_FEATURE_REG_ID_AA64DFR0_EL1,       RT_UOFFSETOF(HVIDREGS, u64IdDfReg0El1)  },
    283     { HV_FEATURE_REG_ID_AA64DFR1_EL1,       RT_UOFFSETOF(HVIDREGS, u64IdDfReg1El1)  },
    284     { HV_FEATURE_REG_ID_AA64ISAR0_EL1,      RT_UOFFSETOF(HVIDREGS, u64IdIsaReg0El1) },
    285     { HV_FEATURE_REG_ID_AA64ISAR1_EL1,      RT_UOFFSETOF(HVIDREGS, u64IdIsaReg1El1) },
    286     { HV_FEATURE_REG_ID_AA64MMFR0_EL1,      RT_UOFFSETOF(HVIDREGS, u64IdMmfReg0El1) },
    287     { HV_FEATURE_REG_ID_AA64MMFR1_EL1,      RT_UOFFSETOF(HVIDREGS, u64IdMmfReg1El1) },
    288     { HV_FEATURE_REG_ID_AA64MMFR2_EL1,      RT_UOFFSETOF(HVIDREGS, u64IdPfReg0El1)  },
    289     { HV_FEATURE_REG_ID_AA64PFR0_EL1,       RT_UOFFSETOF(HVIDREGS, u64IdPfReg1El1)  },
    290     { HV_FEATURE_REG_ID_AA64PFR1_EL1,       RT_UOFFSETOF(HVIDREGS, u64ClidrEl1)     },
    291     { HV_FEATURE_REG_CLIDR_EL1,             RT_UOFFSETOF(HVIDREGS, u64CtrEl0)       },
    292     { HV_FEATURE_REG_CTR_EL0,               RT_UOFFSETOF(HVIDREGS, u64DczidEl1)     },
     281    { HV_FEATURE_REG_ID_AA64DFR0_EL1,       RT_UOFFSETOF(CPUMIDREGS, u64RegIdAa64Dfr0El1)  },
     282    { HV_FEATURE_REG_ID_AA64DFR1_EL1,       RT_UOFFSETOF(CPUMIDREGS, u64RegIdAa64Dfr1El1)  },
     283    { HV_FEATURE_REG_ID_AA64ISAR0_EL1,      RT_UOFFSETOF(CPUMIDREGS, u64RegIdAa64Isar0El1) },
     284    { HV_FEATURE_REG_ID_AA64ISAR1_EL1,      RT_UOFFSETOF(CPUMIDREGS, u64RegIdAa64Isar1El1) },
     285    { HV_FEATURE_REG_ID_AA64MMFR0_EL1,      RT_UOFFSETOF(CPUMIDREGS, u64RegIdAa64Mmfr0El1) },
     286    { HV_FEATURE_REG_ID_AA64MMFR1_EL1,      RT_UOFFSETOF(CPUMIDREGS, u64RegIdAa64Mmfr1El1) },
     287    { HV_FEATURE_REG_ID_AA64MMFR2_EL1,      RT_UOFFSETOF(CPUMIDREGS, u64RegIdAa64Mmfr2El1) },
     288    { HV_FEATURE_REG_ID_AA64PFR0_EL1,       RT_UOFFSETOF(CPUMIDREGS, u64RegIdAa64Pfr0El1)  },
     289    { HV_FEATURE_REG_ID_AA64PFR1_EL1,       RT_UOFFSETOF(CPUMIDREGS, u64RegIdAa64Pfr1El1)  },
     290    { HV_FEATURE_REG_CLIDR_EL1,             RT_UOFFSETOF(CPUMIDREGS, u64RegClidrEl1)       },
     291    { HV_FEATURE_REG_CTR_EL0,               RT_UOFFSETOF(CPUMIDREGS, u64RegCtrEl0)         },
     292    { HV_FEATURE_REG_DCZID_EL0,             RT_UOFFSETOF(CPUMIDREGS, u64RegDczidEl0)       }
    293293};
    294294
     
    811811                              "Call to hv_vcpu_config_create failed on vCPU %u", idCpu);
    812812
     813        /* Query ID registers and hand them to CPUM. */
     814        CPUMIDREGS IdRegs;
    813815        for (uint32_t i = 0; i < RT_ELEMENTS(s_aIdRegs); i++)
    814816        {
    815             uint64_t *pu64 = (uint64_t *)((uint8_t *)&pVM->nem.s.IdRegs + s_aIdRegs[i].offIdStruct);
     817            uint64_t *pu64 = (uint64_t *)((uint8_t *)&IdRegs + s_aIdRegs[i].offIdStruct);
    816818            hv_return_t hrc = hv_vcpu_config_get_feature_reg(pVM->nem.s.hVCpuCfg, s_aIdRegs[i].enmHvReg, pu64);
    817819            if (hrc != HV_SUCCESS)
     
    819821                                  "Call to hv_vcpu_get_feature_reg(, %#x, ) failed: %#x (%Rrc)", hrc, nemR3DarwinHvSts2Rc(hrc));
    820822        }
     823
     824        int rc = CPUMR3PopulateFeaturesByIdRegisters(pVM, &IdRegs);
     825        if (RT_FAILURE(rc))
     826            return rc;
    821827    }
    822828
  • trunk/src/VBox/VMM/include/NEMInternal.h

    r100708 r101104  
    156156/** Pointer to a MMIO2 tracking region. */
    157157typedef NEMHVMMIO2REGION *PNEMHVMMIO2REGION;
    158 
    159 /**
    160  * Hypervisor.framework ARMv8 ID registers.
    161  */
    162 typedef struct HVIDREGS
    163 {
    164     uint64_t                    u64IdDfReg0El1;
    165     uint64_t                    u64IdDfReg1El1;
    166     uint64_t                    u64IdIsaReg0El1;
    167     uint64_t                    u64IdIsaReg1El1;
    168     uint64_t                    u64IdMmfReg0El1;
    169     uint64_t                    u64IdMmfReg1El1;
    170     uint64_t                    u64IdPfReg0El1;
    171     uint64_t                    u64IdPfReg1El1;
    172     uint64_t                    u64ClidrEl1;
    173     uint64_t                    u64CtrEl0;
    174     uint64_t                    u64DczidEl1;
    175 } HVIDREGS;
    176 /** Pointer to the ID registers struct. */
    177 typedef HVIDREGS *PHVIDREGS;
    178 /** Pointer to the const ID registers struct. */
    179 typedef const HVIDREGS *PCHVIDREGS;
    180158# endif
    181159
     
    337315    /** The vCPU config. */
    338316    hv_vcpu_config_t            hVCpuCfg;
    339     /** The ID registers. */
    340     HVIDREGS                    IdRegs;
    341317    /** @} */
    342318# else
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette