Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 206193
b: refs/heads/master
c: 0e49bf6
h: refs/heads/master
i:
  206191: 29ffbe4
v: v3
  • Loading branch information
Robert Richter authored and H. Peter Anvin committed Jul 21, 2010
1 parent 6f9e4b4 commit 5032ed7
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 82d4150cec83b9775f84810b39a1c0b91585d429
refs/heads/master: 0e49bf66d2ca649b167428adddbbbe9d9bd4894c
1 change: 0 additions & 1 deletion trunk/arch/x86/include/asm/i387.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ extern void mxcsr_feature_mask_init(void);
extern int init_fpu(struct task_struct *child);
extern asmlinkage void math_state_restore(void);
extern void __math_state_restore(void);
extern void init_thread_xstate(void);
extern int dump_fpu(struct pt_regs *, struct user_i387_struct *);

extern user_regset_active_fn fpregs_active, xfpregs_active;
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/x86/include/asm/xsave.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ extern u64 pcntxt_mask;
extern struct xsave_struct *init_xstate_buf;
extern u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS];

extern void xsave_cntxt_init(void);
extern void xsave_init(void);
extern void update_regset_xstate_info(unsigned int size, u64 xstate_mask);
extern int init_fpu(struct task_struct *child);
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/x86/kernel/cpu/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,7 @@ void __cpuinit cpu_init(void)
dbg_restore_debug_regs();

fpu_init();
xsave_init();

raw_local_save_flags(kernel_eflags);

Expand Down Expand Up @@ -1270,6 +1271,7 @@ void __cpuinit cpu_init(void)
clear_used_math();
mxcsr_feature_mask_init();

fpu_init();
xsave_init();
}
#endif
27 changes: 19 additions & 8 deletions trunk/arch/x86/kernel/i387.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@ void __cpuinit mxcsr_feature_mask_init(void)
stts();
}

void __cpuinit init_thread_xstate(void)
static void __cpuinit init_thread_xstate(void)
{
/*
* Note that xstate_size might be overwriten later during
* xsave_init().
*/

if (!HAVE_HWFP) {
xstate_size = sizeof(struct i387_soft_struct);
return;
}

if (cpu_has_xsave) {
xsave_cntxt_init();
return;
}

if (cpu_has_fxsr)
xstate_size = sizeof(struct i387_fxsave_struct);
#ifdef CONFIG_X86_32
Expand All @@ -84,6 +84,7 @@ void __cpuinit init_thread_xstate(void)
* Called at bootup to set up the initial FPU state that is later cloned
* into all processes.
*/

void __cpuinit fpu_init(void)
{
unsigned long oldcr0 = read_cr0();
Expand All @@ -93,14 +94,24 @@ void __cpuinit fpu_init(void)

write_cr0(oldcr0 & ~(X86_CR0_TS|X86_CR0_EM)); /* clear TS and EM */

xsave_init();
if (!smp_processor_id())
init_thread_xstate();

mxcsr_feature_mask_init();
/* clean state in init */
current_thread_info()->status = 0;
clear_used_math();
}
#endif /* CONFIG_X86_64 */

#else /* CONFIG_X86_64 */

void __cpuinit fpu_init(void)
{
if (!smp_processor_id())
init_thread_xstate();
}

#endif /* CONFIG_X86_32 */

static void fpu_finit(struct fpu *fpu)
{
Expand Down
10 changes: 5 additions & 5 deletions trunk/arch/x86/kernel/xsave.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,6 @@ unsigned int sig_xstate_size = sizeof(struct _fpstate);
*/
static void __cpuinit __xsave_init(void)
{
if (!cpu_has_xsave)
return;

set_in_cr4(X86_CR4_OSXSAVE);

/*
Expand Down Expand Up @@ -429,7 +426,7 @@ static void __init setup_xstate_init(void)
/*
* Enable and initialize the xsave feature.
*/
void __ref xsave_cntxt_init(void)
static void __cpuinit xsave_cntxt_init(void)
{
unsigned int eax, ebx, ecx, edx;

Expand Down Expand Up @@ -466,10 +463,13 @@ void __ref xsave_cntxt_init(void)

void __cpuinit xsave_init(void)
{
if (!cpu_has_xsave)
return;

/*
* Boot processor to setup the FP and extended state context info.
*/
if (!smp_processor_id())
init_thread_xstate();
xsave_cntxt_init();
__xsave_init();
}

0 comments on commit 5032ed7

Please sign in to comment.