2 #include <linux/types.h> 3 #include <linux/string.h> 6 #include "../../util/machine.h" 7 #include "../../util/map.h" 8 #include "../../util/symbol.h" 9 #include "../../util/sane_ctype.h" 11 #include <symbol/kallsyms.h> 13 #if defined(__x86_64__) 15 struct extra_kernel_map_info {
19 bool get_entry_trampolines;
23 static int add_extra_kernel_map(
struct extra_kernel_map_info *mi, u64
start,
26 if (mi->cnt >= mi->max_cnt) {
30 mi->max_cnt = mi->max_cnt ? mi->max_cnt * 2 : 32;
32 buf = realloc(mi->maps, sz);
38 mi->maps[mi->cnt].start =
start;
39 mi->maps[mi->cnt].end =
end;
40 mi->maps[mi->cnt].pgoff =
pgoff;
48 static int find_extra_kernel_maps(
void *arg,
const char *name,
char type,
51 struct extra_kernel_map_info *mi = arg;
53 if (!mi->entry_trampoline && kallsyms2elf_binding(type) == STB_GLOBAL &&
54 !strcmp(name,
"_entry_trampoline")) {
55 mi->entry_trampoline =
start;
62 return add_extra_kernel_map(mi, start, end, 0, name);
71 struct extra_kernel_map_info mi = { .cnt = 0, };
81 ret = kallsyms__parse(filename, &mi, find_extra_kernel_maps);
85 if (!mi.entry_trampoline)
88 for (i = 0; i < mi.cnt; i++) {
91 xm->
pgoff = mi.entry_trampoline;
static bool is_entry_trampoline(const char *name)
void machine__get_kallsyms_filename(struct machine *machine, char *buf, size_t bufsz)
bool symbol__restricted_filename(const char *filename, const char *restricted_filename)
int __weak machine__create_extra_kernel_maps(struct machine *machine __maybe_unused, struct dso *kernel __maybe_unused)
int machine__create_extra_kernel_map(struct machine *machine, struct dso *kernel, struct extra_kernel_map *xm)