4 #include <linux/compiler.h>
5 #include <linux/list.h>
6 #include <linux/rbtree.h>
7 #include <linux/types.h>
14 #define MAP__NR_TYPES (MAP__VARIABLE + 1)
16 extern const char *map_type__name
[MAP__NR_TYPES
];
24 struct rb_node rb_node
;
25 struct list_head node
;
33 u64 (*map_ip
)(struct map
*, u64
);
35 u64 (*unmap_ip
)(struct map
*, u64
);
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
)
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
);
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 */