Root/
Source at commit 356 created 13 years 11 months ago. By meklort, Fixed date, changed one or two things | |
---|---|
1 | /*␊ |
2 | * Module Loading functionality␊ |
3 | * Copyright 2009 Evan Lojewski. All rights reserved.␊ |
4 | *␊ |
5 | */␊ |
6 | ␊ |
7 | #include <mach-o/loader.h>␊ |
8 | #include <mach-o/nlist.h>␊ |
9 | ␊ |
10 | #ifndef __BOOT_MODULES_H␊ |
11 | #define __BOOT_MODULES_H␊ |
12 | ␊ |
13 | ␊ |
14 | typedef struct symbolList_t{␊ |
15 | ␉char* symbol;␊ |
16 | ␉unsigned int addr;␊ |
17 | ␉struct symbolList_t* next;␊ |
18 | } symbolList_t;␊ |
19 | ␊ |
20 | typedef struct moduleList_t{␊ |
21 | ␉char* module;␊ |
22 | ␉unsigned int version;␊ |
23 | ␉unsigned int compat;␊ |
24 | ␉struct moduleList_t* next;␊ |
25 | } moduleList_t;␊ |
26 | ␊ |
27 | ␊ |
28 | #define SYMBOLS_MODULE "Symbols"␊ |
29 | ␊ |
30 | #define SYMBOL_DYLD_STUB_BINDER␉"dyld_stub_binder"␊ |
31 | #define STUB_ENTRY_SIZE␉6␊ |
32 | ␊ |
33 | #define SECT_NON_LAZY_SYMBOL_PTR␉"__nl_symbol_ptr"␊ |
34 | #define SECT_SYMBOL_STUBS␉␉␉"__symbol_stub"␊ |
35 | ␊ |
36 | #define SUCCESS␉1␊ |
37 | #define␉ERROR␉0␊ |
38 | ␊ |
39 | int load_module(const char* module);␊ |
40 | int is_module_laoded(const char* name);␊ |
41 | void module_loaded(char* name, UInt32 version, UInt32 compat);␊ |
42 | ␊ |
43 | void add_symbol(char* symbol, void* addr);␊ |
44 | void* parse_mach(void* binary);␊ |
45 | ␊ |
46 | unsigned int handle_symtable(UInt32 base, struct symtab_command* symtabCommand, char* symbolStub, UInt32 nonlazy);␊ |
47 | ␊ |
48 | unsigned int lookup_all_symbols(const char* name);␊ |
49 | ␊ |
50 | extern unsigned int (*lookup_symbol)(const char*);␊ |
51 | ␊ |
52 | #endif /* __BOOT_MODULES_H */ |