GNU Linux-libre 6.8.7-gnu
[releases.git] / arch / x86 / entry / thunk_64.S
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Save registers before calling assembly functions. This avoids
4  * disturbance of register allocation in some inline assembly constructs.
5  * Copyright 2001,2002 by Andi Kleen, SuSE Labs.
6  */
7 #include <linux/export.h>
8 #include <linux/linkage.h>
9 #include "calling.h"
10 #include <asm/asm.h>
11
12         /* rdi: arg1 ... normal C conventions. rax is saved/restored. */
13         .macro THUNK name, func
14 SYM_FUNC_START(\name)
15         pushq %rbp
16         movq %rsp, %rbp
17
18         pushq %rdi
19         pushq %rsi
20         pushq %rdx
21         pushq %rcx
22         pushq %rax
23         pushq %r8
24         pushq %r9
25         pushq %r10
26         pushq %r11
27
28         call \func
29
30         popq %r11
31         popq %r10
32         popq %r9
33         popq %r8
34         popq %rax
35         popq %rcx
36         popq %rdx
37         popq %rsi
38         popq %rdi
39         popq %rbp
40         RET
41 SYM_FUNC_END(\name)
42         _ASM_NOKPROBE(\name)
43         .endm
44
45 THUNK preempt_schedule_thunk, preempt_schedule
46 THUNK preempt_schedule_notrace_thunk, preempt_schedule_notrace
47 EXPORT_SYMBOL(preempt_schedule_thunk)
48 EXPORT_SYMBOL(preempt_schedule_notrace_thunk)