aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel/suspend_asm.S
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2007-10-11 05:14:37 -0400
committerThomas Gleixner <tglx@linutronix.de>2007-10-11 05:14:37 -0400
commitba733ec4725df406a6ff5c5c1e6c447f42bbf39d (patch)
tree1a1c87f6a332472145f8543bd60c7a2ac31386ae /arch/x86_64/kernel/suspend_asm.S
parente86a989de27d4c0226928d6132f284f6156f30f7 (diff)
x86_64: prepare shared kernel/suspend_asm.S
Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86_64/kernel/suspend_asm.S')
-rw-r--r--arch/x86_64/kernel/suspend_asm.S110
1 files changed, 0 insertions, 110 deletions
diff --git a/arch/x86_64/kernel/suspend_asm.S b/arch/x86_64/kernel/suspend_asm.S
deleted file mode 100644
index 16d183f67bc1..000000000000
--- a/arch/x86_64/kernel/suspend_asm.S
+++ /dev/null
@@ -1,110 +0,0 @@
1/* Copyright 2004,2005 Pavel Machek <pavel@suse.cz>, Andi Kleen <ak@suse.de>, Rafael J. Wysocki <rjw@sisk.pl>
2 *
3 * Distribute under GPLv2.
4 *
5 * swsusp_arch_resume may not use any stack, nor any variable that is
6 * not "NoSave" during copying pages:
7 *
8 * Its rewriting one kernel image with another. What is stack in "old"
9 * image could very well be data page in "new" image, and overwriting
10 * your own stack under you is bad idea.
11 */
12
13 .text
14#include <linux/linkage.h>
15#include <asm/segment.h>
16#include <asm/page.h>
17#include <asm/asm-offsets.h>
18
19ENTRY(swsusp_arch_suspend)
20
21 movq %rsp, saved_context_esp(%rip)
22 movq %rax, saved_context_eax(%rip)
23 movq %rbx, saved_context_ebx(%rip)
24 movq %rcx, saved_context_ecx(%rip)
25 movq %rdx, saved_context_edx(%rip)
26 movq %rbp, saved_context_ebp(%rip)
27 movq %rsi, saved_context_esi(%rip)
28 movq %rdi, saved_context_edi(%rip)
29 movq %r8, saved_context_r08(%rip)
30 movq %r9, saved_context_r09(%rip)
31 movq %r10, saved_context_r10(%rip)
32 movq %r11, saved_context_r11(%rip)
33 movq %r12, saved_context_r12(%rip)
34 movq %r13, saved_context_r13(%rip)
35 movq %r14, saved_context_r14(%rip)
36 movq %r15, saved_context_r15(%rip)
37 pushfq ; popq saved_context_eflags(%rip)
38
39 call swsusp_save
40 ret
41
42ENTRY(restore_image)
43 /* switch to temporary page tables */
44 movq $__PAGE_OFFSET, %rdx
45 movq temp_level4_pgt(%rip), %rax
46 subq %rdx, %rax
47 movq %rax, %cr3
48 /* Flush TLB */
49 movq mmu_cr4_features(%rip), %rax
50 movq %rax, %rdx
51 andq $~(1<<7), %rdx # PGE
52 movq %rdx, %cr4; # turn off PGE
53 movq %cr3, %rcx; # flush TLB
54 movq %rcx, %cr3;
55 movq %rax, %cr4; # turn PGE back on
56
57 movq restore_pblist(%rip), %rdx
58loop:
59 testq %rdx, %rdx
60 jz done
61
62 /* get addresses from the pbe and copy the page */
63 movq pbe_address(%rdx), %rsi
64 movq pbe_orig_address(%rdx), %rdi
65 movq $512, %rcx
66 rep
67 movsq
68
69 /* progress to the next pbe */
70 movq pbe_next(%rdx), %rdx
71 jmp loop
72done:
73 /* go back to the original page tables */
74 movq $(init_level4_pgt - __START_KERNEL_map), %rax
75 addq phys_base(%rip), %rax
76 movq %rax, %cr3
77
78 /* Flush TLB, including "global" things (vmalloc) */
79 movq mmu_cr4_features(%rip), %rax
80 movq %rax, %rdx
81 andq $~(1<<7), %rdx; # PGE
82 movq %rdx, %cr4; # turn off PGE
83 movq %cr3, %rcx; # flush TLB
84 movq %rcx, %cr3
85 movq %rax, %cr4; # turn PGE back on
86
87 movl $24, %eax
88 movl %eax, %ds
89
90 movq saved_context_esp(%rip), %rsp
91 movq saved_context_ebp(%rip), %rbp
92 /* Don't restore %rax, it must be 0 anyway */
93 movq saved_context_ebx(%rip), %rbx
94 movq saved_context_ecx(%rip), %rcx
95 movq saved_context_edx(%rip), %rdx
96 movq saved_context_esi(%rip), %rsi
97 movq saved_context_edi(%rip), %rdi
98 movq saved_context_r08(%rip), %r8
99 movq saved_context_r09(%rip), %r9
100 movq saved_context_r10(%rip), %r10
101 movq saved_context_r11(%rip), %r11
102 movq saved_context_r12(%rip), %r12
103 movq saved_context_r13(%rip), %r13
104 movq saved_context_r14(%rip), %r14
105 movq saved_context_r15(%rip), %r15
106 pushq saved_context_eflags(%rip) ; popfq
107
108 xorq %rax, %rax
109
110 ret