/* Because XCR0 is cached for each CPU, xsetbv() is not exposed. Users should
* use set_xcr0() instead.
*/
-static inline bool_t xsetbv(u32 index, u64 xfeatures)
+static inline bool xsetbv(u32 index, u64 xfeatures)
{
u32 hi = xfeatures >> 32;
u32 lo = (u32)xfeatures;
return lo != 0;
}
-bool_t set_xcr0(u64 xfeatures)
+bool set_xcr0(u64 xfeatures)
{
if ( !xsetbv(XCR_XFEATURE_ENABLED_MASK, xfeatures) )
- return 0;
+ return false;
this_cpu(xcr0) = xfeatures;
- return 1;
+ return true;
}
uint64_t get_xcr0(void)
return this_cpu(xss);
}
-static int setup_xstate_features(bool_t bsp)
+static int setup_xstate_features(bool bsp)
{
unsigned int leaf, eax, ebx, ecx, edx;
}
}
-bool_t xsave_enabled(const struct vcpu *v)
+bool xsave_enabled(const struct vcpu *v)
{
if ( !cpu_has_xsave )
- return 0;
+ return false;
ASSERT(xsave_cntxt_size >= XSTATE_AREA_MIN_SIZE);
ASSERT(v->arch.xsave_area);
{
u64 act_xcr0 = get_xcr0();
u32 eax, ebx = 0, ecx, edx;
- bool_t ok = set_xcr0(xcr0);
+ bool ok = set_xcr0(xcr0);
ASSERT(ok);
cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx);
/* Collect the information of processor's extended state */
void xstate_init(struct cpuinfo_x86 *c)
{
- static bool_t __initdata use_xsave = 1;
+ static bool __initdata use_xsave = true;
boolean_param("xsave", use_xsave);
- bool_t bsp = c == &boot_cpu_data;
+ bool bsp = c == &boot_cpu_data;
u32 eax, ebx, ecx, edx;
u64 feature_mask;
BUG();
}
-static bool_t valid_xcr0(u64 xcr0)
+static bool valid_xcr0(u64 xcr0)
{
/* FP must be unconditionally set. */
if ( !(xcr0 & XSTATE_FP) )
- return 0;
+ return false;
/* YMM depends on SSE. */
if ( (xcr0 & XSTATE_YMM) && !(xcr0 & XSTATE_SSE) )
- return 0;
+ return false;
if ( xcr0 & (XSTATE_OPMASK | XSTATE_ZMM | XSTATE_HI_ZMM) )
{
/* OPMASK, ZMM, and HI_ZMM require YMM. */
if ( !(xcr0 & XSTATE_YMM) )
- return 0;
+ return false;
/* OPMASK, ZMM, and HI_ZMM must be the same. */
if ( ~xcr0 & (XSTATE_OPMASK | XSTATE_ZMM | XSTATE_HI_ZMM) )
- return 0;
+ return false;
}
/* BNDREGS and BNDCSR must be the same. */
};
/* extended state operations */
-bool_t __must_check set_xcr0(u64 xfeatures);
+bool __must_check set_xcr0(u64 xfeatures);
uint64_t get_xcr0(void);
void set_msr_xss(u64 xss);
uint64_t get_msr_xss(void);
void xsave(struct vcpu *v, uint64_t mask);
void xrstor(struct vcpu *v, uint64_t mask);
void xstate_set_init(uint64_t mask);
-bool_t xsave_enabled(const struct vcpu *v);
+bool xsave_enabled(const struct vcpu *v);
int __must_check validate_xstate(u64 xcr0, u64 xcr0_accum,
const struct xsave_hdr *);
int __must_check handle_xsetbv(u32 index, u64 new_bv);
void xstate_init(struct cpuinfo_x86 *c);
unsigned int xstate_ctxt_size(u64 xcr0);
-static inline bool_t xstate_all(const struct vcpu *v)
+static inline bool xstate_all(const struct vcpu *v)
{
/*
* XSTATE_FP_SSE may be excluded, because the offsets of XSTATE_FP_SSE