12 #include <linux/export.h>
15 #include <asm/pgtable.h>
21 #include <asm/suspend.h>
28 unsigned long saved_context_ebx;
29 unsigned long saved_context_esp, saved_context_ebp;
30 unsigned long saved_context_esi, saved_context_edi;
31 unsigned long saved_context_eflags;
52 static void __save_processor_state(
struct saved_context *ctxt)
77 savesegment(
es, ctxt->
es);
78 savesegment(
fs, ctxt->
fs);
79 savesegment(
gs, ctxt->
gs);
80 savesegment(
ss, ctxt->
ss);
83 asm volatile (
"movw %%ds, %0" :
"=m" (ctxt->
ds));
84 asm volatile (
"movw %%es, %0" :
"=m" (ctxt->
es));
85 asm volatile (
"movw %%fs, %0" :
"=m" (ctxt->
fs));
86 asm volatile (
"movw %%gs, %0" :
"=m" (ctxt->
gs));
87 asm volatile (
"movw %%ss, %0" :
"=m" (ctxt->
ss));
100 ctxt->
cr0 = read_cr0();
101 ctxt->
cr2 = read_cr2();
102 ctxt->
cr3 = read_cr3();
104 ctxt->
cr4 = read_cr4_safe();
107 ctxt->
cr4 = read_cr4();
108 ctxt->
cr8 = read_cr8();
124 static void do_fpu_end(
void)
132 static void fix_processor_context(
void)
150 load_LDT(&
current->active_mm->context);
158 static void __restore_processor_state(
struct saved_context *ctxt)
168 write_cr4(ctxt->
cr4);
172 write_cr8(ctxt->
cr8);
173 write_cr4(ctxt->
cr4);
175 write_cr3(ctxt->
cr3);
176 write_cr2(ctxt->
cr2);
177 write_cr0(ctxt->
cr0);
196 loadsegment(
es, ctxt->
es);
197 loadsegment(
fs, ctxt->
fs);
198 loadsegment(
gs, ctxt->
gs);
199 loadsegment(
ss, ctxt->
ss);
208 asm volatile (
"movw %0, %%ds" ::
"r" (ctxt->
ds));
209 asm volatile (
"movw %0, %%es" ::
"r" (ctxt->
es));
210 asm volatile (
"movw %0, %%fs" ::
"r" (ctxt->
fs));
211 load_gs_index(ctxt->
gs);
212 asm volatile (
"movw %0, %%ss" ::
"r" (ctxt->
ss));
225 fix_processor_context();