diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2007-10-23 16:37:24 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2007-10-23 16:37:24 -0400 |
commit | 0de80bcc2baed116a569c38cbc38c5dcb945d14d (patch) | |
tree | 5eef7beda7307be2e8949f1bf0e7f84799d8ae31 /arch/x86/kernel/suspend_asm_64.S | |
parent | ef685298b4b3dead1efa1d47cd27ced0f2673254 (diff) |
x86: Save registers in saved_context during suspend and hibernation
During hibernation and suspend on x86_64 save CPU registers in the saved_context
structure rather than in a handful of separate variables.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/suspend_asm_64.S')
-rw-r--r-- | arch/x86/kernel/suspend_asm_64.S | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/arch/x86/kernel/suspend_asm_64.S b/arch/x86/kernel/suspend_asm_64.S index 48344b666d2..72f952103e5 100644 --- a/arch/x86/kernel/suspend_asm_64.S +++ b/arch/x86/kernel/suspend_asm_64.S | |||
@@ -17,24 +17,24 @@ | |||
17 | #include <asm/asm-offsets.h> | 17 | #include <asm/asm-offsets.h> |
18 | 18 | ||
19 | ENTRY(swsusp_arch_suspend) | 19 | ENTRY(swsusp_arch_suspend) |
20 | 20 | movq $saved_context, %rax | |
21 | movq %rsp, saved_context_esp(%rip) | 21 | movq %rsp, pt_regs_rsp(%rax) |
22 | movq %rax, saved_context_eax(%rip) | 22 | movq %rbp, pt_regs_rbp(%rax) |
23 | movq %rbx, saved_context_ebx(%rip) | 23 | movq %rsi, pt_regs_rsi(%rax) |
24 | movq %rcx, saved_context_ecx(%rip) | 24 | movq %rdi, pt_regs_rdi(%rax) |
25 | movq %rdx, saved_context_edx(%rip) | 25 | movq %rbx, pt_regs_rbx(%rax) |
26 | movq %rbp, saved_context_ebp(%rip) | 26 | movq %rcx, pt_regs_rcx(%rax) |
27 | movq %rsi, saved_context_esi(%rip) | 27 | movq %rdx, pt_regs_rdx(%rax) |
28 | movq %rdi, saved_context_edi(%rip) | 28 | movq %r8, pt_regs_r8(%rax) |
29 | movq %r8, saved_context_r08(%rip) | 29 | movq %r9, pt_regs_r9(%rax) |
30 | movq %r9, saved_context_r09(%rip) | 30 | movq %r10, pt_regs_r10(%rax) |
31 | movq %r10, saved_context_r10(%rip) | 31 | movq %r11, pt_regs_r11(%rax) |
32 | movq %r11, saved_context_r11(%rip) | 32 | movq %r12, pt_regs_r12(%rax) |
33 | movq %r12, saved_context_r12(%rip) | 33 | movq %r13, pt_regs_r13(%rax) |
34 | movq %r13, saved_context_r13(%rip) | 34 | movq %r14, pt_regs_r14(%rax) |
35 | movq %r14, saved_context_r14(%rip) | 35 | movq %r15, pt_regs_r15(%rax) |
36 | movq %r15, saved_context_r15(%rip) | 36 | pushfq |
37 | pushfq ; popq saved_context_eflags(%rip) | 37 | popq pt_regs_eflags(%rax) |
38 | 38 | ||
39 | /* save the address of restore_registers */ | 39 | /* save the address of restore_registers */ |
40 | movq $restore_registers, %rax | 40 | movq $restore_registers, %rax |
@@ -113,23 +113,25 @@ ENTRY(restore_registers) | |||
113 | movq %rcx, %cr3 | 113 | movq %rcx, %cr3 |
114 | movq %rax, %cr4; # turn PGE back on | 114 | movq %rax, %cr4; # turn PGE back on |
115 | 115 | ||
116 | movq saved_context_esp(%rip), %rsp | 116 | /* We don't restore %rax, it must be 0 anyway */ |
117 | movq saved_context_ebp(%rip), %rbp | 117 | movq $saved_context, %rax |
118 | /* restore GPRs (we don't restore %rax, it must be 0 anyway) */ | 118 | movq pt_regs_rsp(%rax), %rsp |
119 | movq saved_context_ebx(%rip), %rbx | 119 | movq pt_regs_rbp(%rax), %rbp |
120 | movq saved_context_ecx(%rip), %rcx | 120 | movq pt_regs_rsi(%rax), %rsi |
121 | movq saved_context_edx(%rip), %rdx | 121 | movq pt_regs_rdi(%rax), %rdi |
122 | movq saved_context_esi(%rip), %rsi | 122 | movq pt_regs_rbx(%rax), %rbx |
123 | movq saved_context_edi(%rip), %rdi | 123 | movq pt_regs_rcx(%rax), %rcx |
124 | movq saved_context_r08(%rip), %r8 | 124 | movq pt_regs_rdx(%rax), %rdx |
125 | movq saved_context_r09(%rip), %r9 | 125 | movq pt_regs_r8(%rax), %r8 |
126 | movq saved_context_r10(%rip), %r10 | 126 | movq pt_regs_r9(%rax), %r9 |
127 | movq saved_context_r11(%rip), %r11 | 127 | movq pt_regs_r10(%rax), %r10 |
128 | movq saved_context_r12(%rip), %r12 | 128 | movq pt_regs_r11(%rax), %r11 |
129 | movq saved_context_r13(%rip), %r13 | 129 | movq pt_regs_r12(%rax), %r12 |
130 | movq saved_context_r14(%rip), %r14 | 130 | movq pt_regs_r13(%rax), %r13 |
131 | movq saved_context_r15(%rip), %r15 | 131 | movq pt_regs_r14(%rax), %r14 |
132 | pushq saved_context_eflags(%rip) ; popfq | 132 | movq pt_regs_r15(%rax), %r15 |
133 | pushq pt_regs_eflags(%rax) | ||
134 | popfq | ||
133 | 135 | ||
134 | xorq %rax, %rax | 136 | xorq %rax, %rax |
135 | 137 | ||