0001
0002 .text
0003 #include <linux/linkage.h>
0004 #include <linux/objtool.h>
0005 #include <asm/segment.h>
0006 #include <asm/pgtable_types.h>
0007 #include <asm/page_types.h>
0008 #include <asm/msr.h>
0009 #include <asm/asm-offsets.h>
0010 #include <asm/frame.h>
0011 #include <asm/nospec-branch.h>
0012
0013 # Copyright 2003 Pavel Machek <pavel@suse.cz
0014
0015 .code64
0016
0017
0018
0019 SYM_FUNC_START(wakeup_long64)
0020 movq saved_magic, %rax
0021 movq $0x123456789abcdef0, %rdx
0022 cmpq %rdx, %rax
0023 je 2f
0024
0025
0026 movq $0xbad6d61676963, %rcx
0027 1:
0028 jmp 1b
0029 2:
0030 movw $__KERNEL_DS, %ax
0031 movw %ax, %ss
0032 movw %ax, %ds
0033 movw %ax, %es
0034 movw %ax, %fs
0035 movw %ax, %gs
0036 movq saved_rsp, %rsp
0037
0038 movq saved_rbx, %rbx
0039 movq saved_rdi, %rdi
0040 movq saved_rsi, %rsi
0041 movq saved_rbp, %rbp
0042
0043 movq saved_rip, %rax
0044 ANNOTATE_RETPOLINE_SAFE
0045 jmp *%rax
0046 SYM_FUNC_END(wakeup_long64)
0047
0048 SYM_FUNC_START(do_suspend_lowlevel)
0049 FRAME_BEGIN
0050 subq $8, %rsp
0051 xorl %eax, %eax
0052 call save_processor_state
0053
0054 movq $saved_context, %rax
0055 movq %rsp, pt_regs_sp(%rax)
0056 movq %rbp, pt_regs_bp(%rax)
0057 movq %rsi, pt_regs_si(%rax)
0058 movq %rdi, pt_regs_di(%rax)
0059 movq %rbx, pt_regs_bx(%rax)
0060 movq %rcx, pt_regs_cx(%rax)
0061 movq %rdx, pt_regs_dx(%rax)
0062 movq %r8, pt_regs_r8(%rax)
0063 movq %r9, pt_regs_r9(%rax)
0064 movq %r10, pt_regs_r10(%rax)
0065 movq %r11, pt_regs_r11(%rax)
0066 movq %r12, pt_regs_r12(%rax)
0067 movq %r13, pt_regs_r13(%rax)
0068 movq %r14, pt_regs_r14(%rax)
0069 movq %r15, pt_regs_r15(%rax)
0070 pushfq
0071 popq pt_regs_flags(%rax)
0072
0073 movq $.Lresume_point, saved_rip(%rip)
0074
0075 movq %rsp, saved_rsp
0076 movq %rbp, saved_rbp
0077 movq %rbx, saved_rbx
0078 movq %rdi, saved_rdi
0079 movq %rsi, saved_rsi
0080
0081 addq $8, %rsp
0082 movl $3, %edi
0083 xorl %eax, %eax
0084 call x86_acpi_enter_sleep_state
0085
0086 jmp .Lresume_point
0087
0088 .align 4
0089 .Lresume_point:
0090
0091 movq $saved_context, %rax
0092 movq saved_context_cr4(%rax), %rbx
0093 movq %rbx, %cr4
0094 movq saved_context_cr3(%rax), %rbx
0095 movq %rbx, %cr3
0096 movq saved_context_cr2(%rax), %rbx
0097 movq %rbx, %cr2
0098 movq saved_context_cr0(%rax), %rbx
0099 movq %rbx, %cr0
0100 pushq pt_regs_flags(%rax)
0101 popfq
0102 movq pt_regs_sp(%rax), %rsp
0103 movq pt_regs_bp(%rax), %rbp
0104 movq pt_regs_si(%rax), %rsi
0105 movq pt_regs_di(%rax), %rdi
0106 movq pt_regs_bx(%rax), %rbx
0107 movq pt_regs_cx(%rax), %rcx
0108 movq pt_regs_dx(%rax), %rdx
0109 movq pt_regs_r8(%rax), %r8
0110 movq pt_regs_r9(%rax), %r9
0111 movq pt_regs_r10(%rax), %r10
0112 movq pt_regs_r11(%rax), %r11
0113 movq pt_regs_r12(%rax), %r12
0114 movq pt_regs_r13(%rax), %r13
0115 movq pt_regs_r14(%rax), %r14
0116 movq pt_regs_r15(%rax), %r15
0117
0118 #if defined(CONFIG_KASAN) && defined(CONFIG_KASAN_STACK)
0119
0120
0121
0122
0123 movq %rsp, %rdi
0124 call kasan_unpoison_task_stack_below
0125 #endif
0126
0127 xorl %eax, %eax
0128 addq $8, %rsp
0129 FRAME_END
0130 jmp restore_processor_state
0131 SYM_FUNC_END(do_suspend_lowlevel)
0132 STACK_FRAME_NON_STANDARD do_suspend_lowlevel
0133
0134 .data
0135 saved_rbp: .quad 0
0136 saved_rsi: .quad 0
0137 saved_rdi: .quad 0
0138 saved_rbx: .quad 0
0139
0140 saved_rip: .quad 0
0141 saved_rsp: .quad 0
0142
0143 SYM_DATA(saved_magic, .quad 0)