return true;
}
-static bool vmx_get_guest_bndcfgs(const struct vcpu *cv, u64 *val)
+static bool vmx_get_guest_bndcfgs(struct vcpu *v, u64 *val)
{
- /* Get a non-const pointer for vmx_vmcs_enter() */
- struct vcpu *v = cv->domain->vcpu[cv->vcpu_id];
-
ASSERT(cpu_has_mpx && cpu_has_vmx_mpx);
vmx_vmcs_enter(v);
return 0;
}
-int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
+int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
{
const struct vcpu *curr = current;
const struct domain *d = v->domain;
break;
case MSR_IA32_BNDCFGS:
- if ( !cp->feat.mpx )
+ if ( !cp->feat.mpx || !is_hvm_domain(d) ||
+ !hvm_get_guest_bndcfgs(v, val) )
goto gp_fault;
-
- ASSERT(is_hvm_domain(d));
- if (!hvm_get_guest_bndcfgs(v, val) )
- goto gp_fault;
-
break;
case MSR_IA32_XSS:
break;
case MSR_IA32_BNDCFGS:
- if ( !cp->feat.mpx )
+ if ( !cp->feat.mpx || !is_hvm_domain(d) ||
+ !hvm_set_guest_bndcfgs(v, val) )
goto gp_fault;
-
- ASSERT(is_hvm_domain(d));
- if ( !hvm_set_guest_bndcfgs(v, val) )
- goto gp_fault;
-
break;
case MSR_IA32_XSS:
static int read_msr(unsigned int reg, uint64_t *val,
struct x86_emulate_ctxt *ctxt)
{
- const struct vcpu *curr = current;
+ struct vcpu *curr = current;
const struct domain *currd = curr->domain;
bool vpmu_msr = false;
int ret;
int (*get_guest_pat)(struct vcpu *v, u64 *);
int (*set_guest_pat)(struct vcpu *v, u64);
- bool (*get_guest_bndcfgs)(const struct vcpu *v, u64 *);
+ bool (*get_guest_bndcfgs)(struct vcpu *v, u64 *);
bool (*set_guest_bndcfgs)(struct vcpu *v, u64);
void (*set_tsc_offset)(struct vcpu *v, u64 offset, u64 at_tsc);
return hvm_funcs.get_shadow_gs_base(v);
}
-static inline bool hvm_get_guest_bndcfgs(const struct vcpu *v, u64 *val)
+static inline bool hvm_get_guest_bndcfgs(struct vcpu *v, u64 *val)
{
return hvm_funcs.get_guest_bndcfgs &&
hvm_funcs.get_guest_bndcfgs(v, val);
void hvm_set_info_guest(struct vcpu *v);
void hvm_cpuid_policy_changed(struct vcpu *v);
void hvm_set_tsc_offset(struct vcpu *v, uint64_t offset, uint64_t at_tsc);
+bool hvm_get_guest_bndcfgs(struct vcpu *v, uint64_t *val);
/* End of prototype list */
};
} misc_features_enables;
+ /* 0x00000da0 - MSR_IA32_XSS */
+ struct {
+ uint64_t raw;
+ } xss;
+
/*
* 0xc0000103 - MSR_TSC_AUX
*
* values here may be stale in current context.
*/
uint32_t dr_mask[4];
-
- /* 0x00000da0 - MSR_IA32_XSS */
- struct {
- uint64_t raw;
- } xss;
};
void init_guest_msr_policy(void);
* These functions are also used by the migration logic, so need to cope with
* being used outside of v's context.
*/
-int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val);
+int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val);
int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val);
#endif /* !__ASSEMBLY__ */