Commit 6bea24b9 authored by Patrick Mochel's avatar Patrick Mochel Committed by Patrick Mochel

[swsusp] Fix x86-64 low-level support.

From Pavel Machek.
parent fa7f8704
/* originally gcc generated, but now changed. don't overwrite. */ /* Originally gcc generated, modified by hand
*
* This may not use any stack, nor any variable that is not "NoSave":
*
* Its rewriting one kernel image with another. What is stack in "old"
* image could very well be data page in "new" image, and overwriting
* your own stack under you is bad idea.
*/
.text .text
#include <linux/linkage.h> #include <linux/linkage.h>
#include <asm/segment.h> #include <asm/segment.h>
#include <asm/page.h> #include <asm/page.h>
/* Input: ENTRY(swsusp_arch_suspend)
* rdi resume flag
*/
ENTRY(do_magic)
.LFB5:
subq $8, %rsp
.LCFI2:
testl %edi, %edi
jne .L90
call do_magic_suspend_1
call save_processor_state
movq %rsp, saved_context_esp(%rip) movq %rsp, saved_context_esp(%rip)
movq %rax, saved_context_eax(%rip) movq %rax, saved_context_eax(%rip)
...@@ -36,9 +32,10 @@ ENTRY(do_magic) ...@@ -36,9 +32,10 @@ ENTRY(do_magic)
movq %r15, saved_context_r15(%rip) movq %r15, saved_context_r15(%rip)
pushfq ; popq saved_context_eflags(%rip) pushfq ; popq saved_context_eflags(%rip)
addq $8, %rsp call swsusp_save
jmp do_magic_suspend_2 ret
.L90:
ENTRY(swsusp_arch_resume)
/* set up cr3 */ /* set up cr3 */
leaq init_level4_pgt(%rip),%rax leaq init_level4_pgt(%rip),%rax
subq $__START_KERNEL_map,%rax subq $__START_KERNEL_map,%rax
...@@ -53,7 +50,6 @@ ENTRY(do_magic) ...@@ -53,7 +50,6 @@ ENTRY(do_magic)
movq %rcx, %cr3; movq %rcx, %cr3;
movq %rax, %cr4; # turn PGE back on movq %rax, %cr4; # turn PGE back on
call do_magic_resume_1
movl nr_copy_pages(%rip), %eax movl nr_copy_pages(%rip), %eax
xorl %ecx, %ecx xorl %ecx, %ecx
movq $0, loop(%rip) movq $0, loop(%rip)
...@@ -113,9 +109,8 @@ ENTRY(do_magic) ...@@ -113,9 +109,8 @@ ENTRY(do_magic)
movq saved_context_r14(%rip), %r14 movq saved_context_r14(%rip), %r14
movq saved_context_r15(%rip), %r15 movq saved_context_r15(%rip), %r15
pushq saved_context_eflags(%rip) ; popfq pushq saved_context_eflags(%rip) ; popfq
call restore_processor_state call swsusp_restore
addq $8, %rsp ret
jmp do_magic_resume_2
.section .data.nosave .section .data.nosave
loop: loop:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment