Chameleon

Chameleon Svn Source Tree

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

Source at commit 338 created 13 years 8 months ago.
By meklort, Modules can not depend on each other. Modules can be linked using the -weak-libary cmmand in ld. Untested.
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
11typedef struct symbolList_t{
12char* symbol;
13unsigned int addr;
14struct symbolList_t* next;
15} symbolList_t;
16
17typedef struct moduleList_t{
18char* module;
19unsigned int version;
20unsigned int compat;
21struct moduleList_t* next;
22} moduleList_t;
23
24#ifndef __BOOT_MODULES_H
25#define __BOOT_MODULES_H
26
27#define SYMBOLS_MODULE "Symbols"
28
29#define SYMBOL_DYLD_STUB_BINDER"dyld_stub_binder"
30#define STUB_ENTRY_SIZE6
31
32#define SECT_NON_LAZY_SYMBOL_PTR"__nl_symbol_ptr"
33#define SECT_SYMBOL_STUBS"__symbol_stub"
34
35#define SUCCESS1
36#defineERROR0
37
38int load_module(const char* module);
39int is_module_laoded(const char* name);
40void module_loaded(char* name, UInt32 version, UInt32 compat);
41
42void add_symbol(char* symbol, void* addr);
43void* parse_mach(void* binary);
44
45unsigned int handle_symtable(UInt32 base, struct symtab_command* symtabCommand, char* symbolStub, char* nonlazy);
46
47unsigned int lookup_external_all(const char* name);
48
49#endif /* __BOOT_MODULES_H */

Archive Download this file

Revision: 338