Chameleon

Chameleon Svn Source Tree

Root/branches/meklort/i386/boot2/modules.h

Source at commit 363 created 13 years 8 months ago.
By meklort, Cleaned up some code, added comments
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
14typedef struct symbolList_t{
15char* symbol;
16unsigned int addr;
17struct symbolList_t* next;
18} symbolList_t;
19
20typedef struct moduleList_t{
21char* module;
22unsigned int version;
23unsigned int compat;
24struct 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_SIZE6
32
33#define SECT_NON_LAZY_SYMBOL_PTR"__nl_symbol_ptr"
34#define SECT_SYMBOL_STUBS"__symbol_stub"
35
36
37
38int init_module_system();
39void load_all_modules();
40
41
42inline void rebase_location(UInt32* location, char* base);
43
44int load_module(const char* module);
45int is_module_laoded(const char* name);
46void module_loaded(char* name, UInt32 version, UInt32 compat);
47
48void add_symbol(char* symbol, void* addr);
49void* parse_mach(void* binary);
50
51unsigned int handle_symtable(UInt32 base, struct symtab_command* symtabCommand, char* symbolStub, UInt32 nonlazy);
52
53unsigned int lookup_all_symbols(const char* name);
54
55extern unsigned int (*lookup_symbol)(const char*);
56
57#endif /* __BOOT_MODULES_H */

Archive Download this file

Revision: 363