aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel/suspend.c
diff options
context:
space:
mode:
authorGlauber de Oliveira Costa <gcosta@redhat.com>2007-07-22 05:12:29 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-22 14:03:37 -0400
commitf51c94528a9bc73504928926ca4d791a2b7ddd7c (patch)
tree1562581d26098916a35a27ee58021f483c85b3da /arch/x86_64/kernel/suspend.c
parentabd4f7505bafdd6c5319fe3cb5caf9af6104e17a (diff)
x86_64: Use read and write crX in .c files
This patch uses the read and write functions provided at system.h for control registers instead of writting raw assembly over and over again in .c files. Functions to manipulate cr2 and cr8 were provided, as they were lacking. Also, removed some extra space after closing brackets Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86_64/kernel/suspend.c')
-rw-r--r--arch/x86_64/kernel/suspend.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/arch/x86_64/kernel/suspend.c b/arch/x86_64/kernel/suspend.c
index 6a5a98f2a75c..ea83a9f91965 100644
--- a/arch/x86_64/kernel/suspend.c
+++ b/arch/x86_64/kernel/suspend.c
@@ -55,11 +55,11 @@ void __save_processor_state(struct saved_context *ctxt)
55 * control registers 55 * control registers
56 */ 56 */
57 rdmsrl(MSR_EFER, ctxt->efer); 57 rdmsrl(MSR_EFER, ctxt->efer);
58 asm volatile ("movq %%cr0, %0" : "=r" (ctxt->cr0)); 58 ctxt->cr0 = read_cr0();
59 asm volatile ("movq %%cr2, %0" : "=r" (ctxt->cr2)); 59 ctxt->cr2 = read_cr2();
60 asm volatile ("movq %%cr3, %0" : "=r" (ctxt->cr3)); 60 ctxt->cr3 = read_cr3();
61 asm volatile ("movq %%cr4, %0" : "=r" (ctxt->cr4)); 61 ctxt->cr4 = read_cr4();
62 asm volatile ("movq %%cr8, %0" : "=r" (ctxt->cr8)); 62 ctxt->cr8 = read_cr8();
63} 63}
64 64
65void save_processor_state(void) 65void save_processor_state(void)
@@ -81,11 +81,11 @@ void __restore_processor_state(struct saved_context *ctxt)
81 * control registers 81 * control registers
82 */ 82 */
83 wrmsrl(MSR_EFER, ctxt->efer); 83 wrmsrl(MSR_EFER, ctxt->efer);
84 asm volatile ("movq %0, %%cr8" :: "r" (ctxt->cr8)); 84 write_cr8(ctxt->cr8);
85 asm volatile ("movq %0, %%cr4" :: "r" (ctxt->cr4)); 85 write_cr4(ctxt->cr4);
86 asm volatile ("movq %0, %%cr3" :: "r" (ctxt->cr3)); 86 write_cr3(ctxt->cr3);
87 asm volatile ("movq %0, %%cr2" :: "r" (ctxt->cr2)); 87 write_cr2(ctxt->cr2);
88 asm volatile ("movq %0, %%cr0" :: "r" (ctxt->cr0)); 88 write_cr0(ctxt->cr0);
89 89
90 /* 90 /*
91 * now restore the descriptor tables to their proper values 91 * now restore the descriptor tables to their proper values