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 13 namespace BKernel { 14 struct Team; 15 } 16 17 using BKernel::Team; 18 19 20 #ifdef __cplusplus 21 22 #include <util/OpenHashTable.h> 23 24 struct image { 25 struct image* next; 26 struct image* prev; 27 struct image* hash_link; 28 image_info info; 29 team_id team; 30 }; 31 32 #endif // __cplusplus 33 34 // image notifications 35 #define IMAGE_MONITOR '_Im_' 36 #define IMAGE_ADDED 0x01 37 #define IMAGE_REMOVED 0x02 38 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 extern image_id register_image(Team *team, image_info *info, size_t size); 45 extern status_t unregister_image(Team *team, image_id id); 46 extern int32 count_images(Team *team); 47 extern status_t remove_images(Team *team); 48 49 typedef bool (*image_iterator_callback)(struct image* image, void* cookie); 50 struct image* image_iterate_through_images(image_iterator_callback callback, 51 void* cookie); 52 53 extern status_t image_debug_lookup_user_symbol_address(Team *team, 54 addr_t address, addr_t *_baseAddress, const char **_symbolName, 55 const char **_imageName, bool *_exactMatch); 56 extern status_t image_init(void); 57 58 // user-space exported calls 59 extern status_t _user_unregister_image(image_id id); 60 extern image_id _user_register_image(image_info *userInfo, size_t size); 61 extern void _user_image_relocated(image_id id); 62 extern void _user_loading_app_failed(status_t error); 63 extern status_t _user_get_next_image_info(team_id team, int32 *_cookie, 64 image_info *userInfo, size_t size); 65 extern status_t _user_get_image_info(image_id id, image_info *userInfo, size_t size); 66 67 #ifdef __cplusplus 68 } 69 #endif 70 71 #endif /* _KRENEL_IMAGE_H */ 72