blob: caa955f10e19509adf568e4a44bc357f2340b562 [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
16#define MCOUNT_ADDR ((unsigned long)_mcount)
17#define MCOUNT_INSN_SIZE AARCH64_INSN_SIZE
18
19#ifndef __ASSEMBLY__
AKASHI Takahiro055b1212014-04-30 10:54:36 +010020#include <linux/compat.h>
21
AKASHI Takahiro819e50e2014-04-30 18:54:33 +090022extern void _mcount(unsigned long);
AKASHI Takahiro37117842014-04-30 10:54:35 +010023extern void *return_address(unsigned int);
AKASHI Takahirobd7d38d2014-04-30 10:54:34 +010024
25struct dyn_arch_ftrace {
26 /* No extra data needed for arm64 */
27};
28
29extern unsigned long ftrace_graph_call;
30
AKASHI Takahiro20380bb2015-12-15 17:33:41 +090031extern void return_to_handler(void);
32
AKASHI Takahirobd7d38d2014-04-30 10:54:34 +010033static inline unsigned long ftrace_call_adjust(unsigned long addr)
34{
35 /*
36 * addr is the address of the mcount call instruction.
37 * recordmcount does the necessary offset calculation.
38 */
39 return addr;
40}
AKASHI Takahiro37117842014-04-30 10:54:35 +010041
42#define ftrace_return_address(n) return_address(n)
AKASHI Takahiro055b1212014-04-30 10:54:36 +010043
44/*
45 * Because AArch32 mode does not share the same syscall table with AArch64,
46 * tracing compat syscalls may result in reporting bogus syscalls or even
47 * hang-up, so just do not trace them.
48 * See kernel/trace/trace_syscalls.c
49 *
50 * x86 code says:
Adam Buchbinderef769e32016-02-24 09:52:41 -080051 * If the user really wants these, then they should use the
AKASHI Takahiro055b1212014-04-30 10:54:36 +010052 * raw syscall tracepoints with filtering.
53 */
54#define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS
55static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs)
56{
57 return is_compat_task();
58}
AKASHI Takahiro37117842014-04-30 10:54:35 +010059#endif /* ifndef __ASSEMBLY__ */
AKASHI Takahiro819e50e2014-04-30 18:54:33 +090060
61#endif /* __ASM_FTRACE_H */