2006-09-26 16:52:29 +08:00
|
|
|
/*
|
|
|
|
* Save registers before calling assembly functions. This avoids
|
|
|
|
* disturbance of register allocation in some inline assembly constructs.
|
|
|
|
* Copyright 2001,2002 by Andi Kleen, SuSE Labs.
|
2008-05-13 03:20:42 +08:00
|
|
|
* Added trace_hardirqs callers - Copyright 2007 Steven Rostedt, Red Hat, Inc.
|
2006-09-26 16:52:29 +08:00
|
|
|
* Subject to the GNU public license, v.2. No warranty of any kind.
|
|
|
|
*/
|
2011-06-01 04:21:54 +08:00
|
|
|
#include <linux/linkage.h>
|
|
|
|
#include <asm/dwarf2.h>
|
|
|
|
#include <asm/calling.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2011-06-01 04:21:54 +08:00
|
|
|
/* rdi: arg1 ... normal C conventions. rax is saved/restored. */
|
|
|
|
.macro THUNK name, func, put_ret_addr_in_rdi=0
|
2008-05-13 03:20:42 +08:00
|
|
|
.globl \name
|
|
|
|
\name:
|
|
|
|
CFI_STARTPROC
|
2011-06-01 04:21:54 +08:00
|
|
|
|
|
|
|
/* this one pushes 9 elems, the next one would be %rIP */
|
2008-05-13 03:20:42 +08:00
|
|
|
SAVE_ARGS
|
2011-06-01 04:21:54 +08:00
|
|
|
|
|
|
|
.if \put_ret_addr_in_rdi
|
|
|
|
movq_cfi_restore 9*8, rdi
|
|
|
|
.endif
|
|
|
|
|
2008-05-13 03:20:42 +08:00
|
|
|
call \func
|
|
|
|
jmp restore
|
|
|
|
CFI_ENDPROC
|
|
|
|
.endm
|
|
|
|
|
2011-06-01 04:21:54 +08:00
|
|
|
#ifdef CONFIG_TRACE_IRQFLAGS
|
|
|
|
THUNK trace_hardirqs_on_thunk,trace_hardirqs_on_caller,1
|
|
|
|
THUNK trace_hardirqs_off_thunk,trace_hardirqs_off_caller,1
|
2006-07-03 15:24:45 +08:00
|
|
|
#endif
|
2007-10-12 04:11:12 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
2011-06-01 04:21:54 +08:00
|
|
|
THUNK lockdep_sys_exit_thunk,lockdep_sys_exit
|
2007-10-12 04:11:12 +08:00
|
|
|
#endif
|
2011-06-01 04:21:54 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* SAVE_ARGS below is used only for the .cfi directives it contains. */
|
|
|
|
CFI_STARTPROC
|
|
|
|
SAVE_ARGS
|
|
|
|
restore:
|
|
|
|
RESTORE_ARGS
|
2011-06-01 04:21:54 +08:00
|
|
|
ret
|
2005-04-17 06:20:36 +08:00
|
|
|
CFI_ENDPROC
|