4 * This may not use any stack, nor any variable that is not "NoSave":
6 * Its rewriting one kernel image with another. What is stack in "old"
7 * image could very well be data page in "new" image, and overwriting
8 * your own stack under you is bad idea.
11 #include <linux/linkage.h>
12 #include <asm/segment.h>
14 #include <asm/asm-offsets.h>
18 ENTRY(swsusp_arch_suspend)
20 movl %esp, saved_context_esp
21 movl %ebx, saved_context_ebx
22 movl %ebp, saved_context_ebp
23 movl %esi, saved_context_esi
24 movl %edi, saved_context_edi
25 pushfl ; popl saved_context_eflags
31 movl resume_pg_dir, %eax
32 subl $__PAGE_OFFSET, %eax
35 movl restore_pblist, %edx
42 movl pbe_address(%edx), %esi
43 movl pbe_orig_address(%edx), %edi
49 movl pbe_next(%edx), %edx
54 /* go back to the original page tables */
55 movl $swapper_pg_dir, %eax
56 subl $__PAGE_OFFSET, %eax
58 /* Flush TLB, including "global" things (vmalloc) */
59 movl mmu_cr4_features, %ecx
60 jecxz 1f # cr4 Pentium and higher, skip if zero
62 andl $~(1<<7), %edx; # PGE
63 movl %edx, %cr4; # turn off PGE
65 movl %cr3, %eax; # flush TLB
67 jecxz 1f # cr4 Pentium and higher, skip if zero
68 movl %ecx, %cr4; # turn PGE back on
71 movl saved_context_esp, %esp
72 movl saved_context_ebp, %ebp
73 movl saved_context_ebx, %ebx
74 movl saved_context_esi, %esi
75 movl saved_context_edi, %edi
77 pushl saved_context_eflags ; popfl