Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177903
b: refs/heads/master
c: e17ff5f
h: refs/heads/master
i:
  177901: e30bf6c
  177899: 686f1b6
  177895: 43f8299
  177887: 0ae5570
v: v3
  • Loading branch information
Wu Zhangjin authored and Ralf Baechle committed Dec 17, 2009
1 parent aa5cfff commit 4eb4ff5
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 29c5d3462f7c8f17bb9e0a29f0a299036468074d
refs/heads/master: e17ff5fec65a0213416efbe7ceae5f2f9887dda2
21 changes: 21 additions & 0 deletions trunk/arch/mips/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,27 @@ int __init ftrace_dyn_arch_init(void *data)

#ifdef CONFIG_FUNCTION_GRAPH_TRACER

#ifdef CONFIG_DYNAMIC_FTRACE

extern void ftrace_graph_call(void);
#define JMP 0x08000000 /* jump to target directly */
#define CALL_FTRACE_GRAPH_CALLER \
jump_insn_encode(JMP, (unsigned long)(&ftrace_graph_caller))
#define FTRACE_GRAPH_CALL_IP ((unsigned long)(&ftrace_graph_call))

int ftrace_enable_ftrace_graph_caller(void)
{
return ftrace_modify_code(FTRACE_GRAPH_CALL_IP,
CALL_FTRACE_GRAPH_CALLER);
}

int ftrace_disable_ftrace_graph_caller(void)
{
return ftrace_modify_code(FTRACE_GRAPH_CALL_IP, ftrace_nop);
}

#endif /* !CONFIG_DYNAMIC_FTRACE */

#define S_RA_SP (0xafbf << 16) /* s{d,w} ra, offset(sp) */
#define S_R_SP (0xafb0 << 16) /* s{d,w} R, offset(sp) */
#define OFFSET_MASK 0xffff /* stack offset range: 0 ~ PT_SIZE */
Expand Down
14 changes: 12 additions & 2 deletions trunk/arch/mips/kernel/mcount.S
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ ftrace_call:
nop /* a placeholder for the call to a real tracing function */
move a1, AT /* arg2: the caller's next ip, parent */

#ifdef CONFIG_FUNCTION_GRAPH_TRACER
.globl ftrace_graph_call
ftrace_graph_call:
nop
nop
#endif

MCOUNT_RESTORE_REGS
.globl ftrace_stub
ftrace_stub:
Expand Down Expand Up @@ -124,10 +131,13 @@ ftrace_stub:
#ifdef CONFIG_FUNCTION_GRAPH_TRACER

NESTED(ftrace_graph_caller, PT_SIZE, ra)
#ifdef CONFIG_DYNAMIC_FTRACE
PTR_L a1, PT_R31(sp) /* load the original ra from the stack */
#else
MCOUNT_SAVE_REGS

PTR_LA a0, PT_R1(sp) /* arg1: &AT -> a0 */
move a1, ra /* arg2: next ip, selfaddr */
#endif
PTR_LA a0, PT_R1(sp) /* arg1: &AT -> a0 */
jal prepare_ftrace_return
move a2, fp /* arg3: frame pointer */

Expand Down

0 comments on commit 4eb4ff5

Please sign in to comment.