FPU init: allocate initial state from UMA to ensure alignment
The Intel Instruction Set Reference says this about the XSAVE instruction: Use of a destination operand not aligned to 64-byte boundary (in either 64-bit or 32-bit modes) results in a general-protection (#GP) exception. This alignment happens naturally when all malloc buckets are powers of two. However, this change is necessary on some systems when certain non-power-of-two (and non-multiple of 64) malloc buckets are defined. Reviewed by: cem; kib; earlier version by jhb MFC after: 2 weeks Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D25098
This commit is contained in:
parent
701acc2fd8
commit
6fba90f201
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=362121
@ -372,8 +372,7 @@ fpuinitstate(void *arg __unused)
|
|||||||
fpu_save_area_zone = uma_zcreate("FPU_save_area",
|
fpu_save_area_zone = uma_zcreate("FPU_save_area",
|
||||||
cpu_max_ext_state_size, NULL, NULL, NULL, NULL,
|
cpu_max_ext_state_size, NULL, NULL, NULL, NULL,
|
||||||
XSAVE_AREA_ALIGN - 1, 0);
|
XSAVE_AREA_ALIGN - 1, 0);
|
||||||
fpu_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF,
|
fpu_initialstate = uma_zalloc(fpu_save_area_zone, M_WAITOK | M_ZERO);
|
||||||
M_WAITOK | M_ZERO);
|
|
||||||
if (use_xsave) {
|
if (use_xsave) {
|
||||||
max_ext_n = flsl(xsave_mask);
|
max_ext_n = flsl(xsave_mask);
|
||||||
xsave_area_desc = malloc(max_ext_n * sizeof(struct
|
xsave_area_desc = malloc(max_ext_n * sizeof(struct
|
||||||
|
@ -483,8 +483,7 @@ npxinitstate(void *arg __unused)
|
|||||||
fpu_save_area_zone = uma_zcreate("FPU_save_area",
|
fpu_save_area_zone = uma_zcreate("FPU_save_area",
|
||||||
cpu_max_ext_state_size, NULL, NULL, NULL, NULL,
|
cpu_max_ext_state_size, NULL, NULL, NULL, NULL,
|
||||||
XSAVE_AREA_ALIGN - 1, 0);
|
XSAVE_AREA_ALIGN - 1, 0);
|
||||||
npx_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF,
|
npx_initialstate = uma_zalloc(fpu_save_area_zone, M_WAITOK | M_ZERO);
|
||||||
M_WAITOK | M_ZERO);
|
|
||||||
if (use_xsave) {
|
if (use_xsave) {
|
||||||
if (xsave_mask >> 32 != 0)
|
if (xsave_mask >> 32 != 0)
|
||||||
max_ext_n = fls(xsave_mask >> 32) + 32;
|
max_ext_n = fls(xsave_mask >> 32) + 32;
|
||||||
|
Loading…
Reference in New Issue
Block a user