VirtualBox

Changeset 101104 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Sep 13, 2023 11:43:30 AM (16 months ago)
Author:
vboxsync
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

File:
1 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
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