.. | .. |
---|
12 | 12 | #include <asm/page_types.h> |
---|
13 | 13 | #include <asm/asm-offsets.h> |
---|
14 | 14 | #include <asm/processor-flags.h> |
---|
| 15 | +#include <asm/frame.h> |
---|
15 | 16 | |
---|
16 | 17 | .text |
---|
17 | 18 | |
---|
18 | | -ENTRY(swsusp_arch_suspend) |
---|
| 19 | +SYM_FUNC_START(swsusp_arch_suspend) |
---|
19 | 20 | movl %esp, saved_context_esp |
---|
20 | 21 | movl %ebx, saved_context_ebx |
---|
21 | 22 | movl %ebp, saved_context_ebp |
---|
.. | .. |
---|
24 | 25 | pushfl |
---|
25 | 26 | popl saved_context_eflags |
---|
26 | 27 | |
---|
27 | | - call swsusp_save |
---|
28 | | - ret |
---|
| 28 | + /* save cr3 */ |
---|
| 29 | + movl %cr3, %eax |
---|
| 30 | + movl %eax, restore_cr3 |
---|
29 | 31 | |
---|
30 | | -ENTRY(restore_image) |
---|
| 32 | + FRAME_BEGIN |
---|
| 33 | + call swsusp_save |
---|
| 34 | + FRAME_END |
---|
| 35 | + RET |
---|
| 36 | +SYM_FUNC_END(swsusp_arch_suspend) |
---|
| 37 | + |
---|
| 38 | +SYM_CODE_START(restore_image) |
---|
| 39 | + /* prepare to jump to the image kernel */ |
---|
| 40 | + movl restore_jump_address, %ebx |
---|
| 41 | + movl restore_cr3, %ebp |
---|
| 42 | + |
---|
31 | 43 | movl mmu_cr4_features, %ecx |
---|
32 | | - movl resume_pg_dir, %eax |
---|
33 | | - subl $__PAGE_OFFSET, %eax |
---|
| 44 | + |
---|
| 45 | + /* jump to relocated restore code */ |
---|
| 46 | + movl relocated_restore_code, %eax |
---|
| 47 | + jmpl *%eax |
---|
| 48 | +SYM_CODE_END(restore_image) |
---|
| 49 | + |
---|
| 50 | +/* code below has been relocated to a safe page */ |
---|
| 51 | +SYM_CODE_START(core_restore_code) |
---|
| 52 | + movl temp_pgt, %eax |
---|
34 | 53 | movl %eax, %cr3 |
---|
35 | 54 | |
---|
36 | 55 | jecxz 1f # cr4 Pentium and higher, skip if zero |
---|
.. | .. |
---|
49 | 68 | movl pbe_address(%edx), %esi |
---|
50 | 69 | movl pbe_orig_address(%edx), %edi |
---|
51 | 70 | |
---|
52 | | - movl $1024, %ecx |
---|
| 71 | + movl $(PAGE_SIZE >> 2), %ecx |
---|
53 | 72 | rep |
---|
54 | 73 | movsl |
---|
55 | 74 | |
---|
.. | .. |
---|
58 | 77 | .p2align 4,,7 |
---|
59 | 78 | |
---|
60 | 79 | done: |
---|
| 80 | + jmpl *%ebx |
---|
| 81 | +SYM_CODE_END(core_restore_code) |
---|
| 82 | + |
---|
| 83 | + /* code below belongs to the image kernel */ |
---|
| 84 | + .align PAGE_SIZE |
---|
| 85 | +SYM_FUNC_START(restore_registers) |
---|
61 | 86 | /* go back to the original page tables */ |
---|
62 | | - movl $swapper_pg_dir, %eax |
---|
63 | | - subl $__PAGE_OFFSET, %eax |
---|
64 | | - movl %eax, %cr3 |
---|
| 87 | + movl %ebp, %cr3 |
---|
65 | 88 | movl mmu_cr4_features, %ecx |
---|
66 | 89 | jecxz 1f # cr4 Pentium and higher, skip if zero |
---|
67 | 90 | movl %ecx, %cr4; # turn PGE back on |
---|
.. | .. |
---|
82 | 105 | |
---|
83 | 106 | xorl %eax, %eax |
---|
84 | 107 | |
---|
85 | | - ret |
---|
| 108 | + /* tell the hibernation core that we've just restored the memory */ |
---|
| 109 | + movl %eax, in_suspend |
---|
| 110 | + |
---|
| 111 | + RET |
---|
| 112 | +SYM_FUNC_END(restore_registers) |
---|