- Timestamp:
- Aug 20, 2018 8:04:14 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/hm_vmx.h
r73772 r73773 3094 3094 * 3095 3095 * @param uFieldEnc VMCS field encoding. 3096 * @param u32Val 32-bit value.3096 * @param u32Val The 32-bit value to set. 3097 3097 * 3098 3098 * @remarks The values of the two status codes can be OR'ed together, the result … … 3100 3100 */ 3101 3101 #if ((RT_INLINE_ASM_EXTERNAL || !defined(RT_ARCH_X86)) && !VMX_USE_MSC_INTRINSICS) 3102 DECLASM(int) VMXWriteVmcs32(uint32_t idxField, uint32_t u32Val);3102 DECLASM(int) VMXWriteVmcs32(uint32_t uFieldEnc, uint32_t u32Val); 3103 3103 #else 3104 DECLINLINE(int) VMXWriteVmcs32(uint32_t idxField, uint32_t u32Val)3104 DECLINLINE(int) VMXWriteVmcs32(uint32_t uFieldEnc, uint32_t u32Val) 3105 3105 { 3106 3106 # if RT_INLINE_ASM_GNU_STYLE … … 3117 3117 :"=rm"(rc) 3118 3118 :"0"(VINF_SUCCESS), 3119 "a"( idxField),3119 "a"(uFieldEnc), 3120 3120 "d"(u32Val) 3121 3121 ); … … 3123 3123 3124 3124 # elif VMX_USE_MSC_INTRINSICS 3125 unsigned char rcMsc = __vmx_vmwrite( idxField, u32Val);3125 unsigned char rcMsc = __vmx_vmwrite(uFieldEnc, u32Val); 3126 3126 if (RT_LIKELY(rcMsc == 0)) 3127 3127 return VINF_SUCCESS; … … 3133 3133 { 3134 3134 push dword ptr [u32Val] 3135 mov eax, [ idxField]3135 mov eax, [uFieldEnc] 3136 3136 _emit 0x0f 3137 3137 _emit 0x79 … … 3161 3161 * @retval VERR_VMX_INVALID_VMCS_FIELD. 3162 3162 * 3163 * @param idxField VMCS index.3164 * @param u64Val 16, 32 or 64-bit value.3163 * @param uFieldEnc The VMCS field encoding. 3164 * @param u64Val The 16, 32 or 64-bit value to set. 3165 3165 * 3166 3166 * @remarks The values of the two status codes can be OR'ed together, the result … … 3169 3169 #if !defined(RT_ARCH_X86) 3170 3170 # if !VMX_USE_MSC_INTRINSICS || ARCH_BITS != 64 3171 DECLASM(int) VMXWriteVmcs64(uint32_t idxField, uint64_t u64Val);3171 DECLASM(int) VMXWriteVmcs64(uint32_t uFieldEnc, uint64_t u64Val); 3172 3172 # else /* VMX_USE_MSC_INTRINSICS */ 3173 DECLINLINE(int) VMXWriteVmcs64(uint32_t idxField, uint64_t u64Val)3174 { 3175 unsigned char rcMsc = __vmx_vmwrite( idxField, u64Val);3173 DECLINLINE(int) VMXWriteVmcs64(uint32_t uFieldEnc, uint64_t u64Val) 3174 { 3175 unsigned char rcMsc = __vmx_vmwrite(uFieldEnc, u64Val); 3176 3176 if (RT_LIKELY(rcMsc == 0)) 3177 3177 return VINF_SUCCESS; … … 3180 3180 # endif /* VMX_USE_MSC_INTRINSICS */ 3181 3181 #else 3182 # define VMXWriteVmcs64( idxField, u64Val) VMXWriteVmcs64Ex(pVCpu, idxField, u64Val) /** @todo dead ugly, picking up pVCpu like this */3183 VMMR0DECL(int) VMXWriteVmcs64Ex(PVMCPU pVCpu, uint32_t idxField, uint64_t u64Val);3182 # define VMXWriteVmcs64(uFieldEnc, u64Val) VMXWriteVmcs64Ex(pVCpu, uFieldEnc, u64Val) /** @todo dead ugly, picking up pVCpu like this */ 3183 VMMR0DECL(int) VMXWriteVmcs64Ex(PVMCPU pVCpu, uint32_t uFieldEnc, uint64_t u64Val); 3184 3184 #endif 3185 3185 3186 3186 #if ARCH_BITS == 32 3187 3187 # define VMXWriteVmcsHstN VMXWriteVmcs32 3188 # define VMXWriteVmcsGstN( idxField, u64Val) VMXWriteVmcs64Ex(pVCpu, idxField, u64Val)3188 # define VMXWriteVmcsGstN(uFieldEnc, u64Val) VMXWriteVmcs64Ex(pVCpu, uFieldEnc, u64Val) 3189 3189 #else /* ARCH_BITS == 64 */ 3190 3190 # define VMXWriteVmcsHstN VMXWriteVmcs64 … … 3214 3214 3215 3215 /** 3216 * Executes VMREAD .3216 * Executes VMREAD for a 32-bit field. 3217 3217 * 3218 3218 * @returns VBox status code. … … 3221 3221 * @retval VERR_VMX_INVALID_VMCS_FIELD. 3222 3222 * 3223 * @param idxField VMCS index.3224 * @param pData Where to store VM field value.3223 * @param uFieldEnc The VMCS field encoding. 3224 * @param pData Where to store VMCS field value. 3225 3225 * 3226 3226 * @remarks The values of the two status codes can be OR'ed together, the result … … 3228 3228 */ 3229 3229 #if ((RT_INLINE_ASM_EXTERNAL || !defined(RT_ARCH_X86)) && !VMX_USE_MSC_INTRINSICS) 3230 DECLASM(int) VMXReadVmcs32(uint32_t idxField, uint32_t *pData);3230 DECLASM(int) VMXReadVmcs32(uint32_t uFieldEnc, uint32_t *pData); 3231 3231 #else 3232 DECLINLINE(int) VMXReadVmcs32(uint32_t idxField, uint32_t *pData)3232 DECLINLINE(int) VMXReadVmcs32(uint32_t uFieldEnc, uint32_t *pData) 3233 3233 { 3234 3234 # if RT_INLINE_ASM_GNU_STYLE … … 3246 3246 :"=&r"(rc), 3247 3247 "=d"(*pData) 3248 :"a"( idxField),3248 :"a"(uFieldEnc), 3249 3249 "d"(0) 3250 3250 ); … … 3254 3254 unsigned char rcMsc; 3255 3255 # if ARCH_BITS == 32 3256 rcMsc = __vmx_vmread( idxField, pData);3256 rcMsc = __vmx_vmread(uFieldEnc, pData); 3257 3257 # else 3258 3258 uint64_t u64Tmp; 3259 rcMsc = __vmx_vmread( idxField, &u64Tmp);3259 rcMsc = __vmx_vmread(uFieldEnc, &u64Tmp); 3260 3260 *pData = (uint32_t)u64Tmp; 3261 3261 # endif … … 3270 3270 sub esp, 4 3271 3271 mov dword ptr [esp], 0 3272 mov eax, [ idxField]3272 mov eax, [uFieldEnc] 3273 3273 _emit 0x0f 3274 3274 _emit 0x78 … … 3292 3292 3293 3293 /** 3294 * Executes VMREAD .3294 * Executes VMREAD for a 64-bit field. 3295 3295 * 3296 3296 * @returns VBox status code. … … 3299 3299 * @retval VERR_VMX_INVALID_VMCS_FIELD. 3300 3300 * 3301 * @param idxField VMCS index.3302 * @param pData Where to store VM field value.3301 * @param uFieldEnc The VMCS field encoding. 3302 * @param pData Where to store VMCS field value. 3303 3303 * 3304 3304 * @remarks The values of the two status codes can be OR'ed together, the result … … 3306 3306 */ 3307 3307 #if (!defined(RT_ARCH_X86) && !VMX_USE_MSC_INTRINSICS) 3308 DECLASM(int) VMXReadVmcs64(uint32_t idxField, uint64_t *pData);3308 DECLASM(int) VMXReadVmcs64(uint32_t uFieldEnc, uint64_t *pData); 3309 3309 #else 3310 DECLINLINE(int) VMXReadVmcs64(uint32_t idxField, uint64_t *pData)3310 DECLINLINE(int) VMXReadVmcs64(uint32_t uFieldEnc, uint64_t *pData) 3311 3311 { 3312 3312 # if VMX_USE_MSC_INTRINSICS … … 3315 3315 size_t uLow; 3316 3316 size_t uHigh; 3317 rcMsc = __vmx_vmread( idxField, &uLow);3318 rcMsc |= __vmx_vmread( idxField+ 1, &uHigh);3317 rcMsc = __vmx_vmread(uFieldEnc, &uLow); 3318 rcMsc |= __vmx_vmread(uFieldEnc + 1, &uHigh); 3319 3319 *pData = RT_MAKE_U64(uLow, uHigh); 3320 3320 # else 3321 rcMsc = __vmx_vmread( idxField, pData);3321 rcMsc = __vmx_vmread(uFieldEnc, pData); 3322 3322 # endif 3323 3323 if (RT_LIKELY(rcMsc == 0)) … … 3328 3328 int rc; 3329 3329 uint32_t val_hi, val; 3330 rc = VMXReadVmcs32( idxField, &val);3331 rc |= VMXReadVmcs32( idxField+ 1, &val_hi);3330 rc = VMXReadVmcs32(uFieldEnc, &val); 3331 rc |= VMXReadVmcs32(uFieldEnc + 1, &val_hi); 3332 3332 AssertRC(rc); 3333 3333 *pData = RT_MAKE_U64(val, val_hi);
Note:
See TracChangeset
for help on using the changeset viewer.