diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/i386/power/swsusp.S |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/i386/power/swsusp.S')
-rw-r--r-- | arch/i386/power/swsusp.S | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/arch/i386/power/swsusp.S b/arch/i386/power/swsusp.S new file mode 100644 index 000000000000..c4105286ff26 --- /dev/null +++ b/arch/i386/power/swsusp.S | |||
@@ -0,0 +1,73 @@ | |||
1 | .text | ||
2 | |||
3 | /* Originally gcc generated, modified by hand | ||
4 | * | ||
5 | * This may not use any stack, nor any variable that is not "NoSave": | ||
6 | * | ||
7 | * Its rewriting one kernel image with another. What is stack in "old" | ||
8 | * image could very well be data page in "new" image, and overwriting | ||
9 | * your own stack under you is bad idea. | ||
10 | */ | ||
11 | |||
12 | #include <linux/linkage.h> | ||
13 | #include <asm/segment.h> | ||
14 | #include <asm/page.h> | ||
15 | #include <asm/asm_offsets.h> | ||
16 | |||
17 | .text | ||
18 | |||
19 | ENTRY(swsusp_arch_suspend) | ||
20 | |||
21 | movl %esp, saved_context_esp | ||
22 | movl %ebx, saved_context_ebx | ||
23 | movl %ebp, saved_context_ebp | ||
24 | movl %esi, saved_context_esi | ||
25 | movl %edi, saved_context_edi | ||
26 | pushfl ; popl saved_context_eflags | ||
27 | |||
28 | call swsusp_save | ||
29 | ret | ||
30 | |||
31 | ENTRY(swsusp_arch_resume) | ||
32 | movl $swsusp_pg_dir-__PAGE_OFFSET, %ecx | ||
33 | movl %ecx, %cr3 | ||
34 | |||
35 | movl pagedir_nosave, %edx | ||
36 | .p2align 4,,7 | ||
37 | |||
38 | copy_loop: | ||
39 | testl %edx, %edx | ||
40 | jz done | ||
41 | |||
42 | movl pbe_address(%edx), %esi | ||
43 | movl pbe_orig_address(%edx), %edi | ||
44 | |||
45 | movl $1024, %ecx | ||
46 | rep | ||
47 | movsl | ||
48 | |||
49 | movl pbe_next(%edx), %edx | ||
50 | jmp copy_loop | ||
51 | .p2align 4,,7 | ||
52 | |||
53 | done: | ||
54 | /* Flush TLB, including "global" things (vmalloc) */ | ||
55 | movl mmu_cr4_features, %eax | ||
56 | movl %eax, %edx | ||
57 | andl $~(1<<7), %edx; # PGE | ||
58 | movl %edx, %cr4; # turn off PGE | ||
59 | movl %cr3, %ecx; # flush TLB | ||
60 | movl %ecx, %cr3 | ||
61 | movl %eax, %cr4; # turn PGE back on | ||
62 | |||
63 | movl saved_context_esp, %esp | ||
64 | movl saved_context_ebp, %ebp | ||
65 | movl saved_context_ebx, %ebx | ||
66 | movl saved_context_esi, %esi | ||
67 | movl saved_context_edi, %edi | ||
68 | |||
69 | pushl saved_context_eflags ; popfl | ||
70 | |||
71 | xorl %eax, %eax | ||
72 | |||
73 | ret | ||