1 /* Originally gcc generated, modified by hand
3 * This may not use any stack, nor any variable that is not "NoSave":
5 * Its rewriting one kernel image with another. What is stack in "old"
6 * image could very well be data page in "new" image, and overwriting
7 * your own stack under you is bad idea.
11 #include <linux/linkage.h>
12 #include <asm/segment.h>
15 ENTRY(swsusp_arch_suspend)
17 movq %rsp, saved_context_esp(%rip)
18 movq %rax, saved_context_eax(%rip)
19 movq %rbx, saved_context_ebx(%rip)
20 movq %rcx, saved_context_ecx(%rip)
21 movq %rdx, saved_context_edx(%rip)
22 movq %rbp, saved_context_ebp(%rip)
23 movq %rsi, saved_context_esi(%rip)
24 movq %rdi, saved_context_edi(%rip)
25 movq %r8, saved_context_r08(%rip)
26 movq %r9, saved_context_r09(%rip)
27 movq %r10, saved_context_r10(%rip)
28 movq %r11, saved_context_r11(%rip)
29 movq %r12, saved_context_r12(%rip)
30 movq %r13, saved_context_r13(%rip)
31 movq %r14, saved_context_r14(%rip)
32 movq %r15, saved_context_r15(%rip)
33 pushfq ; popq saved_context_eflags(%rip)
38 ENTRY(swsusp_arch_resume)
40 leaq init_level4_pgt(%rip),%rax
41 subq $__START_KERNEL_map,%rax
44 movq mmu_cr4_features(%rip), %rax
46 andq $~(1<<7), %rdx # PGE
47 movq %rdx, %cr4; # turn off PGE
48 movq %cr3, %rcx; # flush TLB
50 movq %rax, %cr4; # turn PGE back on
52 movl nr_copy_pages(%rip), %eax
65 movq pagedir_nosave(%rip), %rdx
68 movq 8(%rdx,%rax), %rcx
69 movq (%rdx,%rax), %rax
70 movzbl (%rsi,%rax), %eax
73 movq %cr3, %rax; # flush TLB
86 mov nr_copy_pages(%rip), %eax
93 movq saved_context_esp(%rip), %rsp
94 movq saved_context_ebp(%rip), %rbp
95 movq saved_context_eax(%rip), %rax
96 movq saved_context_ebx(%rip), %rbx
97 movq saved_context_ecx(%rip), %rcx
98 movq saved_context_edx(%rip), %rdx
99 movq saved_context_esi(%rip), %rsi
100 movq saved_context_edi(%rip), %rdi
101 movq saved_context_r08(%rip), %r8
102 movq saved_context_r09(%rip), %r9
103 movq saved_context_r10(%rip), %r10
104 movq saved_context_r11(%rip), %r11
105 movq saved_context_r12(%rip), %r12
106 movq saved_context_r13(%rip), %r13
107 movq saved_context_r14(%rip), %r14
108 movq saved_context_r15(%rip), %r15
109 pushq saved_context_eflags(%rip) ; popfq