2006-09-26 08:52:29 +00: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-12 19:20:42 +00:00
|
|
|
* Added trace_hardirqs callers - Copyright 2007 Steven Rostedt, Red Hat, Inc.
|
2006-09-26 08:52:29 +00:00
|
|
|
* Subject to the GNU public license, v.2. No warranty of any kind.
|
|
|
|
*/
|
2011-05-31 20:21:54 +00:00
|
|
|
#include <linux/linkage.h>
|
|
|
|
#include <asm/dwarf2.h>
|
|
|
|
#include <asm/calling.h>
|
2014-04-17 08:17:26 +00:00
|
|
|
#include <asm/asm.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2011-05-31 20:21:54 +00:00
|
|
|
/* rdi: arg1 ... normal C conventions. rax is saved/restored. */
|
|
|
|
.macro THUNK name, func, put_ret_addr_in_rdi=0
|
2008-05-12 19:20:42 +00:00
|
|
|
.globl \name
|
|
|
|
\name:
|
|
|
|
CFI_STARTPROC
|
2011-05-31 20:21:54 +00:00
|
|
|
|
|
|
|
/* this one pushes 9 elems, the next one would be %rIP */
|
2015-02-26 22:40:25 +00:00
|
|
|
pushq_cfi_reg rdi
|
|
|
|
pushq_cfi_reg rsi
|
|
|
|
pushq_cfi_reg rdx
|
|
|
|
pushq_cfi_reg rcx
|
|
|
|
pushq_cfi_reg rax
|
|
|
|
pushq_cfi_reg r8
|
|
|
|
pushq_cfi_reg r9
|
|
|
|
pushq_cfi_reg r10
|
|
|
|
pushq_cfi_reg r11
|
2011-05-31 20:21:54 +00:00
|
|
|
|
|
|
|
.if \put_ret_addr_in_rdi
|
2015-02-26 22:40:24 +00:00
|
|
|
/* 9*8(%rsp) is return addr on stack */
|
2011-05-31 20:21:54 +00:00
|
|
|
movq_cfi_restore 9*8, rdi
|
|
|
|
.endif
|
|
|
|
|
2008-05-12 19:20:42 +00:00
|
|
|
call \func
|
|
|
|
jmp restore
|
|
|
|
CFI_ENDPROC
|
2014-04-17 08:17:26 +00:00
|
|
|
_ASM_NOKPROBE(\name)
|
2008-05-12 19:20:42 +00:00
|
|
|
.endm
|
|
|
|
|
2011-05-31 20:21:54 +00: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 07:24:45 +00:00
|
|
|
#endif
|
2007-10-11 20:11:12 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
2011-05-31 20:21:54 +00:00
|
|
|
THUNK lockdep_sys_exit_thunk,lockdep_sys_exit
|
2007-10-11 20:11:12 +00:00
|
|
|
#endif
|
2011-05-31 20:21:54 +00:00
|
|
|
|
2014-09-21 18:41:53 +00:00
|
|
|
#ifdef CONFIG_PREEMPT
|
|
|
|
THUNK ___preempt_schedule, preempt_schedule
|
|
|
|
#ifdef CONFIG_CONTEXT_TRACKING
|
|
|
|
THUNK ___preempt_schedule_context, preempt_schedule_context
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2015-02-26 22:40:24 +00:00
|
|
|
#if defined(CONFIG_TRACE_IRQFLAGS) \
|
|
|
|
|| defined(CONFIG_DEBUG_LOCK_ALLOC) \
|
|
|
|
|| defined(CONFIG_PREEMPT)
|
2005-04-16 22:20:36 +00:00
|
|
|
CFI_STARTPROC
|
2015-02-26 22:40:24 +00:00
|
|
|
CFI_ADJUST_CFA_OFFSET 9*8
|
2005-04-16 22:20:36 +00:00
|
|
|
restore:
|
2015-02-26 22:40:25 +00:00
|
|
|
popq_cfi_reg r11
|
|
|
|
popq_cfi_reg r10
|
|
|
|
popq_cfi_reg r9
|
|
|
|
popq_cfi_reg r8
|
|
|
|
popq_cfi_reg rax
|
|
|
|
popq_cfi_reg rcx
|
|
|
|
popq_cfi_reg rdx
|
|
|
|
popq_cfi_reg rsi
|
|
|
|
popq_cfi_reg rdi
|
2011-05-31 20:21:54 +00:00
|
|
|
ret
|
2005-04-16 22:20:36 +00:00
|
|
|
CFI_ENDPROC
|
2014-04-17 08:17:26 +00:00
|
|
|
_ASM_NOKPROBE(restore)
|
2015-02-26 22:40:24 +00:00
|
|
|
#endif
|