1 /* SPDX-License-Identifier: GPL-2.0-only */
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 * Added trace_hardirqs callers - Copyright 2007 Steven Rostedt, Red Hat, Inc.
8 #include <linux/linkage.h>
11 #include <asm/export.h>
13 /* rdi: arg1 ... normal C conventions. rax is saved/restored. */
14 .macro THUNK name, func, put_ret_addr_in_rdi=0
15 SYM_FUNC_START_NOALIGN(\name)
29 .if \put_ret_addr_in_rdi
30 /* 8(%rbp) is return addr on stack */
40 #ifdef CONFIG_TRACE_IRQFLAGS
41 THUNK trace_hardirqs_on_thunk,trace_hardirqs_on_caller,1
42 THUNK trace_hardirqs_off_thunk,trace_hardirqs_off_caller,1
45 #ifdef CONFIG_DEBUG_LOCK_ALLOC
46 THUNK lockdep_sys_exit_thunk,lockdep_sys_exit
49 #ifdef CONFIG_PREEMPTION
50 THUNK ___preempt_schedule, preempt_schedule
51 THUNK ___preempt_schedule_notrace, preempt_schedule_notrace
52 EXPORT_SYMBOL(___preempt_schedule)
53 EXPORT_SYMBOL(___preempt_schedule_notrace)
56 #if defined(CONFIG_TRACE_IRQFLAGS) \
57 || defined(CONFIG_DEBUG_LOCK_ALLOC) \
58 || defined(CONFIG_PREEMPTION)
59 SYM_CODE_START_LOCAL_NOALIGN(.L_restore)
71 _ASM_NOKPROBE(.L_restore)
72 SYM_CODE_END(.L_restore)