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_unw_methods {
38 struct quadd_callchain {
42 u32 ip_32[QUADD_MAX_STACK_DEPTH];
43 u64 ip_64[QUADD_MAX_STACK_DEPTH];
46 u32 types[QUADD_UNW_TYPES_SIZE];
50 struct quadd_unw_methods um;
54 unsigned int urc_dwarf;
56 unsigned long curr_sp;
57 unsigned long curr_fp;
58 unsigned long curr_fp_thumb;
59 unsigned long curr_pc;
61 struct quadd_hrt_ctx *hrt;
68 quadd_get_user_callchain(struct pt_regs *regs,
69 struct quadd_callchain *cc_data,
70 struct quadd_ctx *ctx,
71 struct task_struct *task);
74 quadd_callchain_store(struct quadd_callchain *cc,
75 unsigned long ip, unsigned int type);
78 quadd_user_stack_pointer(struct pt_regs *regs);
81 quadd_get_user_frame_pointer(struct pt_regs *regs);
84 quadd_user_link_register(struct pt_regs *regs);
87 is_vma_addr(unsigned long addr, struct vm_area_struct *vma,
91 addr >= vma->vm_start &&
92 addr < vma->vm_end - nbytes;
96 validate_pc_addr(unsigned long addr, unsigned long nbytes)
98 return addr && addr < TASK_SIZE - nbytes;
102 validate_stack_addr(unsigned long addr,
103 struct vm_area_struct *vma,
104 unsigned long nbytes)
109 return is_vma_addr(addr, vma, nbytes);
112 #endif /* __QUADD_BACKTRACE_H */