2 * Copyright 2007-2009, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT license.
10 #include <sys/param.h>
13 typedef int32 image_id
;
27 void (*init_routine
)();
28 void (*term_routine
)();
31 char name
[MAXPATHLEN
];
37 /* Haiku R1 extensions */
38 int32 api_version
; /* the Haiku API version used by the image */
39 int32 abi
; /* the Haiku ABI used by the image */
42 /* flags for clear_caches() */
43 #define B_FLUSH_DCACHE 0x0001 /* data cache */
44 #define B_FLUSH_ICACHE 0x0004 /* instruction cache */
45 #define B_INVALIDATE_DCACHE 0x0002
46 #define B_INVALIDATE_ICACHE 0x0008
49 #define B_SYMBOL_TYPE_DATA 0x1
50 #define B_SYMBOL_TYPE_TEXT 0x2
51 #define B_SYMBOL_TYPE_ANY 0x5
53 /* initialization/termination functions of shared objects */
54 #define B_INIT_BEFORE_FUNCTION_NAME "initialize_before"
55 #define B_INIT_AFTER_FUNCTION_NAME "initialize_after"
56 #define B_TERM_BEFORE_FUNCTION_NAME "terminate_before"
57 #define B_TERM_AFTER_FUNCTION_NAME "terminate_after"
59 #define B_APP_IMAGE_SYMBOL ((void*)(addr_t)0)
60 /* value that can be used instead of a pointer to a symbol in the program
62 #define B_CURRENT_IMAGE_SYMBOL ((void*)&__haiku_init_before)
63 /* pointer to a symbol in the callers image */
65 /* flags for _kern_load_image() (private API) */
67 B_WAIT_TILL_LOADED
= 0x01,
68 /* Wait till the loader has loaded and relocated (but not yet
69 initialized) the application image and all dependencies. If not
70 supplied, the function returns before the loader started to do
71 anything at all, i.e. it returns success, even if the executable
79 thread_id
load_image(int32 argc
, const char **argv
, const char **environ
);
80 image_id
load_add_on(const char *path
);
81 status_t
unload_add_on(image_id image
);
82 status_t
get_image_symbol(image_id image
, const char *name
, int32 symbolType
,
83 void **_symbolLocation
);
84 status_t
get_nth_image_symbol(image_id image
, int32 n
, char *nameBuffer
,
85 int32
*_nameLength
, int32
*_symbolType
, void **_symbolLocation
);
86 void clear_caches(void *address
, size_t length
, uint32 flags
);
88 #define get_image_info(image, info) \
89 _get_image_info((image), (info), sizeof(*(info)))
90 #define get_next_image_info(team, cookie, info) \
91 _get_next_image_info((team), (cookie), (info), sizeof(*(info)))
93 /* private, use the macros above */
94 status_t
_get_image_info(image_id image
, image_info
*info
, size_t size
);
95 status_t
_get_next_image_info(team_id team
, int32
*cookie
, image_info
*info
,
99 void __haiku_init_before(image_id id
);
105 #endif /* _IMAGE_H */