mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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
2 changed files with 2 additions and 4 deletions
|
|
@ -372,8 +372,7 @@ fpuinitstate(void *arg __unused)
|
|||
fpu_save_area_zone = uma_zcreate("FPU_save_area",
|
||||
cpu_max_ext_state_size, NULL, NULL, NULL, NULL,
|
||||
XSAVE_AREA_ALIGN - 1, 0);
|
||||
fpu_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF,
|
||||
M_WAITOK | M_ZERO);
|
||||
fpu_initialstate = uma_zalloc(fpu_save_area_zone, M_WAITOK | M_ZERO);
|
||||
if (use_xsave) {
|
||||
max_ext_n = flsl(xsave_mask);
|
||||
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",
|
||||
cpu_max_ext_state_size, NULL, NULL, NULL, NULL,
|
||||
XSAVE_AREA_ALIGN - 1, 0);
|
||||
npx_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF,
|
||||
M_WAITOK | M_ZERO);
|
||||
npx_initialstate = uma_zalloc(fpu_save_area_zone, M_WAITOK | M_ZERO);
|
||||
if (use_xsave) {
|
||||
if (xsave_mask >> 32 != 0)
|
||||
max_ext_n = fls(xsave_mask >> 32) + 32;
|
||||
|
|
|
|||
Loading…
Reference in a new issue