Chameleon

Chameleon Commit Details

Date:2011-06-05 18:55:04 (8 years 2 months ago)
Author:Azimutz
Commit:965
Parents: 964
Message:Merge trunk changes since r944, with the exception to the ones made to Resolution module. FOLDER_README.txt update.
Changes:
M/branches/azimutz/trunkAutoResolution/i386/boot2/modules.h
M/branches/azimutz/trunkAutoResolution/i386/libsaio/smbios.h
M/branches/azimutz/trunkAutoResolution
M/branches/azimutz/trunkAutoResolution/i386/modules/MakeInc.dir
M/branches/azimutz/trunkAutoResolution/FOLDER_README.txt
M/branches/azimutz/trunkAutoResolution/i386/boot2/modules.c

File differences

branches/azimutz/trunkAutoResolution/i386/boot2/modules.c
1111
1212
1313
14
1415
1516
1617
......
5859
5960
6061
61
62
6263
6364
6465
......
7475
7576
7677
77
78
7879
7980
8081
......
9293
9394
9495
95
96
97
98
99
100
101
96102
97103
98104
99
105
100106
101107
102108
......
171177
172178
173179
174
180
175181
176182
177183
......
231237
232238
233239
234
240
235241
236242
237243
238244
239245
240246
241
242
243
247
248
249
250
251
252
253
254
255
256
257
258
259
260
244261
245262
246263
#include "bootstruct.h"
#include "modules.h"
#include "boot_modules.h"
#include <vers.h>
#if CONFIG_MODULE_DEBUG
if(module_start && module_start != (void*)0xFFFFFFFF)
{
// Notify the system that it was laoded
module_loaded(SYMBOLS_MODULE /*moduleName, moduleVersion, moduleCompat*/);
module_loaded(SYMBOLS_MODULE, SYMBOLS_AUTHOR, SYMBOLS_DESCRIPTION, SYMBOLS_VERSION, SYMBOLS_COMPAT);
(*module_start)();// Start the module. This will point to load_all_modules due to the way the dylib was constructed.
execute_hook("ModulesLoaded", NULL, NULL, NULL, NULL);
if(module_start && module_start != (void*)0xFFFFFFFF)
{
// Notify the system that it was laoded
module_loaded(SYMBOLS_MODULE /*moduleName, moduleVersion, moduleCompat*/);
module_loaded(SYMBOLS_MODULE, SYMBOLS_AUTHOR, SYMBOLS_DESCRIPTION, SYMBOLS_VERSION, SYMBOLS_COMPAT);
(*module_start)();// Start the module. This will point to load_all_modules due to the way the dylib was constructed.
execute_hook("ModulesLoaded", NULL, NULL, NULL, NULL);
return retVal;
}
void start_built_in_module(char* name, void(*start_function)(void))
void start_built_in_module(const char* name,
const char* author,
const char* description,
UInt32 version,
UInt32 compat,
void(*start_function)(void))
{
start_function();
// Notify the module system that this module really exists, specificaly, let other module link with it
module_loaded(name /*, moduleName, moduleVersion, moduleCompat*/);
module_loaded(name, author, description, version, compat);
}
if(module_start && module_start != (void*)0xFFFFFFFF)
{
// Notify the system that it was laoded
module_loaded(module/*moduleName, moduleVersion, moduleCompat*/);
module_loaded(module, NULL, NULL, 0, 0 /*moduleName, moduleVersion, moduleCompat*/);
(*module_start)();// Start the module
DBG("Module %s Loaded.\n", module); DBGPAUSE();
}
/*
* print out the information about the loaded module
*/
void module_loaded(const char* name/*, UInt32 version, UInt32 compat*/)
void module_loaded(const char* name, const char* author, const char* description, UInt32 version, UInt32 compat)
{
moduleList_t* new_entry = malloc(sizeof(moduleList_t));
new_entry->next = loadedModules;
loadedModules = new_entry;
new_entry->name = (char*)name;
//new_entry->version = version;
//new_entry->compat = compat;
if(!name) name = "Unknown";
if(!author) author = "Unknown";
if(!description) description = "";
new_entry->name = name;
new_entry->author = author;
new_entry->description = description;
new_entry->version = version;
new_entry->compat = compat;
msglog("Module '%s' by '%s' Loaded.\n", name, author);
msglog("\tDescription: %s\n", description);
msglog("\tVersion: %d\n", version); // todo: sperate to major.minor.bugfix
msglog("\tCompat: %d\n", compat); // todo: ^^^ major.minor.bugfix
}
int is_module_loaded(const char* name)
branches/azimutz/trunkAutoResolution/i386/boot2/modules.h
1313
1414
1515
16
1617
18
19
20
21
22
1723
1824
1925
......
4349
4450
4551
46
47
48
52
53
54
55
56
4957
5058
5159
......
5462
5563
5664
57
65
66
67
68
69
70
5871
59
6072
6173
62
74
6375
6476
6577
#define __BOOT_MODULES_H
#define MODULE_PATH"/Extra/modules/"
#define SYMBOLS_MODULE "Symbols.dylib"
#define SYMBOLS_AUTHOR "Chameleon"
#define SYMBOLS_DESCRIPTION "Chameleon symbols for linking"
#define SYMBOLS_VERSION 0
#define SYMBOLS_COMPAT 0
#define VOID_SYMBOL"dyld_void_start"
extern UInt64 textAddress;
extern UInt64 textSection;
typedef struct modulesList_t
{
char*name;
//UInt32version;
//UInt32compat;
const char*name;
const char* author;
const char* description;
UInt32version;
UInt32compat;
struct modulesList_t* next;
} moduleList_t;
int init_module_system();
void load_all_modules();
void start_built_in_module(char* name, void(*start_function)(void));
void start_built_in_module(const char* name,
const char* author,
const char* description,
UInt32 version,
UInt32 compat,
void(*start_function)(void));
int load_module(char* module);
int is_module_loaded(const char* name);
void module_loaded(const char* name/*, UInt32 version, UInt32 compat*/);
void module_loaded(const char* name, const char* author, const char* description, UInt32 version, UInt32 compat);
branches/azimutz/trunkAutoResolution/i386/modules/MakeInc.dir
108108
109109
110110
111
111
112112
113113
114114
......
118118
119119
120120
121
122
121123
122124
123125
124126
125
127
126128
127129
128130
......
135137
136138
137139
140
141
138142
139143
140
144
141145
142146
143147
......
161165
162166
163167
164
168
165169
166170
167171
172
173
174
175
176
177
168178
169
170179
171180
ifeq ($(BUILT_IN),yes)
$(SYMROOT)/modules/$(MODULE_NAME).dylib: $(addprefix $(OBJROOT)/, ${MODULE_OBJS}) $(MODULE_DEPENDENCIES)
$(SYMROOT)/modules/$(MODULE_NAME).dylib: $(addprefix $(OBJROOT)/, ${MODULE_OBJS}) $(MODULE_DEPENDENCIES) $(OBJROOT)/$(MODULE_NAME).desc $(OBJROOT)/$(MODULE_NAME).author Makefile
@echo "\t[LD] $(MODULE_NAME).dylib"
@ld -arch i386 -undefined dynamic_lookup \
-dylib -read_only_relocs suppress \
-final_output $(MODULE_NAME) \
$(filter %.o,$^) \
-macosx_version_min 10.6 \
-sectcreate __INFO __author $(OBJROOT)/$(MODULE_NAME).author \
-sectcreate __INFO __description $(OBJROOT)/$(MODULE_NAME).desc \
-o $(SYMROOT)/modules/$(MODULE_NAME).dylib
else
$(SYMROOT)/modules/$(MODULE_NAME).dylib: $(addprefix $(OBJROOT)/, ${MODULE_OBJS}) $(MODULE_DEPENDENCIES) $(SRCROOT)/obj/i386/boot2/Symbols_LINKER_ONLY.dylib
$(SYMROOT)/modules/$(MODULE_NAME).dylib: $(addprefix $(OBJROOT)/, ${MODULE_OBJS}) $(MODULE_DEPENDENCIES) $(OBJROOT)/$(MODULE_NAME).desc $(OBJROOT)/$(MODULE_NAME).author $(SRCROOT)/obj/i386/boot2/Symbols_LINKER_ONLY.dylib Makefile
@echo "\t[LD] $(MODULE_NAME).dylib"
@ld -arch i386 \
$(filter %.o,$^) \
-weak_library $(SRCROOT)/obj/i386/boot2/Symbols_LINKER_ONLY.dylib \
$(MODULE_DEPENDENCIES_CMD) \
-sectcreate __INFO __author $(OBJROOT)/$(MODULE_NAME).author \
-sectcreate __INFO __description $(OBJROOT)/$(MODULE_NAME).desc \
-macosx_version_min 10.6 \
-o $@
endif
.PHONY: $(SRCROOT)/sym/i386/boot_modules.c
$(SRCROOT)/sym/i386/boot_modules.c:
@echo "\tstart_built_in_module(\"$(MODULE_NAME)\", &$(MODULE_START));" >> $@
@echo "\tstart_built_in_module(\"$(MODULE_NAME)\", \"$(MODULE_AUTHOR)\", \"$(MODULE_DESCRIPTION)\", 0, 0, &$(MODULE_START));" >> $@
$(SRCROOT)/sym/i386/boot_modules.h:
@echo "void $(MODULE_START)(); // $(MODULE_NAME)" >> $@
$(OBJROOT)/$(MODULE_NAME).author: Makefile
@echo "$(MODULE_AUTHOR)" > $@
$(OBJROOT)/$(MODULE_NAME).desc: Makefile
@echo "$(MODULE_DESCRIPTION)" > $@
#dependencies
-include $(OBJROOT)/Makedep
branches/azimutz/trunkAutoResolution/FOLDER_README.txt
99
1010
1111
12
13
1214
15
1316
1417
1518
by Diebuche to hold the original patch, for both documentation and eventual merge
to the trunk.
Also note that, the Resolution module is not present, since it's functionality is
covered by AutoResolution.
Credits and Thanks to Lebidou.
Original patch and topic:

Archive Download the corresponding diff file

Revision: 965