blob: 15a6587e12f9a161b06d58a50a81b8e23554842a [file] [log] [blame]
AKASHI Takahiro819e50e2014-04-30 18:54:33 +09001/*
2 * arch/arm64/include/asm/ftrace.h
3 *
4 * Copyright (C) 2013 Linaro Limited
5 * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef __ASM_FTRACE_H
12#define __ASM_FTRACE_H
13
14#include <asm/insn.h>
15
Mark Rutland5c176af2018-11-15 22:42:00 +000016#define HAVE_FUNCTION_GRAPH_FP_TEST
AKASHI Takahiro819e50e2014-04-30 18:54:33 +090017#define MCOUNT_ADDR ((unsigned long)_mcount)
18#define MCOUNT_INSN_SIZE AARCH64_INSN_SIZE
19
20#ifndef __ASSEMBLY__
AKASHI Takahiro055b1212014-04-30 10:54:36 +010021#include <linux/compat.h>
22
AKASHI Takahiro819e50e2014-04-30 18:54:33 +090023extern void _mcount(unsigned long);
AKASHI Takahiro37117842014-04-30 10:54:35 +010024extern void *return_address(unsigned int);
AKASHI Takahirobd7d38d2014-04-30 10:54:34 +010025
26struct dyn_arch_ftrace {
27 /* No extra data needed for arm64 */
28};
29
30extern unsigned long ftrace_graph_call;
31
AKASHI Takahiro20380bb2015-12-15 17:33:41 +090032extern void return_to_handler(void);
33
AKASHI Takahirobd7d38d2014-04-30 10:54:34 +010034static inline unsigned long ftrace_call_adjust(unsigned long addr)
35{
36 /*
37 * addr is the address of the mcount call instruction.
38 * recordmcount does the necessary offset calculation.
39 */
40 return addr;
41}
AKASHI Takahiro37117842014-04-30 10:54:35 +010042
43#define ftrace_return_address(n) return_address(n)
AKASHI Takahiro055b1212014-04-30 10:54:36 +010044
45/*
46 * Because AArch32 mode does not share the same syscall table with AArch64,
47 * tracing compat syscalls may result in reporting bogus syscalls or even
48 * hang-up, so just do not trace them.
49 * See kernel/trace/trace_syscalls.c
50 *
51 * x86 code says:
Adam Buchbinderef769e32016-02-24 09:52:41 -080052 * If the user really wants these, then they should use the
AKASHI Takahiro055b1212014-04-30 10:54:36 +010053 * raw syscall tracepoints with filtering.
54 */
55#define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS
56static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs)
57{
58 return is_compat_task();
59}
Masami Hiramatsu874bfc62018-11-29 14:39:33 +090060
61#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
62
63static inline bool arch_syscall_match_sym_name(const char *sym,
64 const char *name)
65{
66 /*
67 * Since all syscall functions have __arm64_ prefix, we must skip it.
68 * However, as we described above, we decided to ignore compat
69 * syscalls, so we don't care about __arm64_compat_ prefix here.
70 */
71 return !strcmp(sym + 8, name);
72}
AKASHI Takahiro37117842014-04-30 10:54:35 +010073#endif /* ifndef __ASSEMBLY__ */
AKASHI Takahiro819e50e2014-04-30 18:54:33 +090074
75#endif /* __ASM_FTRACE_H */