riscv/ftrace: Add ARCH_SUPPORTS_FTRACE_OPS support
authorAlan Kao <alankao@andestech.com>
Tue, 13 Feb 2018 05:13:19 +0000 (13:13 +0800)
committerPalmer Dabbelt <palmer@sifive.com>
Tue, 3 Apr 2018 02:59:12 +0000 (19:59 -0700)
Cc: Greentime Hu <greentime@andestech.com>
Signed-off-by: Alan Kao <alankao@andestech.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
arch/riscv/include/asm/ftrace.h
arch/riscv/kernel/mcount-dyn.S

index 078743aacfd3dd66d1766b09b9dace6b9c869509..fedadc40e3589a74c084de846507f1617dd5f1fb 100644 (file)
@@ -9,6 +9,7 @@
 #define HAVE_FUNCTION_GRAPH_FP_TEST
 #endif
 
+#define ARCH_SUPPORTS_FTRACE_OPS 1
 #ifndef __ASSEMBLY__
 void _mcount(void);
 static inline unsigned long ftrace_call_adjust(unsigned long addr)
index 739e07a6fd85cd15b96721bf9234f54982a30ea8..6bbc3f88fcb3702fabe76f3e79616c47fb7e739d 100644 (file)
@@ -74,9 +74,12 @@ ENTRY(ftrace_caller)
        /*
         * a0: the address in the caller when calling ftrace_caller
         * a1: the caller's return address
+        * a2: the address of global variable function_trace_op
         */
        ld      a1, -8(s0)
        addi    a0, ra, -MCOUNT_INSN_SIZE
+       la      t5, function_trace_op
+       ld      a2, 0(t5)
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
        /*