Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F165227392
D25098.id73023.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D25098.id73023.diff
View Options
Index: sys/amd64/amd64/fpu.c
===================================================================
--- sys/amd64/amd64/fpu.c
+++ sys/amd64/amd64/fpu.c
@@ -159,7 +159,7 @@
static uma_zone_t fpu_save_area_zone;
static struct savefpu *fpu_initialstate;
-struct xsave_area_elm_descr {
+static struct xsave_area_elm_descr {
u_int offset;
u_int size;
} *xsave_area_desc;
@@ -368,8 +368,17 @@
register_t saveintr;
int cp[4], i, max_ext_n;
- fpu_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF,
- M_WAITOK | M_ZERO);
+ /* Do potentially blocking operations before disabling interrupts. */
+ 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 = 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
+ xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO);
+ }
+
saveintr = intr_disable();
stop_emulating();
@@ -399,9 +408,6 @@
offsetof(struct xstate_hdr, xstate_bv));
*xstate_bv = XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE;
- max_ext_n = flsl(xsave_mask);
- xsave_area_desc = malloc(max_ext_n * sizeof(struct
- xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO);
/* x87 state */
xsave_area_desc[0].offset = 0;
xsave_area_desc[0].size = 160;
@@ -415,10 +421,6 @@
xsave_area_desc[i].size = cp[0];
}
}
-
- fpu_save_area_zone = uma_zcreate("FPU_save_area",
- cpu_max_ext_state_size, NULL, NULL, NULL, NULL,
- XSAVE_AREA_ALIGN - 1, 0);
start_emulating();
intr_restore(saveintr);
Index: sys/i386/i386/npx.c
===================================================================
--- sys/i386/i386/npx.c
+++ sys/i386/i386/npx.c
@@ -201,7 +201,7 @@
static uma_zone_t fpu_save_area_zone;
static union savefpu *npx_initialstate;
-struct xsave_area_elm_descr {
+static struct xsave_area_elm_descr {
u_int offset;
u_int size;
} *xsave_area_desc;
@@ -479,8 +479,20 @@
if (!hw_float)
return;
- npx_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF,
- M_WAITOK | M_ZERO);
+ /* Do potentially blocking operations before disabling interrupts. */
+ 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 = 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;
+ else
+ max_ext_n = fls(xsave_mask);
+ xsave_area_desc = malloc(max_ext_n * sizeof(struct
+ xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO);
+ }
+
saveintr = intr_disable();
stop_emulating();
@@ -522,12 +534,6 @@
offsetof(struct xstate_hdr, xstate_bv));
*xstate_bv = XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE;
- if (xsave_mask >> 32 != 0)
- max_ext_n = fls(xsave_mask >> 32) + 32;
- else
- max_ext_n = fls(xsave_mask);
- xsave_area_desc = malloc(max_ext_n * sizeof(struct
- xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO);
/* x87 state */
xsave_area_desc[0].offset = 0;
xsave_area_desc[0].size = 160;
@@ -541,10 +547,6 @@
xsave_area_desc[i].size = cp[0];
}
}
-
- fpu_save_area_zone = uma_zcreate("FPU_save_area",
- cpu_max_ext_state_size, NULL, NULL, NULL, NULL,
- XSAVE_AREA_ALIGN - 1, 0);
start_emulating();
intr_restore(saveintr);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Aug 8, 12:09 AM (18 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36202102
Default Alt Text
D25098.id73023.diff (3 KB)
Attached To
Mode
D25098: Ensure alignment of allocation for FPU initial state
Attached
Detach File
Event Timeline
Log In to Comment