x86/speculation/mds: Fix documentation typo
[linux/fpc-iii.git] / arch / s390 / kernel / mcount.S
blob27110f3294edcdf30935048d5553f712caf44116
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright IBM Corp. 2008, 2009
4  *
5  *   Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>,
6  *
7  */
9 #include <linux/linkage.h>
10 #include <asm/asm-offsets.h>
11 #include <asm/ftrace.h>
12 #include <asm/nospec-insn.h>
13 #include <asm/ptrace.h>
14 #include <asm/export.h>
16         GEN_BR_THUNK %r1
17         GEN_BR_THUNK %r14
19         .section .kprobes.text, "ax"
21 ENTRY(ftrace_stub)
22         BR_EX   %r14
24 #define STACK_FRAME_SIZE  (STACK_FRAME_OVERHEAD + __PT_SIZE)
25 #define STACK_PTREGS      (STACK_FRAME_OVERHEAD)
26 #define STACK_PTREGS_GPRS (STACK_PTREGS + __PT_GPRS)
27 #define STACK_PTREGS_PSW  (STACK_PTREGS + __PT_PSW)
29 ENTRY(_mcount)
30         BR_EX   %r14
32 EXPORT_SYMBOL(_mcount)
34 ENTRY(ftrace_caller)
35         .globl  ftrace_regs_caller
36         .set    ftrace_regs_caller,ftrace_caller
37         lgr     %r1,%r15
38 #ifndef CC_USING_HOTPATCH
39         aghi    %r0,MCOUNT_RETURN_FIXUP
40 #endif
41         aghi    %r15,-STACK_FRAME_SIZE
42         stg     %r1,__SF_BACKCHAIN(%r15)
43         stg     %r1,(STACK_PTREGS_GPRS+15*8)(%r15)
44         stg     %r0,(STACK_PTREGS_PSW+8)(%r15)
45         stmg    %r2,%r14,(STACK_PTREGS_GPRS+2*8)(%r15)
46 #ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
47         aghik   %r2,%r0,-MCOUNT_INSN_SIZE
48         lgrl    %r4,function_trace_op
49         lgrl    %r1,ftrace_trace_function
50 #else
51         lgr     %r2,%r0
52         aghi    %r2,-MCOUNT_INSN_SIZE
53         larl    %r4,function_trace_op
54         lg      %r4,0(%r4)
55         larl    %r1,ftrace_trace_function
56         lg      %r1,0(%r1)
57 #endif
58         lgr     %r3,%r14
59         la      %r5,STACK_PTREGS(%r15)
60         BASR_EX %r14,%r1
61 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
62 # The j instruction gets runtime patched to a nop instruction.
63 # See ftrace_enable_ftrace_graph_caller.
64 ENTRY(ftrace_graph_caller)
65         j       ftrace_graph_caller_end
66         lg      %r2,(STACK_PTREGS_GPRS+14*8)(%r15)
67         lg      %r3,(STACK_PTREGS_PSW+8)(%r15)
68         brasl   %r14,prepare_ftrace_return
69         stg     %r2,(STACK_PTREGS_GPRS+14*8)(%r15)
70 ftrace_graph_caller_end:
71         .globl  ftrace_graph_caller_end
72 #endif
73         lg      %r1,(STACK_PTREGS_PSW+8)(%r15)
74         lmg     %r2,%r15,(STACK_PTREGS_GPRS+2*8)(%r15)
75         BR_EX   %r1
77 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
79 ENTRY(return_to_handler)
80         stmg    %r2,%r5,32(%r15)
81         lgr     %r1,%r15
82         aghi    %r15,-STACK_FRAME_OVERHEAD
83         stg     %r1,__SF_BACKCHAIN(%r15)
84         brasl   %r14,ftrace_return_to_handler
85         aghi    %r15,STACK_FRAME_OVERHEAD
86         lgr     %r14,%r2
87         lmg     %r2,%r5,32(%r15)
88         BR_EX   %r14
90 #endif