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.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/arch/i386/power/cpu.c b/arch/i386/power/cpu.c
index c547c1af6fa1..7b0b9ad848e5 100644
--- a/arch/i386/power/cpu.c
+++ b/arch/i386/power/cpu.c
@@ -42,25 +42,25 @@ void __save_processor_state(struct saved_context *ctxt)
42 /* 42 /*
43 * descriptor tables 43 * descriptor tables
44 */ 44 */
45 asm volatile ("sgdt %0" : "=m" (ctxt->gdt_limit)); 45 store_gdt(&ctxt->gdt_limit);
46 asm volatile ("sidt %0" : "=m" (ctxt->idt_limit)); 46 store_idt(&ctxt->idt_limit);
47 asm volatile ("str %0" : "=m" (ctxt->tr)); 47 store_tr(ctxt->tr);
48 48
49 /* 49 /*
50 * segment registers 50 * segment registers
51 */ 51 */
52 asm volatile ("movw %%es, %0" : "=m" (ctxt->es)); 52 savesegment(es, ctxt->es);
53 asm volatile ("movw %%fs, %0" : "=m" (ctxt->fs)); 53 savesegment(fs, ctxt->fs);
54 asm volatile ("movw %%gs, %0" : "=m" (ctxt->gs)); 54 savesegment(gs, ctxt->gs);
55 asm volatile ("movw %%ss, %0" : "=m" (ctxt->ss)); 55 savesegment(ss, ctxt->ss);
56 56
57 /* 57 /*
58 * control registers 58 * control registers
59 */ 59 */
60 asm volatile ("movl %%cr0, %0" : "=r" (ctxt->cr0)); 60 ctxt->cr0 = read_cr0();
61 asm volatile ("movl %%cr2, %0" : "=r" (ctxt->cr2)); 61 ctxt->cr2 = read_cr2();
62 asm volatile ("movl %%cr3, %0" : "=r" (ctxt->cr3)); 62 ctxt->cr3 = read_cr3();
63 asm volatile ("movl %%cr4, %0" : "=r" (ctxt->cr4)); 63 ctxt->cr4 = read_cr4();
64} 64}
65 65
66void save_processor_state(void) 66void save_processor_state(void)
@@ -84,7 +84,6 @@ static void fix_processor_context(void)
84 struct tss_struct * t = &per_cpu(init_tss, cpu); 84 struct tss_struct * t = &per_cpu(init_tss, cpu);
85 85
86 set_tss_desc(cpu,t); /* This just modifies memory; should not be necessary. But... This is necessary, because 386 hardware has concept of busy TSS or some similar stupidity. */ 86 set_tss_desc(cpu,t); /* This just modifies memory; should not be necessary. But... This is necessary, because 386 hardware has concept of busy TSS or some similar stupidity. */
87 per_cpu(cpu_gdt_table, cpu)[GDT_ENTRY_TSS].b &= 0xfffffdff;
88 87
89 load_TR_desc(); /* This does ltr */ 88 load_TR_desc(); /* This does ltr */
90 load_LDT(&current->active_mm->context); /* This does lldt */ 89 load_LDT(&current->active_mm->context); /* This does lldt */
@@ -109,25 +108,25 @@ void __restore_processor_state(struct saved_context *ctxt)
109 /* 108 /*
110 * control registers 109 * control registers
111 */ 110 */
112 asm volatile ("movl %0, %%cr4" :: "r" (ctxt->cr4)); 111 write_cr4(ctxt->cr4);
113 asm volatile ("movl %0, %%cr3" :: "r" (ctxt->cr3)); 112 write_cr3(ctxt->cr3);
114 asm volatile ("movl %0, %%cr2" :: "r" (ctxt->cr2)); 113 write_cr2(ctxt->cr2);
115 asm volatile ("movl %0, %%cr0" :: "r" (ctxt->cr0)); 114 write_cr2(ctxt->cr0);
116 115
117 /* 116 /*
118 * now restore the descriptor tables to their proper values 117 * now restore the descriptor tables to their proper values
119 * ltr is done i fix_processor_context(). 118 * ltr is done i fix_processor_context().
120 */ 119 */
121 asm volatile ("lgdt %0" :: "m" (ctxt->gdt_limit)); 120 load_gdt(&ctxt->gdt_limit);
122 asm volatile ("lidt %0" :: "m" (ctxt->idt_limit)); 121 load_idt(&ctxt->idt_limit);
123 122
124 /* 123 /*
125 * segment registers 124 * segment registers
126 */ 125 */
127 asm volatile ("movw %0, %%es" :: "r" (ctxt->es)); 126 loadsegment(es, ctxt->es);
128 asm volatile ("movw %0, %%fs" :: "r" (ctxt->fs)); 127 loadsegment(fs, ctxt->fs);
129 asm volatile ("movw %0, %%gs" :: "r" (ctxt->gs)); 128 loadsegment(gs, ctxt->gs);
130 asm volatile ("movw %0, %%ss" :: "r" (ctxt->ss)); 129 loadsegment(ss, ctxt->ss);
131 130
132 /* 131 /*
133 * sysenter MSRs 132 * sysenter MSRs