kimage.h revision 8c6cb8af
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
13struct image;
14
15namespace BKernel {
16	struct Team;
17}
18
19using BKernel::Team;
20
21
22#ifdef __cplusplus
23
24#include <util/OpenHashTable.h>
25
26struct 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
43extern "C" {
44#endif
45
46extern image_id register_image(Team *team, extended_image_info *info,
47					size_t size);
48extern status_t unregister_image(Team *team, image_id id);
49extern status_t copy_images(team_id fromTeamId, Team *toTeam);
50extern int32 count_images(Team *team);
51extern status_t remove_images(Team *team);
52
53typedef bool (*image_iterator_callback)(struct image* image, void* cookie);
54struct image* image_iterate_through_images(image_iterator_callback callback,
55					void* cookie);
56struct image* image_iterate_through_team_images(team_id teamID,
57					image_iterator_callback callback, void* cookie);
58
59extern 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);
62extern status_t image_init(void);
63
64// user-space exported calls
65extern status_t _user_unregister_image(image_id id);
66extern image_id _user_register_image(extended_image_info *userInfo,
67					size_t size);
68extern void		_user_image_relocated(image_id id);
69extern void		_user_loading_app_failed(status_t error);
70extern status_t _user_get_next_image_info(team_id team, int32 *_cookie,
71					image_info *userInfo, size_t size);
72extern 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