Changeset 100708 in vbox for trunk/src/VBox/VMM/VMMR3
- Timestamp:
- Jul 26, 2023 1:16:19 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/NEMR3Native-darwin-armv8.cpp
r100705 r100708 191 191 { HV_SYS_REG_TTBR1_EL1, CPUMCTX_EXTRN_SCTLR_TCR_TTBR, RT_UOFFSETOF(CPUMCTX, Ttbr1.u64) }, 192 192 { HV_SYS_REG_VBAR_EL1, CPUMCTX_EXTRN_SYSREG, RT_UOFFSETOF(CPUMCTX, VBar.u64) }, 193 }; 194 /** ID registers. */ 195 static const struct 196 { 197 hv_feature_reg_t enmHvReg; 198 uint32_t offIdStruct; 199 } s_aIdRegs[] = 200 { 201 { HV_FEATURE_REG_ID_AA64DFR0_EL1, RT_UOFFSETOF(HVIDREGS, u64IdDfReg0El1) }, 202 { HV_FEATURE_REG_ID_AA64DFR1_EL1, RT_UOFFSETOF(HVIDREGS, u64IdDfReg1El1) }, 203 { HV_FEATURE_REG_ID_AA64ISAR0_EL1, RT_UOFFSETOF(HVIDREGS, u64IdIsaReg0El1) }, 204 { HV_FEATURE_REG_ID_AA64ISAR1_EL1, RT_UOFFSETOF(HVIDREGS, u64IdIsaReg1El1) }, 205 { HV_FEATURE_REG_ID_AA64MMFR0_EL1, RT_UOFFSETOF(HVIDREGS, u64IdMmfReg0El1) }, 206 { HV_FEATURE_REG_ID_AA64MMFR1_EL1, RT_UOFFSETOF(HVIDREGS, u64IdMmfReg1El1) }, 207 { HV_FEATURE_REG_ID_AA64MMFR2_EL1, RT_UOFFSETOF(HVIDREGS, u64IdPfReg0El1) }, 208 { HV_FEATURE_REG_ID_AA64PFR0_EL1, RT_UOFFSETOF(HVIDREGS, u64IdPfReg1El1) }, 209 { HV_FEATURE_REG_ID_AA64PFR1_EL1, RT_UOFFSETOF(HVIDREGS, u64ClidrEl1) }, 210 { HV_FEATURE_REG_CLIDR_EL1, RT_UOFFSETOF(HVIDREGS, u64CtrEl0) }, 211 { HV_FEATURE_REG_CTR_EL0, RT_UOFFSETOF(HVIDREGS, u64DczidEl1) }, 193 212 }; 194 213 … … 657 676 static DECLCALLBACK(int) nemR3DarwinNativeInitVCpuOnEmt(PVM pVM, PVMCPU pVCpu, VMCPUID idCpu) 658 677 { 659 hv_return_t hrc = hv_vcpu_create(&pVCpu->nem.s.hVCpu, &pVCpu->nem.s.pHvExit, NULL); 678 if (idCpu == 0) 679 { 680 Assert(pVM->nem.s.hVCpuCfg == NULL); 681 682 /* Create a new vCPU config and query the ID registers. */ 683 pVM->nem.s.hVCpuCfg = hv_vcpu_config_create(); 684 if (!pVM->nem.s.hVCpuCfg) 685 return VMSetError(pVM, VERR_NEM_VM_CREATE_FAILED, RT_SRC_POS, 686 "Call to hv_vcpu_config_create failed on vCPU %u", idCpu); 687 688 for (uint32_t i = 0; i < RT_ELEMENTS(s_aIdRegs); i++) 689 { 690 uint64_t *pu64 = (uint64_t *)((uint8_t *)&pVM->nem.s.IdRegs + s_aIdRegs[i].offIdStruct); 691 hv_return_t hrc = hv_vcpu_config_get_feature_reg(pVM->nem.s.hVCpuCfg, s_aIdRegs[i].enmHvReg, pu64); 692 if (hrc != HV_SUCCESS) 693 return VMSetError(pVM, VERR_NEM_VM_CREATE_FAILED, RT_SRC_POS, 694 "Call to hv_vcpu_get_feature_reg(, %#x, ) failed: %#x (%Rrc)", hrc, nemR3DarwinHvSts2Rc(hrc)); 695 } 696 } 697 698 hv_return_t hrc = hv_vcpu_create(&pVCpu->nem.s.hVCpu, &pVCpu->nem.s.pHvExit, pVM->nem.s.hVCpuCfg); 660 699 if (hrc != HV_SUCCESS) 661 700 return VMSetError(pVM, VERR_NEM_VM_CREATE_FAILED, RT_SRC_POS, … … 667 706 "Setting MPIDR_EL1 failed on vCPU %u: %#x (%Rrc)", idCpu, hrc, nemR3DarwinHvSts2Rc(hrc)); 668 707 669 if (idCpu == 0)670 {671 /** @todo */672 }673 674 708 return VINF_SUCCESS; 675 709 } … … 679 713 * Worker to destroy the vCPU handle on the EMT running it later on (as required by HV). 680 714 * 681 * @returns VBox status code 715 * @returns VBox status code. 716 * @param pVM The VM handle. 682 717 * @param pVCpu The vCPU handle. 683 718 */ 684 static DECLCALLBACK(int) nemR3DarwinNativeTermVCpuOnEmt(PVM CPU pVCpu)719 static DECLCALLBACK(int) nemR3DarwinNativeTermVCpuOnEmt(PVM pVM, PVMCPU pVCpu) 685 720 { 686 721 hv_return_t hrc = hv_vcpu_destroy(pVCpu->nem.s.hVCpu); 687 722 Assert(hrc == HV_SUCCESS); RT_NOREF(hrc); 723 724 if (pVCpu->idCpu == 0) 725 { 726 os_release(pVM->nem.s.hVCpuCfg); 727 pVM->nem.s.hVCpuCfg = NULL; 728 } 688 729 return VINF_SUCCESS; 689 730 } … … 716 757 /* Rollback. */ 717 758 while (idCpu--) 718 VMR3ReqCallWait(pVM, idCpu, (PFNRT)nemR3DarwinNativeTermVCpuOnEmt, 1, pVCpu);759 VMR3ReqCallWait(pVM, idCpu, (PFNRT)nemR3DarwinNativeTermVCpuOnEmt, 2, pVM, pVCpu); 719 760 720 761 return VMSetError(pVM, VERR_NEM_VM_CREATE_FAILED, RT_SRC_POS, "Call to hv_vcpu_create failed: %Rrc", rc);
Note:
See TracChangeset
for help on using the changeset viewer.