summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2016-03-15 15:42:53 +0000
committerkib <kib@FreeBSD.org>2016-03-15 15:42:53 +0000
commit3d336a82bd544f54ac0afe5755b36affb62c7865 (patch)
tree3ee6414e119c0b62b9b270db73ed1f0224769aee /sys/amd64
parent41527ba958fb9ed0eaba4608fbedd17108780626 (diff)
downloadFreeBSD-src-3d336a82bd544f54ac0afe5755b36affb62c7865.zip
FreeBSD-src-3d336a82bd544f54ac0afe5755b36affb62c7865.tar.gz
The PKRU state size is 4 bytes, its support makes the XSAVE area size
non-multiple of 64 bytes. Thereafter, the user state save area is misaligned, which triggers assertion in the debugging kernels, or segmentation violation on accesses for non-debugging configs. Force the desired alignment of the user save area as the fix (workaround is to disable bit 9 in the hw.xsave_mask loader tunable). This correction is required for booting on the upcoming Intel' Purley platform. Reported and tested by: "Pieper, Jeffrey E" <jeffrey.e.pieper@intel.com>, jimharris Sponsored by: The FreeBSD Foundation MFC after: 3 days
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/vm_machdep.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index 13241ac..ee6dccd 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -102,8 +102,8 @@ get_pcb_user_save_td(struct thread *td)
vm_offset_t p;
p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
- cpu_max_ext_state_size;
- KASSERT((p % 64) == 0, ("Unaligned pcb_user_save area"));
+ roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN);
+ KASSERT((p % XSAVE_AREA_ALIGN) == 0, ("Unaligned pcb_user_save area"));
return ((struct savefpu *)p);
}
@@ -122,7 +122,8 @@ get_pcb_td(struct thread *td)
vm_offset_t p;
p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
- cpu_max_ext_state_size - sizeof(struct pcb);
+ roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN) -
+ sizeof(struct pcb);
return ((struct pcb *)p);
}
OpenPOWER on IntegriCloud