2 * drivers/misc/tegra-profiler/backtrace.h
4 * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 #ifndef __QUADD_BACKTRACE_H
18 #define __QUADD_BACKTRACE_H
21 #include <linux/bitops.h>
23 #define QUADD_MAX_STACK_DEPTH 64
25 #define QUADD_UNW_TYPES_SIZE \
26 DIV_ROUND_UP(QUADD_MAX_STACK_DEPTH * 4, sizeof(u32) * BITS_PER_BYTE)
30 struct quadd_callchain {
34 u32 ip_32[QUADD_MAX_STACK_DEPTH];
35 u64 ip_64[QUADD_MAX_STACK_DEPTH];
38 u32 types[QUADD_UNW_TYPES_SIZE];
42 unsigned int unw_method;
45 unsigned long curr_sp;
46 unsigned long curr_fp;
47 unsigned long curr_fp_thumb;
48 unsigned long curr_pc;
50 struct quadd_hrt_ctx *hrt;
57 quadd_get_user_callchain(struct pt_regs *regs,
58 struct quadd_callchain *cc_data,
59 struct quadd_ctx *ctx,
60 struct task_struct *task);
63 quadd_callchain_store(struct quadd_callchain *cc,
64 unsigned long ip, unsigned int type);
67 quadd_user_stack_pointer(struct pt_regs *regs);
70 quadd_get_user_frame_pointer(struct pt_regs *regs);
73 quadd_user_link_register(struct pt_regs *regs);
76 is_vma_addr(unsigned long addr, struct vm_area_struct *vma,
80 addr >= vma->vm_start &&
81 addr < vma->vm_end - nbytes;
85 validate_pc_addr(unsigned long addr, unsigned long nbytes)
87 return addr && addr < TASK_SIZE - nbytes;
91 validate_stack_addr(unsigned long addr,
92 struct vm_area_struct *vma,
98 return is_vma_addr(addr, vma, nbytes);
101 #endif /* __QUADD_BACKTRACE_H */