aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/power/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/power/cpu.c')
-rw-r--r--arch/i386/power/cpu.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/arch/i386/power/cpu.c b/arch/i386/power/cpu.c
index 6f521cf19a13..0e6b45b61251 100644
--- a/arch/i386/power/cpu.c
+++ b/arch/i386/power/cpu.c
@@ -22,9 +22,11 @@
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/suspend.h> 23#include <linux/suspend.h>
24#include <linux/acpi.h> 24#include <linux/acpi.h>
25
25#include <asm/uaccess.h> 26#include <asm/uaccess.h>
26#include <asm/acpi.h> 27#include <asm/acpi.h>
27#include <asm/tlbflush.h> 28#include <asm/tlbflush.h>
29#include <asm/processor.h>
28 30
29static struct saved_context saved_context; 31static struct saved_context saved_context;
30 32
@@ -33,8 +35,6 @@ unsigned long saved_context_esp, saved_context_ebp;
33unsigned long saved_context_esi, saved_context_edi; 35unsigned long saved_context_esi, saved_context_edi;
34unsigned long saved_context_eflags; 36unsigned long saved_context_eflags;
35 37
36extern void enable_sep_cpu(void *);
37
38void __save_processor_state(struct saved_context *ctxt) 38void __save_processor_state(struct saved_context *ctxt)
39{ 39{
40 kernel_fpu_begin(); 40 kernel_fpu_begin();
@@ -44,7 +44,6 @@ void __save_processor_state(struct saved_context *ctxt)
44 */ 44 */
45 asm volatile ("sgdt %0" : "=m" (ctxt->gdt_limit)); 45 asm volatile ("sgdt %0" : "=m" (ctxt->gdt_limit));
46 asm volatile ("sidt %0" : "=m" (ctxt->idt_limit)); 46 asm volatile ("sidt %0" : "=m" (ctxt->idt_limit));
47 asm volatile ("sldt %0" : "=m" (ctxt->ldt));
48 asm volatile ("str %0" : "=m" (ctxt->tr)); 47 asm volatile ("str %0" : "=m" (ctxt->tr));
49 48
50 /* 49 /*
@@ -107,7 +106,6 @@ static void fix_processor_context(void)
107 106
108void __restore_processor_state(struct saved_context *ctxt) 107void __restore_processor_state(struct saved_context *ctxt)
109{ 108{
110
111 /* 109 /*
112 * control registers 110 * control registers
113 */ 111 */
@@ -117,6 +115,13 @@ void __restore_processor_state(struct saved_context *ctxt)
117 asm volatile ("movl %0, %%cr0" :: "r" (ctxt->cr0)); 115 asm volatile ("movl %0, %%cr0" :: "r" (ctxt->cr0));
118 116
119 /* 117 /*
118 * now restore the descriptor tables to their proper values
119 * ltr is done i fix_processor_context().
120 */
121 asm volatile ("lgdt %0" :: "m" (ctxt->gdt_limit));
122 asm volatile ("lidt %0" :: "m" (ctxt->idt_limit));
123
124 /*
120 * segment registers 125 * segment registers
121 */ 126 */
122 asm volatile ("movw %0, %%es" :: "r" (ctxt->es)); 127 asm volatile ("movw %0, %%es" :: "r" (ctxt->es));
@@ -125,18 +130,10 @@ void __restore_processor_state(struct saved_context *ctxt)
125 asm volatile ("movw %0, %%ss" :: "r" (ctxt->ss)); 130 asm volatile ("movw %0, %%ss" :: "r" (ctxt->ss));
126 131
127 /* 132 /*
128 * now restore the descriptor tables to their proper values
129 * ltr is done i fix_processor_context().
130 */
131 asm volatile ("lgdt %0" :: "m" (ctxt->gdt_limit));
132 asm volatile ("lidt %0" :: "m" (ctxt->idt_limit));
133 asm volatile ("lldt %0" :: "m" (ctxt->ldt));
134
135 /*
136 * sysenter MSRs 133 * sysenter MSRs
137 */ 134 */
138 if (boot_cpu_has(X86_FEATURE_SEP)) 135 if (boot_cpu_has(X86_FEATURE_SEP))
139 enable_sep_cpu(NULL); 136 enable_sep_cpu();
140 137
141 fix_processor_context(); 138 fix_processor_context();
142 do_fpu_end(); 139 do_fpu_end();