1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <linux/linkage.h>
4 #include <asm/segment.h>
5 #include <asm/pgtable_types.h>
6 #include <asm/page_types.h>
8 #include <asm/asm-offsets.h>
11 # Copyright 2003 Pavel Machek <pavel@suse.cz
15 * Hooray, we are in Long 64-bit mode (but still running in low memory)
17 SYM_FUNC_START(wakeup_long64)
18 movq saved_magic, %rax
19 movq $0x123456789abcdef0, %rdx
23 /* stop here on a saved_magic mismatch */
24 movq $0xbad6d61676963, %rcx
28 movw $__KERNEL_DS, %ax
43 SYM_FUNC_END(wakeup_long64)
45 SYM_FUNC_START(do_suspend_lowlevel)
49 call save_processor_state
51 movq $saved_context, %rax
52 movq %rsp, pt_regs_sp(%rax)
53 movq %rbp, pt_regs_bp(%rax)
54 movq %rsi, pt_regs_si(%rax)
55 movq %rdi, pt_regs_di(%rax)
56 movq %rbx, pt_regs_bx(%rax)
57 movq %rcx, pt_regs_cx(%rax)
58 movq %rdx, pt_regs_dx(%rax)
59 movq %r8, pt_regs_r8(%rax)
60 movq %r9, pt_regs_r9(%rax)
61 movq %r10, pt_regs_r10(%rax)
62 movq %r11, pt_regs_r11(%rax)
63 movq %r12, pt_regs_r12(%rax)
64 movq %r13, pt_regs_r13(%rax)
65 movq %r14, pt_regs_r14(%rax)
66 movq %r15, pt_regs_r15(%rax)
68 popq pt_regs_flags(%rax)
70 movq $.Lresume_point, saved_rip(%rip)
81 call x86_acpi_enter_sleep_state
82 /* in case something went wrong, restore the machine status and go on */
87 /* We don't restore %rax, it must be 0 anyway */
88 movq $saved_context, %rax
89 movq saved_context_cr4(%rax), %rbx
91 movq saved_context_cr3(%rax), %rbx
93 movq saved_context_cr2(%rax), %rbx
95 movq saved_context_cr0(%rax), %rbx
97 pushq pt_regs_flags(%rax)
99 movq pt_regs_sp(%rax), %rsp
100 movq pt_regs_bp(%rax), %rbp
101 movq pt_regs_si(%rax), %rsi
102 movq pt_regs_di(%rax), %rdi
103 movq pt_regs_bx(%rax), %rbx
104 movq pt_regs_cx(%rax), %rcx
105 movq pt_regs_dx(%rax), %rdx
106 movq pt_regs_r8(%rax), %r8
107 movq pt_regs_r9(%rax), %r9
108 movq pt_regs_r10(%rax), %r10
109 movq pt_regs_r11(%rax), %r11
110 movq pt_regs_r12(%rax), %r12
111 movq pt_regs_r13(%rax), %r13
112 movq pt_regs_r14(%rax), %r14
113 movq pt_regs_r15(%rax), %r15
115 #if defined(CONFIG_KASAN) && CONFIG_KASAN_STACK
117 * The suspend path may have poisoned some areas deeper in the stack,
118 * which we now need to unpoison.
121 call kasan_unpoison_task_stack_below
127 jmp restore_processor_state
128 SYM_FUNC_END(do_suspend_lowlevel)
139 SYM_DATA(saved_magic, .quad 0)