28bb030f93
Support dynamic ftrace including dynamic graph tracer. Gcc-csky with -pg will produce call site in every function prologue and we can use these call site to hook trace function. gcc with -pg origin call site: push lr jbsr _mcount nop32 nop32 If the (callee - caller)'s offset is in range of bsr instruction, we'll modify code with: push lr bsr _mcount nop32 nop32 Else if the (callee - caller)'s offset is out of bsr instrunction, we'll modify code with: push lr movih r26, ... ori r26, ... jsr r26 (r26 is reserved for jsr link reg in csky abiv2 spec.) Signed-off-by: Guo Ren <ren_guo@c-sky.com>
30 lines
581 B
C
30 lines
581 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
|
|
|
|
#ifndef __ASM_CSKY_FTRACE_H
|
|
#define __ASM_CSKY_FTRACE_H
|
|
|
|
#define MCOUNT_INSN_SIZE 14
|
|
|
|
#define HAVE_FUNCTION_GRAPH_FP_TEST
|
|
|
|
#define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
|
|
|
|
#define MCOUNT_ADDR ((unsigned long)_mcount)
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
extern void _mcount(unsigned long);
|
|
|
|
extern void ftrace_graph_call(void);
|
|
|
|
static inline unsigned long ftrace_call_adjust(unsigned long addr)
|
|
{
|
|
return addr;
|
|
}
|
|
|
|
struct dyn_arch_ftrace {
|
|
};
|
|
#endif /* !__ASSEMBLY__ */
|
|
#endif /* __ASM_CSKY_FTRACE_H */
|