xref: /openbmc/linux/tools/perf/arch/arm64/util/machine.c (revision 4a0a1436)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <inttypes.h>
4 #include <stdio.h>
5 #include <string.h>
6 #include "debug.h"
7 #include "symbol.h"
8 #include "callchain.h"
9 #include "record.h"
10 
11 /* On arm64, kernel text segment starts at high memory address,
12  * for example 0xffff 0000 8xxx xxxx. Modules start at a low memory
13  * address, like 0xffff 0000 00ax xxxx. When only small amount of
14  * memory is used by modules, gap between end of module's text segment
15  * and start of kernel text segment may reach 2G.
16  * Therefore do not fill this gap and do not assign it to the kernel dso map.
17  */
18 
19 #define SYMBOL_LIMIT (1 << 12) /* 4K */
20 
21 void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
22 {
23 	if ((strchr(p->name, '[') && strchr(c->name, '[') == NULL) ||
24 			(strchr(p->name, '[') == NULL && strchr(c->name, '[')))
25 		/* Limit range of last symbol in module and kernel */
26 		p->end += SYMBOL_LIMIT;
27 	else
28 		p->end = c->start;
29 	pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
30 }
31 
32 void arch__add_leaf_frame_record_opts(struct record_opts *opts)
33 {
34 	opts->sample_user_regs |= sample_reg_masks[PERF_REG_ARM64_LR].mask;
35 }
36