Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | .text |
2 | #include <linux/linkage.h> | |
3 | #include <asm/segment.h> | |
0341c14d JF |
4 | #include <asm/pgtable_types.h> |
5 | #include <asm/page_types.h> | |
1da177e4 | 6 | #include <asm/msr.h> |
0de80bcc | 7 | #include <asm/asm-offsets.h> |
1da177e4 LT |
8 | |
9 | # Copyright 2003 Pavel Machek <pavel@suse.cz>, distribute under GPLv2 | |
1da177e4 LT |
10 | |
11 | .code64 | |
1da177e4 | 12 | /* |
e44b7b75 | 13 | * Hooray, we are in Long 64-bit mode (but still running in low memory) |
1da177e4 | 14 | */ |
e44b7b75 | 15 | ENTRY(wakeup_long64) |
e44b7b75 PM |
16 | movq saved_magic, %rax |
17 | movq $0x123456789abcdef0, %rdx | |
18 | cmpq %rdx, %rax | |
19 | jne bogus_64_magic | |
d8e1baf1 | 20 | |
1da177e4 LT |
21 | movw $__KERNEL_DS, %ax |
22 | movw %ax, %ss | |
23 | movw %ax, %ds | |
24 | movw %ax, %es | |
25 | movw %ax, %fs | |
26 | movw %ax, %gs | |
7db681d7 | 27 | movq saved_rsp, %rsp |
1da177e4 | 28 | |
7db681d7 VG |
29 | movq saved_rbx, %rbx |
30 | movq saved_rdi, %rdi | |
31 | movq saved_rsi, %rsi | |
32 | movq saved_rbp, %rbp | |
1da177e4 | 33 | |
7db681d7 | 34 | movq saved_rip, %rax |
1da177e4 | 35 | jmp *%rax |
e6bd6760 | 36 | ENDPROC(wakeup_long64) |
1da177e4 | 37 | |
d8e1baf1 | 38 | bogus_64_magic: |
e44b7b75 | 39 | jmp bogus_64_magic |
1da177e4 | 40 | |
e6bd6760 | 41 | ENTRY(do_suspend_lowlevel) |
1da177e4 LT |
42 | subq $8, %rsp |
43 | xorl %eax, %eax | |
44 | call save_processor_state | |
45 | ||
0de80bcc | 46 | movq $saved_context, %rax |
65ea5b03 PA |
47 | movq %rsp, pt_regs_sp(%rax) |
48 | movq %rbp, pt_regs_bp(%rax) | |
49 | movq %rsi, pt_regs_si(%rax) | |
50 | movq %rdi, pt_regs_di(%rax) | |
51 | movq %rbx, pt_regs_bx(%rax) | |
52 | movq %rcx, pt_regs_cx(%rax) | |
53 | movq %rdx, pt_regs_dx(%rax) | |
0de80bcc RW |
54 | movq %r8, pt_regs_r8(%rax) |
55 | movq %r9, pt_regs_r9(%rax) | |
56 | movq %r10, pt_regs_r10(%rax) | |
57 | movq %r11, pt_regs_r11(%rax) | |
58 | movq %r12, pt_regs_r12(%rax) | |
59 | movq %r13, pt_regs_r13(%rax) | |
60 | movq %r14, pt_regs_r14(%rax) | |
61 | movq %r15, pt_regs_r15(%rax) | |
62 | pushfq | |
65ea5b03 | 63 | popq pt_regs_flags(%rax) |
1da177e4 | 64 | |
e6bd6760 | 65 | movq $resume_point, saved_rip(%rip) |
1da177e4 | 66 | |
0de80bcc RW |
67 | movq %rsp, saved_rsp |
68 | movq %rbp, saved_rbp | |
69 | movq %rbx, saved_rbx | |
70 | movq %rdi, saved_rdi | |
71 | movq %rsi, saved_rsi | |
1da177e4 LT |
72 | |
73 | addq $8, %rsp | |
74 | movl $3, %edi | |
75 | xorl %eax, %eax | |
6defa2fe JS |
76 | call acpi_enter_sleep_state |
77 | /* in case something went wrong, restore the machine status and go on */ | |
78 | jmp resume_point | |
0de80bcc | 79 | |
e6bd6760 JS |
80 | .align 4 |
81 | resume_point: | |
0de80bcc RW |
82 | /* We don't restore %rax, it must be 0 anyway */ |
83 | movq $saved_context, %rax | |
84 | movq saved_context_cr4(%rax), %rbx | |
85 | movq %rbx, %cr4 | |
86 | movq saved_context_cr3(%rax), %rbx | |
87 | movq %rbx, %cr3 | |
88 | movq saved_context_cr2(%rax), %rbx | |
89 | movq %rbx, %cr2 | |
90 | movq saved_context_cr0(%rax), %rbx | |
91 | movq %rbx, %cr0 | |
65ea5b03 | 92 | pushq pt_regs_flags(%rax) |
0de80bcc | 93 | popfq |
65ea5b03 PA |
94 | movq pt_regs_sp(%rax), %rsp |
95 | movq pt_regs_bp(%rax), %rbp | |
96 | movq pt_regs_si(%rax), %rsi | |
97 | movq pt_regs_di(%rax), %rdi | |
98 | movq pt_regs_bx(%rax), %rbx | |
99 | movq pt_regs_cx(%rax), %rcx | |
100 | movq pt_regs_dx(%rax), %rdx | |
0de80bcc RW |
101 | movq pt_regs_r8(%rax), %r8 |
102 | movq pt_regs_r9(%rax), %r9 | |
103 | movq pt_regs_r10(%rax), %r10 | |
104 | movq pt_regs_r11(%rax), %r11 | |
105 | movq pt_regs_r12(%rax), %r12 | |
106 | movq pt_regs_r13(%rax), %r13 | |
107 | movq pt_regs_r14(%rax), %r14 | |
108 | movq pt_regs_r15(%rax), %r15 | |
1da177e4 LT |
109 | |
110 | xorl %eax, %eax | |
111 | addq $8, %rsp | |
112 | jmp restore_processor_state | |
e6bd6760 JS |
113 | ENDPROC(do_suspend_lowlevel) |
114 | ||
1da177e4 | 115 | .data |
7db681d7 VG |
116 | ENTRY(saved_rbp) .quad 0 |
117 | ENTRY(saved_rsi) .quad 0 | |
118 | ENTRY(saved_rdi) .quad 0 | |
119 | ENTRY(saved_rbx) .quad 0 | |
1da177e4 | 120 | |
7db681d7 VG |
121 | ENTRY(saved_rip) .quad 0 |
122 | ENTRY(saved_rsp) .quad 0 | |
1da177e4 LT |
123 | |
124 | ENTRY(saved_magic) .quad 0 |