~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/parisc/kernel/ftrace.c

Version: ~ [ linux-5.0-rc6 ] ~ [ linux-4.20.10 ] ~ [ linux-4.19.23 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.101 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.158 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.174 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.134 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.63 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /*
  3  * Code for tracing calls in Linux kernel.
  4  * Copyright (C) 2009-2016 Helge Deller <deller@gmx.de>
  5  *
  6  * based on code for x86 which is:
  7  * Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com>
  8  *
  9  * future possible enhancements:
 10  *      - add CONFIG_DYNAMIC_FTRACE
 11  *      - add CONFIG_STACK_TRACER
 12  */
 13 
 14 #include <linux/init.h>
 15 #include <linux/ftrace.h>
 16 
 17 #include <asm/assembly.h>
 18 #include <asm/sections.h>
 19 #include <asm/ftrace.h>
 20 
 21 
 22 #define __hot __attribute__ ((__section__ (".text.hot")))
 23 
 24 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 25 /*
 26  * Hook the return address and push it in the stack of return addrs
 27  * in current thread info.
 28  */
 29 static void __hot prepare_ftrace_return(unsigned long *parent,
 30                                         unsigned long self_addr)
 31 {
 32         unsigned long old;
 33         extern int parisc_return_to_handler;
 34 
 35         if (unlikely(ftrace_graph_is_dead()))
 36                 return;
 37 
 38         if (unlikely(atomic_read(&current->tracing_graph_pause)))
 39                 return;
 40 
 41         old = *parent;
 42 
 43         if (!function_graph_enter(old, self_addr, 0, NULL))
 44                 /* activate parisc_return_to_handler() as return point */
 45                 *parent = (unsigned long) &parisc_return_to_handler;
 46 }
 47 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
 48 
 49 void notrace __hot ftrace_function_trampoline(unsigned long parent,
 50                                 unsigned long self_addr,
 51                                 unsigned long org_sp_gr3)
 52 {
 53         extern ftrace_func_t ftrace_trace_function;  /* depends on CONFIG_DYNAMIC_FTRACE */
 54         extern int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace);
 55 
 56         if (ftrace_trace_function != ftrace_stub) {
 57                 /* struct ftrace_ops *op, struct pt_regs *regs); */
 58                 ftrace_trace_function(parent, self_addr, NULL, NULL);
 59                 return;
 60         }
 61 
 62 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 63         if (ftrace_graph_return != (trace_func_graph_ret_t) ftrace_stub ||
 64                 ftrace_graph_entry != ftrace_graph_entry_stub) {
 65                 unsigned long *parent_rp;
 66 
 67                 /* calculate pointer to %rp in stack */
 68                 parent_rp = (unsigned long *) (org_sp_gr3 - RP_OFFSET);
 69                 /* sanity check: parent_rp should hold parent */
 70                 if (*parent_rp != parent)
 71                         return;
 72 
 73                 prepare_ftrace_return(parent_rp, self_addr);
 74                 return;
 75         }
 76 #endif
 77 }
 78 
 79 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp