@@ -277,7 +277,9 @@ int vcpu_init_fpu(struct vcpu *v)
}
else
{
- v->arch.fpu_ctxt = _xzalloc(sizeof(v->arch.xsave_area->fpu_sse), 16);
+ BUILD_BUG_ON(__alignof(v->arch.xsave_area->fpu_sse) < 16);
+ v->arch.fpu_ctxt = _xzalloc(sizeof(v->arch.xsave_area->fpu_sse),
+ __alignof(v->arch.xsave_area->fpu_sse));
if ( v->arch.fpu_ctxt )
{
typeof(v->arch.xsave_area->fpu_sse) *fpu_sse = v->arch.fpu_ctxt;
@@ -414,7 +414,8 @@ int xstate_alloc_save_area(struct vcpu *
BUG_ON(xsave_cntxt_size < XSTATE_AREA_MIN_SIZE);
/* XSAVE/XRSTOR requires the save area be 64-byte-boundary aligned. */
- save_area = _xzalloc(xsave_cntxt_size, 64);
+ BUILD_BUG_ON(__alignof(*save_area) < 64);
+ save_area = _xzalloc(xsave_cntxt_size, __alignof(*save_area));
if ( save_area == NULL )
return -ENOMEM;
@@ -48,9 +48,9 @@ extern u64 xfeature_mask;
extern unsigned int *xstate_sizes;
/* extended state save area */
-struct __packed __attribute__((aligned (64))) xsave_struct
+struct __attribute__((aligned (64))) xsave_struct
{
- union { /* FPU/MMX, SSE */
+ union __attribute__((aligned(16))) { /* FPU/MMX, SSE */
char x[512];
struct {
uint16_t fcw;