1 // SPDX-License-Identifier: GPL-2.0-only 1 2 /* 3 * arm64 callchain support 4 * 5 * Copyright (C) 2015 ARM Limited 6 */ 7 #include <linux/perf_event.h> 8 #include <linux/stacktrace.h> 9 #include <linux/uaccess.h> 10 11 #include <asm/pointer_auth.h> 12 13 static bool callchain_trace(void *data, unsign 14 { 15 struct perf_callchain_entry_ctx *entry 16 17 return perf_callchain_store(entry, pc) 18 } 19 20 void perf_callchain_user(struct perf_callchain 21 struct pt_regs *regs) 22 { 23 if (perf_guest_state()) { 24 /* We don't support guest os c 25 return; 26 } 27 28 arch_stack_walk_user(callchain_trace, 29 } 30 31 void perf_callchain_kernel(struct perf_callcha 32 struct pt_regs *reg 33 { 34 if (perf_guest_state()) { 35 /* We don't support guest os c 36 return; 37 } 38 39 arch_stack_walk(callchain_trace, entry 40 } 41 42 unsigned long perf_instruction_pointer(struct 43 { 44 if (perf_guest_state()) 45 return perf_guest_get_ip(); 46 47 return instruction_pointer(regs); 48 } 49 50 unsigned long perf_misc_flags(struct pt_regs * 51 { 52 unsigned int guest_state = perf_guest_ 53 int misc = 0; 54 55 if (guest_state) { 56 if (guest_state & PERF_GUEST_U 57 misc |= PERF_RECORD_MI 58 else 59 misc |= PERF_RECORD_MI 60 } else { 61 if (user_mode(regs)) 62 misc |= PERF_RECORD_MI 63 else 64 misc |= PERF_RECORD_MI 65 } 66 67 return misc; 68 } 69
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.