Merge tag 'perf-urgent-for-mingo-20160418' of git://git.kernel.org/pub/scm/linux...
[deliverable/linux.git] / arch / x86 / entry / thunk_64.S
CommitLineData
cc1e684a
AK
1/*
2 * Save registers before calling assembly functions. This avoids
3 * disturbance of register allocation in some inline assembly constructs.
4 * Copyright 2001,2002 by Andi Kleen, SuSE Labs.
81d68a96 5 * Added trace_hardirqs callers - Copyright 2007 Steven Rostedt, Red Hat, Inc.
cc1e684a
AK
6 * Subject to the GNU public license, v.2. No warranty of any kind.
7 */
38e6b75d 8#include <linux/linkage.h>
d36f9479 9#include "calling.h"
98def1de 10#include <asm/asm.h>
058fb732 11#include <asm/frame.h>
1da177e4 12
38e6b75d
BP
13 /* rdi: arg1 ... normal C conventions. rax is saved/restored. */
14 .macro THUNK name, func, put_ret_addr_in_rdi=0
81d68a96 15 .globl \name
058fb732 16 .type \name, @function
81d68a96 17\name:
058fb732 18 FRAME_BEGIN
38e6b75d
BP
19
20 /* this one pushes 9 elems, the next one would be %rIP */
131484c8
IM
21 pushq %rdi
22 pushq %rsi
23 pushq %rdx
24 pushq %rcx
25 pushq %rax
26 pushq %r8
27 pushq %r9
28 pushq %r10
29 pushq %r11
38e6b75d
BP
30
31 .if \put_ret_addr_in_rdi
69e8544c 32 /* 9*8(%rsp) is return addr on stack */
131484c8 33 movq 9*8(%rsp), %rdi
38e6b75d
BP
34 .endif
35
81d68a96
SR
36 call \func
37 jmp restore
98def1de 38 _ASM_NOKPROBE(\name)
81d68a96
SR
39 .endm
40
38e6b75d
BP
41#ifdef CONFIG_TRACE_IRQFLAGS
42 THUNK trace_hardirqs_on_thunk,trace_hardirqs_on_caller,1
43 THUNK trace_hardirqs_off_thunk,trace_hardirqs_off_caller,1
6375e2b7 44#endif
10cd706d
PZ
45
46#ifdef CONFIG_DEBUG_LOCK_ALLOC
38e6b75d 47 THUNK lockdep_sys_exit_thunk,lockdep_sys_exit
10cd706d 48#endif
38e6b75d 49
0ad6e3c5
ON
50#ifdef CONFIG_PREEMPT
51 THUNK ___preempt_schedule, preempt_schedule
4eaca0a8 52 THUNK ___preempt_schedule_notrace, preempt_schedule_notrace
0ad6e3c5
ON
53#endif
54
69e8544c
DV
55#if defined(CONFIG_TRACE_IRQFLAGS) \
56 || defined(CONFIG_DEBUG_LOCK_ALLOC) \
57 || defined(CONFIG_PREEMPT)
1da177e4 58restore:
131484c8
IM
59 popq %r11
60 popq %r10
61 popq %r9
62 popq %r8
63 popq %rax
64 popq %rcx
65 popq %rdx
66 popq %rsi
67 popq %rdi
058fb732 68 FRAME_END
38e6b75d 69 ret
98def1de 70 _ASM_NOKPROBE(restore)
69e8544c 71#endif
This page took 0.740295 seconds and 5 git commands to generate.