1 /* 2 * Copyright 2003-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _KERNEL_IMAGE_H 6 #define _KERNEL_IMAGE_H 7 8 #include <image.h> 9 10 11 struct image; 12 struct team; 13 14 #ifdef __cplusplus 15 16 #include <util/OpenHashTable.h> 17 18 struct image { 19 struct image* next; 20 struct image* prev; 21 struct image* hash_link; 22 image_info info; 23 team_id team; 24 }; 25 26 #endif // __cplusplus 27 28 // image notifications 29 #define IMAGE_MONITOR '_Im_' 30 #define IMAGE_ADDED 0x01 31 #define IMAGE_REMOVED 0x02 32 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 extern image_id register_image(struct team *team, image_info *info, size_t size); 39 extern status_t unregister_image(struct team *team, image_id id); 40 extern int32 count_images(struct team *team); 41 extern status_t remove_images(struct team *team); 42 43 typedef bool (*image_iterator_callback)(struct image* image, void* cookie); 44 struct image* image_iterate_through_images(image_iterator_callback callback, 45 void* cookie); 46 47 extern status_t image_debug_lookup_user_symbol_address(struct team *team, 48 addr_t address, addr_t *_baseAddress, const char **_symbolName, 49 const char **_imageName, bool *_exactMatch); 50 extern status_t image_init(void); 51 52 // user-space exported calls 53 extern status_t _user_unregister_image(image_id id); 54 extern image_id _user_register_image(image_info *userInfo, size_t size); 55 extern void _user_image_relocated(image_id id); 56 extern void _user_loading_app_failed(status_t error); 57 extern status_t _user_get_next_image_info(team_id team, int32 *_cookie, 58 image_info *userInfo, size_t size); 59 extern status_t _user_get_image_info(image_id id, image_info *userInfo, size_t size); 60 61 #ifdef __cplusplus 62 } 63 #endif 64 65 #endif /* _KRENEL_IMAGE_H */ 66