kset-example: Spelling fixes.
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / tools / perf / util / map.h
blobb756368076c6ce4478ccb18ccdd61bd45e2fd408
1 #ifndef __PERF_MAP_H
2 #define __PERF_MAP_H
4 #include <linux/compiler.h>
5 #include <linux/list.h>
6 #include <linux/rbtree.h>
7 #include <linux/types.h>
9 enum map_type {
10 MAP__FUNCTION = 0,
11 MAP__VARIABLE,
14 #define MAP__NR_TYPES (MAP__VARIABLE + 1)
16 extern const char *map_type__name[MAP__NR_TYPES];
18 struct dso;
19 struct ref_reloc_sym;
20 struct map_groups;
22 struct map {
23 union {
24 struct rb_node rb_node;
25 struct list_head node;
27 u64 start;
28 u64 end;
29 enum map_type type;
30 u64 pgoff;
32 /* ip -> dso rip */
33 u64 (*map_ip)(struct map *, u64);
34 /* dso rip -> ip */
35 u64 (*unmap_ip)(struct map *, u64);
37 struct dso *dso;
40 struct kmap {
41 struct ref_reloc_sym *ref_reloc_sym;
42 struct map_groups *kmaps;
45 static inline struct kmap *map__kmap(struct map *self)
47 return (struct kmap *)(self + 1);
50 static inline u64 map__map_ip(struct map *map, u64 ip)
52 return ip - map->start + map->pgoff;
55 static inline u64 map__unmap_ip(struct map *map, u64 ip)
57 return ip + map->start - map->pgoff;
60 static inline u64 identity__map_ip(struct map *map __used, u64 ip)
62 return ip;
66 /* rip/ip <-> addr suitable for passing to `objdump --start-address=` */
67 u64 map__rip_2objdump(struct map *map, u64 rip);
68 u64 map__objdump_2ip(struct map *map, u64 addr);
70 struct symbol;
71 struct mmap_event;
73 typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym);
75 void map__init(struct map *self, enum map_type type,
76 u64 start, u64 end, u64 pgoff, struct dso *dso);
77 struct map *map__new(struct mmap_event *event, enum map_type,
78 char *cwd, int cwdlen);
79 void map__delete(struct map *self);
80 struct map *map__clone(struct map *self);
81 int map__overlap(struct map *l, struct map *r);
82 size_t map__fprintf(struct map *self, FILE *fp);
84 int map__load(struct map *self, symbol_filter_t filter);
85 struct symbol *map__find_symbol(struct map *self,
86 u64 addr, symbol_filter_t filter);
87 struct symbol *map__find_symbol_by_name(struct map *self, const char *name,
88 symbol_filter_t filter);
89 void map__fixup_start(struct map *self);
90 void map__fixup_end(struct map *self);
92 void map__reloc_vmlinux(struct map *self);
94 #endif /* __PERF_MAP_H */