xref: /haiku/headers/private/kernel/elf.h (revision 3dfd9cb95ce45f59160d50975210bc55e3fc0709)
1 /*
2  * Copyright 2005, Haiku Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT license.
4  *
5  * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
6  * Distributed under the terms of the NewOS License.
7  */
8 #ifndef _KERNEL_ELF_H
9 #define _KERNEL_ELF_H
10 
11 
12 #include <thread.h>
13 #include <image.h>
14 
15 
16 struct kernel_args;
17 
18 
19 struct elf_symbol_info {
20 	addr_t	address;
21 	size_t	size;
22 };
23 
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 status_t elf_load_user_image(const char *path, Team *team, int flags,
30 	addr_t *_entry);
31 
32 // these two might get public one day:
33 image_id load_kernel_add_on(const char *path);
34 status_t unload_kernel_add_on(image_id id);
35 
36 status_t elf_debug_lookup_symbol_address(addr_t address, addr_t *_baseAddress,
37 			const char **_symbolName, const char **_imageName,
38 			bool *_exactMatch);
39 status_t elf_debug_lookup_user_symbol_address(Team* team, addr_t address,
40 			addr_t *_baseAddress, const char **_symbolName,
41 			const char **_imageName, bool *_exactMatch);
42 addr_t elf_debug_lookup_symbol(const char* searchName);
43 status_t elf_lookup_kernel_symbol(const char* name, elf_symbol_info* info);
44 struct elf_image_info* elf_get_kernel_image();
45 status_t elf_get_image_info_for_address(addr_t address, image_info* info);
46 image_id elf_create_memory_image(const char* imageName, addr_t text,
47 			size_t textSize, addr_t data, size_t dataSize);
48 status_t elf_add_memory_image_symbol(image_id id, const char* name,
49 			addr_t address, size_t size, int32 type);
50 status_t elf_init(struct kernel_args *args);
51 
52 status_t _user_read_kernel_image_symbols(image_id id,
53 			struct Elf32_Sym* symbolTable, int32* _symbolCount,
54 			char* stringTable, size_t* _stringTableSize, addr_t* _imageDelta);
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 
60 #endif	/* _KERNEL_ELF_H */
61