Lines Matching defs:map
26 #include "map.h"
44 static int dso__load_kernel_sym(struct dso *dso, struct map *map);
45 static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map);
236 * not assign it to the kernel dso map (kallsyms).
262 struct map *prev = NULL, *curr;
275 * last map final address.
751 struct map *curr_map;
803 struct map *initial_map)
806 struct map *curr_map = initial_map;
1103 struct map *old_map;
1155 struct map *map)
1157 struct maps *kmaps = map__kmaps(map);
1174 struct map *map)
1176 struct kmap *kmap = map__kmap(map);
1191 return validate_kcore_modules(kallsyms_filename, map);
1202 struct map *map;
1204 map = map__new2(start, md->dso);
1205 if (map == NULL)
1208 map->end = map->start + len;
1209 map->pgoff = pgoff;
1211 list_add(&map->node, &md->maps);
1217 * Merges map into maps by splitting the new map within the existing map
1220 int maps__merge_in(struct maps *kmaps, struct map *new_map)
1222 struct map *old_map;
1247 struct map *m = map__clone(new_map);
1282 old_map = list_entry(merged.next, struct map, node);
1295 static int dso__load_kcore(struct dso *dso, struct map *map,
1298 struct maps *kmaps = map__kmaps(map);
1300 struct map *old_map, *new_map, *replacement_map = NULL, *next;
1312 /* This function requires that the map is the kernel map */
1313 if (!__map__is_kernel(map))
1321 if (validate_kcore_addresses(kallsyms_filename, map))
1335 err = file__read_maps(fd, map->prot & PROT_EXEC, kcore_mapfn, &md,
1353 if (old_map != map && !__map__is_bpf_prog(old_map))
1358 /* Find the kernel map using the '_stext' symbol */
1369 replacement_map = list_entry(md.maps.next, struct map, node);
1373 new_map = list_entry(md.maps.next, struct map, node);
1376 map->start = new_map->start;
1377 map->end = new_map->end;
1378 map->pgoff = new_map->pgoff;
1379 map->map_ip = new_map->map_ip;
1380 map->unmap_ip = new_map->unmap_ip;
1382 map__get(map);
1383 maps__remove(kmaps, map);
1384 maps__insert(kmaps, map);
1385 map__put(map);
1389 * Merge kcore map into existing maps,
1423 if (map->prot & PROT_EXEC)
1432 map = list_entry(md.maps.next, struct map, node);
1433 list_del_init(&map->node);
1434 map__put(map);
1459 struct map *map, bool no_kcore)
1461 struct kmap *kmap = map__kmap(map);
1484 if (!no_kcore && !dso__load_kcore(dso, map, filename))
1487 return maps__split_kallsyms(kmap->kmaps, dso, delta, map);
1491 struct map *map)
1493 return __dso__load_kallsyms(dso, filename, map, false);
1731 /* Checks for the existence of the perf-<pid>.map file in two different
1748 snprintf(filebuf, bufsz, "/tmp/perf-%d.map", nsi->nstgid);
1761 snprintf(filebuf, bufsz, "/tmp/perf-%d.map", nnsi->tgid);
1769 int dso__load(struct dso *dso, struct map *map)
1810 ret = dso__load_kernel_sym(dso, map);
1812 ret = dso__load_guest_kernel_sym(dso, map);
1814 machine = map__kmaps(map)->machine;
1929 ret = dso__load_sym(dso, map, syms_ss, runtime_ss, kmod);
1957 const struct map *ma = *(const struct map **)a, *mb = *(const struct map **)b;
1963 const struct map *map = *(const struct map **)b;
1964 return strcmp(name, map->dso->short_name);
1969 qsort(maps->maps_by_name, maps->nr_maps, sizeof(struct map *), map__strcmp);
1974 struct map *map;
1975 struct map **maps_by_name = realloc(maps->maps_by_name, maps->nr_maps * sizeof(map));
1984 maps__for_each_entry(maps, map)
1985 maps_by_name[i++] = map;
1991 static struct map *__maps__find_by_name(struct maps *maps, const char *name)
1993 struct map **mapp;
2005 struct map *maps__find_by_name(struct maps *maps, const char *name)
2007 struct map *map;
2012 map = maps->last_search_by_name;
2020 map = __maps__find_by_name(maps, name);
2021 if (map || maps->maps_by_name != NULL)
2025 maps__for_each_entry(maps, map)
2026 if (strcmp(map->dso->short_name, name) == 0) {
2027 maps->last_search_by_name = map;
2031 map = NULL;
2035 return map;
2038 int dso__load_vmlinux(struct dso *dso, struct map *map,
2059 err = dso__load_sym(dso, map, &ss, &ss, 0);
2075 int dso__load_vmlinux_path(struct dso *dso, struct map *map)
2084 err = dso__load_vmlinux(dso, map, vmlinux_path[i], false);
2092 err = dso__load_vmlinux(dso, map, filename, true);
2108 static int find_matching_kcore(struct map *map, char *dir, size_t dir_sz)
2122 if (!validate_kcore_addresses(kallsyms_filename, map)) {
2148 static char *dso__find_kallsyms(struct dso *dso, struct map *map)
2176 !validate_kcore_addresses("/proc/kallsyms", map))
2186 if (!find_matching_kcore(map, path, sizeof(path)))
2205 static int dso__load_kernel_sym(struct dso *dso, struct map *map)
2231 return dso__load_vmlinux(dso, map, symbol_conf.vmlinux_name, false);
2235 err = dso__load_vmlinux_path(dso, map);
2244 kallsyms_allocated_filename = dso__find_kallsyms(dso, map);
2251 err = dso__load_kallsyms(dso, kallsyms_filename, map);
2259 map__fixup_start(map);
2260 map__fixup_end(map);
2266 static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map)
2270 struct machine *machine = map__kmaps(map)->machine;
2280 err = dso__load_vmlinux(dso, map,
2294 err = dso__load_kallsyms(dso, kallsyms_filename, map);
2300 map__fixup_start(map);
2301 map__fixup_end(map);