19c12864dSAxel Dörfler/*
24d189912SAxel Dörfler * Copyright 2003-2005, Axel D��rfler, axeld@pinc-software.de. All rights reserved.
34d189912SAxel Dörfler * Distributed under the terms of the MIT License.
44d189912SAxel Dörfler */
59c12864dSAxel Dörfler#ifndef _KERNEL_IMAGE_H
69c12864dSAxel Dörfler#define _KERNEL_IMAGE_H
79c12864dSAxel Dörfler
89c12864dSAxel Dörfler#include <image.h>
99c12864dSAxel Dörfler
108c6cb8afSIngo Weinhold#include <image_defs.h>
118c6cb8afSIngo Weinhold
129c12864dSAxel Dörfler
13efd536ffSIngo Weinholdstruct image;
144535495dSIngo Weinhold
154535495dSIngo Weinholdnamespace BKernel {
164535495dSIngo Weinhold	struct Team;
174535495dSIngo Weinhold}
184535495dSIngo Weinhold
194535495dSIngo Weinholdusing BKernel::Team;
204535495dSIngo Weinhold
219c12864dSAxel Dörfler
22efd536ffSIngo Weinhold#ifdef __cplusplus
23efd536ffSIngo Weinhold
24efd536ffSIngo Weinhold#include <util/OpenHashTable.h>
25efd536ffSIngo Weinhold
26efd536ffSIngo Weinholdstruct image {
27efd536ffSIngo Weinhold	struct image*			next;
28efd536ffSIngo Weinhold	struct image*			prev;
295147963dSStephan Aßmus	struct image*			hash_link;
308c6cb8afSIngo Weinhold	extended_image_info		info;
31efd536ffSIngo Weinhold	team_id					team;
32efd536ffSIngo Weinhold};
33efd536ffSIngo Weinhold
34efd536ffSIngo Weinhold#endif	// __cplusplus
35efd536ffSIngo Weinhold
36efd536ffSIngo Weinhold// image notifications
37efd536ffSIngo Weinhold#define IMAGE_MONITOR	'_Im_'
38efd536ffSIngo Weinhold#define IMAGE_ADDED		0x01
39efd536ffSIngo Weinhold#define IMAGE_REMOVED	0x02
40efd536ffSIngo Weinhold
41efd536ffSIngo Weinhold
424d189912SAxel Dörfler#ifdef __cplusplus
434d189912SAxel Dörflerextern "C" {
444d189912SAxel Dörfler#endif
454d189912SAxel Dörfler
468c6cb8afSIngo Weinholdextern image_id register_image(Team *team, extended_image_info *info,
478c6cb8afSIngo Weinhold					size_t size);
484535495dSIngo Weinholdextern status_t unregister_image(Team *team, image_id id);
498c6cb8afSIngo Weinholdextern status_t copy_images(team_id fromTeamId, Team *toTeam);
504535495dSIngo Weinholdextern int32 count_images(Team *team);
514535495dSIngo Weinholdextern status_t remove_images(Team *team);
524d189912SAxel Dörfler
53efd536ffSIngo Weinholdtypedef bool (*image_iterator_callback)(struct image* image, void* cookie);
54efd536ffSIngo Weinholdstruct image* image_iterate_through_images(image_iterator_callback callback,
55efd536ffSIngo Weinhold					void* cookie);
56ac1f1a92SIngo Weinholdstruct image* image_iterate_through_team_images(team_id teamID,
57ac1f1a92SIngo Weinhold					image_iterator_callback callback, void* cookie);
58efd536ffSIngo Weinhold
594535495dSIngo Weinholdextern status_t image_debug_lookup_user_symbol_address(Team *team,
604d189912SAxel Dörfler					addr_t address, addr_t *_baseAddress, const char **_symbolName,
614d189912SAxel Dörfler					const char **_imageName, bool *_exactMatch);
6211a5baafSAxel Dörflerextern status_t image_init(void);
639c12864dSAxel Dörfler
649c12864dSAxel Dörfler// user-space exported calls
6511a5baafSAxel Dörflerextern status_t _user_unregister_image(image_id id);
668c6cb8afSIngo Weinholdextern image_id _user_register_image(extended_image_info *userInfo,
678c6cb8afSIngo Weinhold					size_t size);
683a96ba0bSIngo Weinholdextern void		_user_image_relocated(image_id id);
693a96ba0bSIngo Weinholdextern void		_user_loading_app_failed(status_t error);
7011a5baafSAxel Dörflerextern status_t _user_get_next_image_info(team_id team, int32 *_cookie,
7111a5baafSAxel Dörfler					image_info *userInfo, size_t size);
7211a5baafSAxel Dörflerextern status_t _user_get_image_info(image_id id, image_info *userInfo, size_t size);
739c12864dSAxel Dörfler
744d189912SAxel Dörfler#ifdef __cplusplus
754d189912SAxel Dörfler}
764d189912SAxel Dörfler#endif
774d189912SAxel Dörfler
789c12864dSAxel Dörfler#endif	/* _KRENEL_IMAGE_H */
79