linux/arch/s390/kernel/mcount.S
<<
>>
Prefs
   1/*
   2 * Copyright IBM Corp. 2008,2009
   3 *
   4 *   Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>,
   5 *
   6 */
   7
   8#include <asm/asm-offsets.h>
   9
  10        .section .kprobes.text, "ax"
  11
  12        .globl ftrace_stub
  13ftrace_stub:
  14        br      %r14
  15
  16        .globl _mcount
  17_mcount:
  18#ifdef CONFIG_DYNAMIC_FTRACE
  19        br      %r14
  20
  21        .globl ftrace_caller
  22ftrace_caller:
  23#endif
  24        stm     %r2,%r5,16(%r15)
  25        bras    %r1,2f
  260:      .long   ftrace_trace_function
  271:      .long   function_trace_stop
  282:      l       %r2,1b-0b(%r1)
  29        icm     %r2,0xf,0(%r2)
  30        jnz     3f
  31        st      %r14,56(%r15)
  32        lr      %r0,%r15
  33        ahi     %r15,-96
  34        l       %r3,100(%r15)
  35        la      %r2,0(%r14)
  36        st      %r0,__SF_BACKCHAIN(%r15)
  37        la      %r3,0(%r3)
  38        l       %r14,0b-0b(%r1)
  39        l       %r14,0(%r14)
  40        basr    %r14,%r14
  41#ifdef CONFIG_FUNCTION_GRAPH_TRACER
  42        l       %r2,100(%r15)
  43        l       %r3,152(%r15)
  44        .globl  ftrace_graph_caller
  45ftrace_graph_caller:
  46# The bras instruction gets runtime patched to call prepare_ftrace_return.
  47# See ftrace_enable_ftrace_graph_caller. The patched instruction is:
  48#       bras    %r14,prepare_ftrace_return
  49        bras    %r14,0f
  500:      st      %r2,100(%r15)
  51#endif
  52        ahi     %r15,96
  53        l       %r14,56(%r15)
  543:      lm      %r2,%r5,16(%r15)
  55        br      %r14
  56
  57#ifdef CONFIG_FUNCTION_GRAPH_TRACER
  58
  59        .globl  return_to_handler
  60return_to_handler:
  61        stm     %r2,%r5,16(%r15)
  62        st      %r14,56(%r15)
  63        lr      %r0,%r15
  64        ahi     %r15,-96
  65        st      %r0,__SF_BACKCHAIN(%r15)
  66        bras    %r1,0f
  67        .long   ftrace_return_to_handler
  680:      l       %r2,0b-0b(%r1)
  69        basr    %r14,%r2
  70        lr      %r14,%r2
  71        ahi     %r15,96
  72        lm      %r2,%r5,16(%r15)
  73        br      %r14
  74
  75#endif
  76