diff options
Diffstat (limited to 'arch/x86/power/cpu_32.c')
-rw-r--r-- | arch/x86/power/cpu_32.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/arch/x86/power/cpu_32.c b/arch/x86/power/cpu_32.c index 7dc5d5cf50a2..274d06082f48 100644 --- a/arch/x86/power/cpu_32.c +++ b/arch/x86/power/cpu_32.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/suspend.h> | 11 | #include <linux/suspend.h> |
12 | #include <asm/mtrr.h> | 12 | #include <asm/mtrr.h> |
13 | #include <asm/mce.h> | 13 | #include <asm/mce.h> |
14 | #include <asm/xcr.h> | ||
14 | 15 | ||
15 | static struct saved_context saved_context; | 16 | static struct saved_context saved_context; |
16 | 17 | ||
@@ -45,7 +46,7 @@ static void __save_processor_state(struct saved_context *ctxt) | |||
45 | ctxt->cr0 = read_cr0(); | 46 | ctxt->cr0 = read_cr0(); |
46 | ctxt->cr2 = read_cr2(); | 47 | ctxt->cr2 = read_cr2(); |
47 | ctxt->cr3 = read_cr3(); | 48 | ctxt->cr3 = read_cr3(); |
48 | ctxt->cr4 = read_cr4(); | 49 | ctxt->cr4 = read_cr4_safe(); |
49 | } | 50 | } |
50 | 51 | ||
51 | /* Needed by apm.c */ | 52 | /* Needed by apm.c */ |
@@ -98,7 +99,9 @@ static void __restore_processor_state(struct saved_context *ctxt) | |||
98 | /* | 99 | /* |
99 | * control registers | 100 | * control registers |
100 | */ | 101 | */ |
101 | write_cr4(ctxt->cr4); | 102 | /* cr4 was introduced in the Pentium CPU */ |
103 | if (ctxt->cr4) | ||
104 | write_cr4(ctxt->cr4); | ||
102 | write_cr3(ctxt->cr3); | 105 | write_cr3(ctxt->cr3); |
103 | write_cr2(ctxt->cr2); | 106 | write_cr2(ctxt->cr2); |
104 | write_cr0(ctxt->cr0); | 107 | write_cr0(ctxt->cr0); |
@@ -124,6 +127,12 @@ static void __restore_processor_state(struct saved_context *ctxt) | |||
124 | if (boot_cpu_has(X86_FEATURE_SEP)) | 127 | if (boot_cpu_has(X86_FEATURE_SEP)) |
125 | enable_sep_cpu(); | 128 | enable_sep_cpu(); |
126 | 129 | ||
130 | /* | ||
131 | * restore XCR0 for xsave capable cpu's. | ||
132 | */ | ||
133 | if (cpu_has_xsave) | ||
134 | xsetbv(XCR_XFEATURE_ENABLED_MASK, pcntxt_mask); | ||
135 | |||
127 | fix_processor_context(); | 136 | fix_processor_context(); |
128 | do_fpu_end(); | 137 | do_fpu_end(); |
129 | mtrr_ap_init(); | 138 | mtrr_ap_init(); |