1/*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef ADD_ONS_H
6#define ADD_ONS_H
7
8#include <OS.h>
9
10#include <util/DoublyLinkedList.h>
11
12#include <runtime_loader.h>
13
14
15// image events
16enum {
17	IMAGE_EVENT_LOADED,
18	IMAGE_EVENT_RELOCATED,
19	IMAGE_EVENT_INITIALIZED,
20	IMAGE_EVENT_UNINITIALIZING,
21	IMAGE_EVENT_UNLOADING
22};
23
24
25struct RuntimeLoaderAddOn
26		: public DoublyLinkedListLinkImpl<RuntimeLoaderAddOn> {
27	image_t*				image;
28	runtime_loader_add_on*	addOn;
29
30	RuntimeLoaderAddOn(image_t* image, runtime_loader_add_on* addOn)
31		:
32		image(image),
33		addOn(addOn)
34	{
35	}
36};
37
38
39struct RuntimeLoaderSymbolPatcher {
40	RuntimeLoaderSymbolPatcher*		next;
41	runtime_loader_symbol_patcher*	patcher;
42	void*							cookie;
43
44	RuntimeLoaderSymbolPatcher(runtime_loader_symbol_patcher* patcher,
45			void* cookie)
46		:
47		patcher(patcher),
48		cookie(cookie)
49	{
50	}
51};
52
53
54void		init_add_ons();
55status_t	add_add_on(image_t* image, runtime_loader_add_on* addOnStruct);
56void		image_event(image_t* image, uint32 event);
57
58
59#endif	// ADD_ONS_H
60