blob: 5ab5200b2bdc8efe97b43ee9bf796b18c8cca800 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
AKASHI Takahiro819e50e2014-04-30 18:54:33 +09002/*
3 * arch/arm64/include/asm/ftrace.h
4 *
5 * Copyright (C) 2013 Linaro Limited
6 * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
AKASHI Takahiro819e50e2014-04-30 18:54:33 +09007 */
8#ifndef __ASM_FTRACE_H
9#define __ASM_FTRACE_H
10
11#include <asm/insn.h>
12
Mark Rutland5c176af2018-11-15 22:42:00 +000013#define HAVE_FUNCTION_GRAPH_FP_TEST
AKASHI Takahiro819e50e2014-04-30 18:54:33 +090014#define MCOUNT_ADDR ((unsigned long)_mcount)
15#define MCOUNT_INSN_SIZE AARCH64_INSN_SIZE
16
17#ifndef __ASSEMBLY__
AKASHI Takahiro055b1212014-04-30 10:54:36 +010018#include <linux/compat.h>
19
AKASHI Takahiro819e50e2014-04-30 18:54:33 +090020extern void _mcount(unsigned long);
AKASHI Takahiro37117842014-04-30 10:54:35 +010021extern void *return_address(unsigned int);
AKASHI Takahirobd7d38d2014-04-30 10:54:34 +010022
23struct dyn_arch_ftrace {
24 /* No extra data needed for arm64 */
25};
26
27extern unsigned long ftrace_graph_call;
28
AKASHI Takahiro20380bb2015-12-15 17:33:41 +090029extern void return_to_handler(void);
30
AKASHI Takahirobd7d38d2014-04-30 10:54:34 +010031static inline unsigned long ftrace_call_adjust(unsigned long addr)
32{
33 /*
34 * addr is the address of the mcount call instruction.
35 * recordmcount does the necessary offset calculation.
36 */
37 return addr;
38}
AKASHI Takahiro37117842014-04-30 10:54:35 +010039
40#define ftrace_return_address(n) return_address(n)
AKASHI Takahiro055b1212014-04-30 10:54:36 +010041
42/*
43 * Because AArch32 mode does not share the same syscall table with AArch64,
44 * tracing compat syscalls may result in reporting bogus syscalls or even
45 * hang-up, so just do not trace them.
46 * See kernel/trace/trace_syscalls.c
47 *
48 * x86 code says:
Adam Buchbinderef769e32016-02-24 09:52:41 -080049 * If the user really wants these, then they should use the
AKASHI Takahiro055b1212014-04-30 10:54:36 +010050 * raw syscall tracepoints with filtering.
51 */
52#define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS
53static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs)
54{
55 return is_compat_task();
56}
Masami Hiramatsu874bfc62018-11-29 14:39:33 +090057
58#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
59
60static inline bool arch_syscall_match_sym_name(const char *sym,
61 const char *name)
62{
63 /*
64 * Since all syscall functions have __arm64_ prefix, we must skip it.
65 * However, as we described above, we decided to ignore compat
66 * syscalls, so we don't care about __arm64_compat_ prefix here.
67 */
68 return !strcmp(sym + 8, name);
69}
AKASHI Takahiro37117842014-04-30 10:54:35 +010070#endif /* ifndef __ASSEMBLY__ */
AKASHI Takahiro819e50e2014-04-30 18:54:33 +090071
72#endif /* __ASM_FTRACE_H */