blob: fee6bc79b987faf56353ee367ca2aac61a87d49a [file] [log] [blame]
Steven Rostedt81d68a92008-05-12 21:20:42 +02001/*
2 * Trampoline to trace irqs off. (otherwise CALLER_ADDR1 might crash)
3 * Copyright 2008 by Steven Rostedt, Red Hat, Inc
4 * (inspired by Andi Kleen's thunk_64.S)
5 * Subject to the GNU public license, v.2. No warranty of any kind.
6 */
Steven Rostedt81d68a92008-05-12 21:20:42 +02007 #include <linux/linkage.h>
Masami Hiramatsu98def1d2014-04-17 17:17:26 +09008 #include <asm/asm.h>
Al Viro784d5692016-01-11 11:04:34 -05009 #include <asm/export.h>
Steven Rostedt81d68a92008-05-12 21:20:42 +020010
Steven Rostedt81d68a92008-05-12 21:20:42 +020011 /* put return address in eax (arg1) */
Oleg Nesterov0ad6e3c2014-09-21 20:41:53 +020012 .macro THUNK name, func, put_ret_addr_in_eax=0
Steven Rostedt81d68a92008-05-12 21:20:42 +020013 .globl \name
14\name:
Ingo Molnar131484c2015-05-28 12:21:47 +020015 pushl %eax
16 pushl %ecx
17 pushl %edx
Oleg Nesterov0ad6e3c2014-09-21 20:41:53 +020018
19 .if \put_ret_addr_in_eax
Steven Rostedt81d68a92008-05-12 21:20:42 +020020 /* Place EIP in the arg1 */
21 movl 3*4(%esp), %eax
Oleg Nesterov0ad6e3c2014-09-21 20:41:53 +020022 .endif
23
Steven Rostedt81d68a92008-05-12 21:20:42 +020024 call \func
Ingo Molnar131484c2015-05-28 12:21:47 +020025 popl %edx
26 popl %ecx
27 popl %eax
Steven Rostedt81d68a92008-05-12 21:20:42 +020028 ret
Masami Hiramatsu98def1d2014-04-17 17:17:26 +090029 _ASM_NOKPROBE(\name)
Steven Rostedt81d68a92008-05-12 21:20:42 +020030 .endm
31
Oleg Nesterov0ad6e3c2014-09-21 20:41:53 +020032#ifdef CONFIG_TRACE_IRQFLAGS
33 THUNK trace_hardirqs_on_thunk,trace_hardirqs_on_caller,1
34 THUNK trace_hardirqs_off_thunk,trace_hardirqs_off_caller,1
Steven Rostedt81d68a92008-05-12 21:20:42 +020035#endif
Oleg Nesterov0ad6e3c2014-09-21 20:41:53 +020036
37#ifdef CONFIG_PREEMPT
38 THUNK ___preempt_schedule, preempt_schedule
Frederic Weisbecker4eaca0a2015-06-04 17:39:08 +020039 THUNK ___preempt_schedule_notrace, preempt_schedule_notrace
Al Viro784d5692016-01-11 11:04:34 -050040 EXPORT_SYMBOL(___preempt_schedule)
41 EXPORT_SYMBOL(___preempt_schedule_notrace)
Oleg Nesterov0ad6e3c2014-09-21 20:41:53 +020042#endif
43