Index: branches/meklort/i386/boot2/boot.c =================================================================== --- branches/meklort/i386/boot2/boot.c (revision 648) +++ branches/meklort/i386/boot2/boot.c (revision 649) @@ -287,7 +287,7 @@ // Load boot.plist config file status = loadSystemConfig(&bootInfo->bootConfig); - + if (getBoolForKey(kQuietBootKey, &quiet, &bootInfo->bootConfig) && quiet) { gBootMode |= kBootModeQuiet; } @@ -628,11 +628,11 @@ const char *val; int len; - if (!loadConfigFile("System/Library/CoreServices/SystemVersion.plist", &systemVersion)) + if (!loadConfigFile("/System/Library/CoreServices/SystemVersion.plist", &systemVersion)) { valid = true; } - else if (!loadConfigFile("System/Library/CoreServices/ServerVersion.plist", &systemVersion)) + else if (!loadConfigFile("/System/Library/CoreServices/ServerVersion.plist", &systemVersion)) { valid = true; } Index: branches/meklort/i386/boot2/modules.c =================================================================== --- branches/meklort/i386/boot2/modules.c (revision 648) +++ branches/meklort/i386/boot2/modules.c (revision 649) @@ -61,7 +61,16 @@ // Intialize module system if(symbols_module_start == (void*)0xFFFFFFFF) { - printf("Module system not compiled in\n"); + DBG("Module system not compiled in\n"); + load_module(SYMBOLS_MODULE); + + lookup_symbol = (void*)lookup_all_symbols(SYMBOL_LOOKUP_SYMBOL); + + if((UInt32)lookup_symbol != 0xFFFFFFFF) + { + return 1; + } + return 0; } @@ -383,6 +392,7 @@ switch ((loadCommand->cmd & 0x7FFFFFFF)) { + // TODO: sepeare function to handel appropriate sections case LC_SYMTAB: symtabCommand = binary + binaryIndex; break; @@ -416,6 +426,31 @@ } } } + else if(strcmp("__DATA", segCommand->segname) == 0) + { + UInt32 sectionIndex; + + sectionIndex = sizeof(struct segment_command); + + struct section *sect; + + while(sectionIndex < segCommand->cmdsize) + { + sect = binary + binaryIndex + sectionIndex; + + sectionIndex += sizeof(struct section); + + + if(strcmp("__bss", sect->sectname) == 0) + { + // __TEXT,__text found, save the offset and address for when looking for the calls. + //printf("__DATA,__bss found.\n"); getc(); + break; + } + } + + } + break; case LC_SEGMENT_64: // 64bit macho's segCommand64 = binary + binaryIndex; @@ -447,7 +482,32 @@ } } } + else if(strcmp("__DATA", segCommand->segname) == 0) + { + UInt32 sectionIndex; + + sectionIndex = sizeof(struct segment_command_64); + + struct section_64 *sect; + + while(sectionIndex < segCommand->cmdsize) + { + sect = binary + binaryIndex + sectionIndex; + + sectionIndex += sizeof(struct section); + + + if(strcmp("__bss", sect->sectname) == 0) + { + // __TEXT,__text found, save the offset and address for when looking for the calls. + //printf("__DATA,__bss found.\n"); getc(); + break; + } + } + + } + break; case LC_DYSYMTAB: @@ -1214,6 +1274,7 @@ char* binary = (char*)addr; if(addr != 0xFFFFFFFF) { + DBG("Replacing %s to point to 0x%x\n", symbol, newAddress); *binary++ = 0xFF; // Jump *binary++ = 0x25; // Long Jump *((UInt32*)binary) = (UInt32)jumpPointer; Index: branches/meklort/i386/boot2/modules.h =================================================================== --- branches/meklort/i386/boot2/modules.h (revision 648) +++ branches/meklort/i386/boot2/modules.h (revision 649) @@ -16,6 +16,18 @@ #ifndef __BOOT_MODULES_H #define __BOOT_MODULES_H +#define SYMBOLS_MODULE "Symbols.dylib" + +#define SYMBOL_DYLD_STUB_BINDER "dyld_stub_binder" +#define SYMBOL_LOOKUP_SYMBOL "_lookup_symbol" +#define STUB_ENTRY_SIZE 6 + +#define SECT_NON_LAZY_SYMBOL_PTR "__nl_symbol_ptr" +#define SECT_SYMBOL_STUBS "__symbol_stub" + + +#define VALID_FUNCTION(__x__) (__x__ && (void*)__x__ != (void*)0xFFFFFFFF) + extern unsigned long long textAddress; extern unsigned long long textSection; @@ -48,17 +60,8 @@ struct moduleHook_t* next; } moduleHook_t; -#define SYMBOLS_MODULE "Symbols.dylib" -#define SYMBOL_DYLD_STUB_BINDER "dyld_stub_binder" -#define SYMBOL_LOOKUP_SYMBOL "_lookup_symbol" -#define STUB_ENTRY_SIZE 6 -#define SECT_NON_LAZY_SYMBOL_PTR "__nl_symbol_ptr" -#define SECT_SYMBOL_STUBS "__symbol_stub" - - - int init_module_system(); void load_all_modules(); Index: branches/meklort/i386/boot2/Makefile =================================================================== --- branches/meklort/i386/boot2/Makefile (revision 648) +++ branches/meklort/i386/boot2/Makefile (revision 649) @@ -83,7 +83,7 @@ @make embed_symbols # this is done in a sub process after boot.sys exists so the strings are populated correctly - ${RM} $(SYMROOT)/${SYMBOLS_MODULE} + ##${RM} $(SYMROOT)/${SYMBOLS_MODULE} size $(SYMROOT)/boot.sys ls -l $(SYMROOT)/boot @@ -102,7 +102,7 @@ echo ******* Patching at $(PATCH_ADDR) ****** stat -f%z $(SYMROOT)/boot | perl -ane "print pack('V',@F[0]);" | dd conv=notrunc of=${SYMROOT}/boot_embeded.sys bs=1 count=4 seek=$(PATCH_ADDR) - machOconv $(SYMROOT)/boot_embeded.sys $(SYMROOT)/boot + machOconv $(SYMROOT)/boot_embeded.sys $(SYMROOT)/boot_embeded prompt.o: vers.h