mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-25 21:54:06 +08:00
a14a07b801
IA64 dynamic ftrace support. The original _mcount stub for each function is like: alloc r40=ar.pfs,12,8,0 mov r43=r0;; mov r42=b0 mov r41=r1 nop.i 0x0 br.call.sptk.many b0 = _mcount;; The patch convert it to below for nop: [MII] nop.m 0x0 mov r3=ip nop.i 0x0 [MLX] nop.m 0x0 nop.x 0x0;; This isn't completely nop, as there is one instuction 'mov r3=ip', but it should be light and harmless for code follow it. And below is for call [MII] nop.m 0x0 mov r3=ip nop.i 0x0 [MLX] nop.m 0x0 brl.many .;; In this way, only one instruction is changed to convert code between nop and call. This should meet dyn-ftrace's requirement. But this requires CPU support brl instruction, so dyn-ftrace isn't supported for old Itanium system. Assume there are quite few such old system running. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
29 lines
734 B
C
29 lines
734 B
C
#ifndef _ASM_IA64_FTRACE_H
|
|
#define _ASM_IA64_FTRACE_H
|
|
|
|
#ifdef CONFIG_FUNCTION_TRACER
|
|
#define MCOUNT_INSN_SIZE 32 /* sizeof mcount call */
|
|
|
|
#ifndef __ASSEMBLY__
|
|
extern void _mcount(unsigned long pfs, unsigned long r1, unsigned long b0, unsigned long r0);
|
|
#define mcount _mcount
|
|
|
|
#include <asm/kprobes.h>
|
|
/* In IA64, MCOUNT_ADDR is set in link time, so it's not a constant at compile time */
|
|
#define MCOUNT_ADDR (((struct fnptr *)mcount)->ip)
|
|
#define FTRACE_ADDR (((struct fnptr *)ftrace_caller)->ip)
|
|
|
|
static inline unsigned long ftrace_call_adjust(unsigned long addr)
|
|
{
|
|
/* second bundle, insn 2 */
|
|
return addr - 0x12;
|
|
}
|
|
|
|
struct dyn_arch_ftrace {
|
|
};
|
|
#endif
|
|
|
|
#endif /* CONFIG_FUNCTION_TRACER */
|
|
|
|
#endif /* _ASM_IA64_FTRACE_H */
|