00001 00012 #ifndef OPD_MAPPING_H 00013 #define OPD_MAPPING_H 00014 00015 #include "op_list.h" 00016 00017 struct opd_image; 00018 struct opd_proc; 00019 struct op_note; 00020 00025 struct opd_map { 00027 struct list_head next; 00029 struct opd_image * image; 00031 unsigned long start; 00033 unsigned long offset; 00035 unsigned long end; 00036 }; 00037 00041 void opd_init_hash_map(void); 00042 00048 void opd_cleanup_hash_name(void); 00049 00058 void opd_handle_mapping(struct op_note const * note); 00059 00071 void opd_add_mapping(struct opd_proc * proc, struct opd_image * image, 00072 unsigned long start, unsigned long offset, unsigned long end); 00073 00080 void opd_kill_maps(struct opd_proc * proc); 00081 00090 inline static int opd_is_in_map(struct opd_map * map, unsigned long eip) 00091 { 00092 return (eip >= map->start && eip < map->end); 00093 } 00094 00095 00096 /* 00097 * opd_map_offset - return offset of sample against map 00098 * @param map map to use 00099 * @param eip EIP value to use 00100 * 00101 * Returns the offset of the EIP value @eip into 00102 * the map @map, which is the same as the file offset 00103 * for the relevant binary image. 00104 */ 00105 inline static unsigned long opd_map_offset(struct opd_map * map, 00106 unsigned long eip) 00107 { 00108 return (eip - map->start) + map->offset; 00109 } 00110 00111 #endif /* OPD_MAPPING_H */