c30e5cc88c1673d6c1c39a39cd4f073ee0bdb989
[linux-2.6-microblaze.git] / tools / perf / arch / powerpc / util / machine.c
1 // SPDX-License-Identifier: GPL-2.0
2
3 #include <stdio.h>
4 #include <string.h>
5 #include <internal/lib.h> // page_size
6 #include "debug.h"
7 #include "symbol.h"
8
9 /* On powerpc kernel text segment start at memory addresses, 0xc000000000000000
10  * whereas the modules are located at very high memory addresses,
11  * for example 0xc00800000xxxxxxx. The gap between end of kernel text segment
12  * and beginning of first module's text segment is very high.
13  * Therefore do not fill this gap and do not assign it to the kernel dso map.
14  */
15
16 void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
17 {
18         if (strchr(p->name, '[') == NULL && strchr(c->name, '['))
19                 /* Limit the range of last kernel symbol */
20                 p->end += page_size;
21         else
22                 p->end = c->start;
23         pr_debug4("%s sym:%s end:%#lx\n", __func__, p->name, p->end);
24 }