Changeset 47307 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Jul 22, 2013 2:34:36 PM (12 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r47291 r47307 303 303 304 304 /** 305 * Checks if an Intel CPUID feature is present in the host CPU. 306 */ 307 #define IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX_ON_HOST(a_fEdx) \ 308 ( (a_fEdx) & pIemCpu->fHostCpuIdStdFeaturesEdx ) 309 310 /** 305 311 * Evaluates to true if we're presenting an Intel CPU to the guest. 306 312 */ 307 #define IEM_IS_GUEST_CPU_INTEL(a_pIemCpu) (true) /** @todo determin this once and store it the CPU structure */313 #define IEM_IS_GUEST_CPU_INTEL(a_pIemCpu) ( (a_pIemCpu)->enmCpuVendor == CPUMCPUVENDOR_INTEL ) 308 314 309 315 /** 310 316 * Evaluates to true if we're presenting an AMD CPU to the guest. 311 317 */ 312 #define IEM_IS_GUEST_CPU_AMD(a_pIemCpu) (false) /** @todo determin this once and store it the CPU structure */318 #define IEM_IS_GUEST_CPU_AMD(a_pIemCpu) ( (a_pIemCpu)->enmCpuVendor == CPUMCPUVENDOR_AMD ) 313 319 314 320 /** … … 7012 7018 IEM_MC_RETURN_ON_FAILURE(iemOpHlpCalcRmEffAddr(pIemCpu, (bRm), (cbImm), &(a_GCPtrEff))) 7013 7019 7020 #define IEM_MC_CALL_VOID_AIMPL_0(a_pfn) (a_pfn)() 7014 7021 #define IEM_MC_CALL_VOID_AIMPL_1(a_pfn, a0) (a_pfn)((a0)) 7015 7022 #define IEM_MC_CALL_VOID_AIMPL_2(a_pfn, a0, a1) (a_pfn)((a0), (a1)) -
trunk/src/VBox/VMM/VMMAll/IEMAllAImpl.asm
r47173 r47307 1035 1035 IEMIMPL_UNARY_OP neg, (X86_EFL_OF | X86_EFL_SF | X86_EFL_ZF | X86_EFL_AF | X86_EFL_PF | X86_EFL_CF), 0 1036 1036 IEMIMPL_UNARY_OP not, 0, 0 1037 1038 1039 ;; 1040 ; Macro for implementing memory fence operation. 1041 ; 1042 ; No return value, no operands or anything. 1043 ; 1044 ; @param 1 The instruction. 1045 ; 1046 %macro IEMIMPL_MEM_FENCE 1 1047 BEGINCODE 1048 BEGINPROC_FASTCALL iemAImpl_ %+ %1, 0 1049 %1 1050 ret 1051 ENDPROC iemAImpl_ %+ %1 1052 %endmacro 1053 1054 IEMIMPL_MEM_FENCE lfence 1055 IEMIMPL_MEM_FENCE sfence 1056 IEMIMPL_MEM_FENCE mfence 1057 1058 ;; 1059 ; Alternative for non-SSE2 host. 1060 ; 1061 BEGINPROC_FASTCALL iemAImpl_alt_mem_fence, 0 1062 push xAX 1063 xchg xAX, [xSP] 1064 add xSP, xCB 1065 ret 1066 ENDPROC iemAImpl_alt_mem_fence 1037 1067 1038 1068 -
trunk/src/VBox/VMM/VMMAll/IEMAllInstructions.cpp.h
r47292 r47307 1384 1384 /* The lock prefix can be used to encode CR8 accesses on some CPUs. */ 1385 1385 if (!IEM_IS_AMD_CPUID_FEATURE_PRESENT_ECX(X86_CPUID_AMD_FEATURE_ECX_CR8L)) 1386 return IEMOP_RAISE_INVALID_ LOCK_PREFIX(); /* #UD takes precedence over #GP(), see test. */1386 return IEMOP_RAISE_INVALID_OPCODE(); /* #UD takes precedence over #GP(), see test. */ 1387 1387 iCrReg |= 8; 1388 1388 } … … 1430 1430 /* The lock prefix can be used to encode CR8 accesses on some CPUs. */ 1431 1431 if (!IEM_IS_AMD_CPUID_FEATURE_PRESENT_ECX(X86_CPUID_AMD_FEATURE_ECX_CR8L)) 1432 return IEMOP_RAISE_INVALID_ LOCK_PREFIX(); /* #UD takes precedence over #GP(), see test. */1432 return IEMOP_RAISE_INVALID_OPCODE(); /* #UD takes precedence over #GP(), see test. */ 1433 1433 iCrReg |= 8; 1434 1434 } … … 3844 3844 IEMOP_HLP_NO_LOCK_PREFIX(); 3845 3845 if (!IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_FXSR)) 3846 return IEMOP_RAISE_INVALID_ LOCK_PREFIX();3846 return IEMOP_RAISE_INVALID_OPCODE(); 3847 3847 3848 3848 IEM_MC_BEGIN(3, 1); … … 3863 3863 IEMOP_HLP_NO_LOCK_PREFIX(); 3864 3864 if (!IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_FXSR)) 3865 return IEMOP_RAISE_INVALID_ LOCK_PREFIX();3865 return IEMOP_RAISE_INVALID_OPCODE(); 3866 3866 3867 3867 IEM_MC_BEGIN(3, 1); … … 3894 3894 FNIEMOP_STUB_1(iemOp_Grp15_clflush, uint8_t, bRm); 3895 3895 3896 3896 3897 /** Opcode 0x0f 0xae 11b/5. */ 3897 FNIEMOP_STUB_1(iemOp_Grp15_lfence, uint8_t, bRm); 3898 FNIEMOP_DEF_1(iemOp_Grp15_lfence, uint8_t, bRm) 3899 { 3900 IEMOP_MNEMONIC("lfence"); 3901 IEMOP_HLP_NO_LOCK_PREFIX(); 3902 if (!IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_SSE2)) 3903 return IEMOP_RAISE_INVALID_OPCODE(); 3904 3905 IEM_MC_BEGIN(0, 0); 3906 if (IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX_ON_HOST(X86_CPUID_FEATURE_EDX_SSE2)) 3907 IEM_MC_CALL_VOID_AIMPL_0(iemAImpl_lfence); 3908 else 3909 IEM_MC_CALL_VOID_AIMPL_0(iemAImpl_alt_mem_fence); 3910 IEM_MC_ADVANCE_RIP(); 3911 IEM_MC_END(); 3912 return VINF_SUCCESS; 3913 } 3914 3898 3915 3899 3916 /** Opcode 0x0f 0xae 11b/6. */ 3900 FNIEMOP_STUB_1(iemOp_Grp15_mfence, uint8_t, bRm); 3917 FNIEMOP_DEF_1(iemOp_Grp15_mfence, uint8_t, bRm) 3918 { 3919 IEMOP_MNEMONIC("mfence"); 3920 IEMOP_HLP_NO_LOCK_PREFIX(); 3921 if (!IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_SSE2)) 3922 return IEMOP_RAISE_INVALID_OPCODE(); 3923 3924 IEM_MC_BEGIN(0, 0); 3925 if (IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX_ON_HOST(X86_CPUID_FEATURE_EDX_SSE2)) 3926 IEM_MC_CALL_VOID_AIMPL_0(iemAImpl_mfence); 3927 else 3928 IEM_MC_CALL_VOID_AIMPL_0(iemAImpl_alt_mem_fence); 3929 IEM_MC_ADVANCE_RIP(); 3930 IEM_MC_END(); 3931 return VINF_SUCCESS; 3932 } 3933 3901 3934 3902 3935 /** Opcode 0x0f 0xae 11b/7. */ 3903 FNIEMOP_STUB_1(iemOp_Grp15_sfence, uint8_t, bRm); 3936 FNIEMOP_DEF_1(iemOp_Grp15_sfence, uint8_t, bRm) 3937 { 3938 IEMOP_MNEMONIC("sfence"); 3939 IEMOP_HLP_NO_LOCK_PREFIX(); 3940 if (!IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_SSE2)) 3941 return IEMOP_RAISE_INVALID_OPCODE(); 3942 3943 IEM_MC_BEGIN(0, 0); 3944 if (IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX_ON_HOST(X86_CPUID_FEATURE_EDX_SSE2)) 3945 IEM_MC_CALL_VOID_AIMPL_0(iemAImpl_sfence); 3946 else 3947 IEM_MC_CALL_VOID_AIMPL_0(iemAImpl_alt_mem_fence); 3948 IEM_MC_ADVANCE_RIP(); 3949 IEM_MC_END(); 3950 return VINF_SUCCESS; 3951 } 3952 3904 3953 3905 3954 /** Opcode 0xf3 0x0f 0xae 11b/0. */ … … 8736 8785 IEMOP_HLP_NO_LOCK_PREFIX(); /** @todo should probably not be raised until we've fetched all the opcode bytes? */ 8737 8786 if ((bRm & X86_MODRM_MOD_MASK) == (3 << X86_MODRM_MOD_SHIFT)) 8738 return IEMOP_RAISE_INVALID_ LOCK_PREFIX(); /* no register form */8787 return IEMOP_RAISE_INVALID_OPCODE(); /* no register form */ 8739 8788 8740 8789 switch (pIemCpu->enmEffOpSize) … … 10439 10488 case 5: pImpl = &g_iemAImpl_shr; IEMOP_MNEMONIC("shr Eb,Ib"); break; 10440 10489 case 7: pImpl = &g_iemAImpl_sar; IEMOP_MNEMONIC("sar Eb,Ib"); break; 10441 case 6: return IEMOP_RAISE_INVALID_ LOCK_PREFIX();10490 case 6: return IEMOP_RAISE_INVALID_OPCODE(); 10442 10491 IEM_NOT_REACHED_DEFAULT_CASE_RET(); /* gcc maybe stupid */ 10443 10492 } … … 10499 10548 case 5: pImpl = &g_iemAImpl_shr; IEMOP_MNEMONIC("shr Ev,Ib"); break; 10500 10549 case 7: pImpl = &g_iemAImpl_sar; IEMOP_MNEMONIC("sar Ev,Ib"); break; 10501 case 6: return IEMOP_RAISE_INVALID_ LOCK_PREFIX();10550 case 6: return IEMOP_RAISE_INVALID_OPCODE(); 10502 10551 IEM_NOT_REACHED_DEFAULT_CASE_RET(); /* gcc maybe stupid */ 10503 10552 } … … 10870 10919 case 5: pImpl = &g_iemAImpl_shr; IEMOP_MNEMONIC("shr Eb,1"); break; 10871 10920 case 7: pImpl = &g_iemAImpl_sar; IEMOP_MNEMONIC("sar Eb,1"); break; 10872 case 6: return IEMOP_RAISE_INVALID_ LOCK_PREFIX();10921 case 6: return IEMOP_RAISE_INVALID_OPCODE(); 10873 10922 IEM_NOT_REACHED_DEFAULT_CASE_RET(); /* gcc maybe, well... */ 10874 10923 } … … 10928 10977 case 5: pImpl = &g_iemAImpl_shr; IEMOP_MNEMONIC("shr Ev,1"); break; 10929 10978 case 7: pImpl = &g_iemAImpl_sar; IEMOP_MNEMONIC("sar Ev,1"); break; 10930 case 6: return IEMOP_RAISE_INVALID_ LOCK_PREFIX();10979 case 6: return IEMOP_RAISE_INVALID_OPCODE(); 10931 10980 IEM_NOT_REACHED_DEFAULT_CASE_RET(); /* gcc maybe, well... */ 10932 10981 }
Note:
See TracChangeset
for help on using the changeset viewer.