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