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>
|
2014-04-17 16:17:26 +08:00
|
|
|
#include <asm/asm.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 */
|
2015-02-27 06:40:25 +08: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-06-01 04:21:54 +08:00
|
|
|
|
|
|
|
.if \put_ret_addr_in_rdi
|
2015-02-27 06:40:24 +08:00
|
|
|
/* 9*8(%rsp) is return addr on stack */
|
2011-06-01 04:21:54 +08:00
|
|
|
movq_cfi_restore 9*8, rdi
|
|
|
|
.endif
|
|
|
|
|
2008-05-13 03:20:42 +08:00
|
|
|
call \func
|
|
|
|
jmp restore
|
|
|
|
CFI_ENDPROC
|
2014-04-17 16:17:26 +08:00
|
|
|
_ASM_NOKPROBE(\name)
|
2008-05-13 03:20:42 +08:00
|
|
|
.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
|
|
|
|
2014-09-22 02:41:53 +08:00
|
|
|
#ifdef CONFIG_PREEMPT
|
|
|
|
THUNK ___preempt_schedule, preempt_schedule
|
|
|
|
#ifdef CONFIG_CONTEXT_TRACKING
|
|
|
|
THUNK ___preempt_schedule_context, preempt_schedule_context
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2015-02-27 06:40:24 +08:00
|
|
|
#if defined(CONFIG_TRACE_IRQFLAGS) \
|
|
|
|
|| defined(CONFIG_DEBUG_LOCK_ALLOC) \
|
|
|
|
|| defined(CONFIG_PREEMPT)
|
2005-04-17 06:20:36 +08:00
|
|
|
CFI_STARTPROC
|
2015-02-27 06:40:24 +08:00
|
|
|
CFI_ADJUST_CFA_OFFSET 9*8
|
2005-04-17 06:20:36 +08:00
|
|
|
restore:
|
2015-02-27 06:40:25 +08: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-06-01 04:21:54 +08:00
|
|
|
ret
|
2005-04-17 06:20:36 +08:00
|
|
|
CFI_ENDPROC
|
2014-04-17 16:17:26 +08:00
|
|
|
_ASM_NOKPROBE(restore)
|
2015-02-27 06:40:24 +08:00
|
|
|
#endif
|