Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 206198
b: refs/heads/master
c: 1cff92d
h: refs/heads/master
v: v3
  • Loading branch information
H. Peter Anvin committed Jul 21, 2010
1 parent 493554d commit a6ab2f4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 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: 4995b9dba908436c1611454f9bd2cb3ddf6babee
refs/heads/master: 1cff92d8fdb27684308864d9cdb324bee43b40ab
28 changes: 17 additions & 11 deletions trunk/arch/x86/kernel/xsave.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,10 @@ unsigned int sig_xstate_size = sizeof(struct _fpstate);
/*
* Enable the extended processor state save/restore feature
*/
static inline void xstate_enable(u64 mask)
static inline void xstate_enable(void)
{
set_in_cr4(X86_CR4_OSXSAVE);
xsetbv(XCR_XFEATURE_ENABLED_MASK, mask);
xsetbv(XCR_XFEATURE_ENABLED_MASK, pcntxt_mask);
}

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

Expand All @@ -444,7 +444,7 @@ static void __cpuinit xstate_enable_boot_cpu(void)
*/
pcntxt_mask = pcntxt_mask & XCNTXT_MASK;

xstate_enable(pcntxt_mask);
xstate_enable();

/*
* Recompute the context size for enabled features
Expand All @@ -462,16 +462,22 @@ static void __cpuinit xstate_enable_boot_cpu(void)
pcntxt_mask, xstate_size);
}

/*
* For the very first instance, this calls xstate_enable_boot_cpu();
* for all subsequent instances, this calls xstate_enable().
*
* This is somewhat obfuscated due to the lack of powerful enough
* overrides for the section checks.
*/
void __cpuinit xsave_init(void)
{
static __refdata void (*next_func)(void) = xstate_enable_boot_cpu;
void (*this_func)(void);

if (!cpu_has_xsave)
return;

/*
* Boot processor to setup the FP and extended state context info.
*/
if (!smp_processor_id())
xstate_enable_boot_cpu();
else
xstate_enable(pcntxt_mask);
this_func = next_func;
next_func = xstate_enable;
this_func();
}

0 comments on commit a6ab2f4

Please sign in to comment.