From 2aae3b45f3672b1e58ff4294ec651efc3cdf81d0 Mon Sep 17 00:00:00 2001 From: Chief Date: Sat, 20 Jun 2015 11:54:17 +0200 Subject: [PATCH] Removed a global and some other minor changes --- i386/boot2/boot.c | 12 ++++++------ i386/boot2/drivers.c | 8 ++++---- i386/config/settings-template.h | 10 ++++++++-- i386/libsaio/load.c | 14 ++++++-------- i386/libsaio/platform.c | 4 +--- i386/libsaio/platform.h | 11 +++++++---- i386/libsaio/sl.h | 3 --- 7 files changed, 32 insertions(+), 30 deletions(-) diff --git a/i386/boot2/boot.c b/i386/boot2/boot.c index 2155e68..6ae02b2 100755 --- a/i386/boot2/boot.c +++ b/i386/boot2/boot.c @@ -229,7 +229,7 @@ void boot(int biosdev) printf("\nModel: %s\n", gPlatform.ModelID); #if ((MAKE_TARGET_OS & LION) != LION) - printf("\ngArchCPUType (CPU): %s\n", (gArchCPUType == CPU_TYPE_X86_64) ? "x86_64" : "i386"); + printf("\nArchCPUType (CPU): %s\n", (gPlatform.ArchCPUType == CPU_TYPE_X86_64) ? "x86_64" : "i386"); sleep(3); // Silent sleep. #endif #endif @@ -312,9 +312,9 @@ void boot(int biosdev) // Is 'arch=' specified as kernel flag? if (getValueForBootKey(kernelFlags, "arch", &val, &length)) // && len >= 4) { - gArchCPUType = (strncmp(val, "x86_64", 6) == 0) ? CPU_TYPE_X86_64 : CPU_TYPE_I386; + gPlatform.ArchCPUType = (strncmp(val, "x86_64", 6) == 0) ? CPU_TYPE_X86_64 : CPU_TYPE_I386; - _BOOT_DEBUG_DUMP("gArchCPUType (c.a.B.plist): %s\n", (gArchCPUType == CPU_TYPE_X86_64) ? "x86_64" : "i386"); + _BOOT_DEBUG_DUMP("ArchCPUType (c.a.B.plist): %s\n", (gPlatform.ArchCPUType == CPU_TYPE_X86_64) ? "x86_64" : "i386"); } // Check for -v (verbose) and -s (single user mode) flags. @@ -655,7 +655,7 @@ void boot(int biosdev) // Create path to pre-linked kernel. sprintf(preLinkedKernelPath, "%s/%s_%s.%08lX", gPlatform.KernelCachePath, kKernelCache, - ((gArchCPUType == CPU_TYPE_X86_64) ? "x86_64" : "i386"), adler32); + ((gPlatform.ArchCPUType == CPU_TYPE_X86_64) ? "x86_64" : "i386"), adler32); // Check if this file exists. if ((GetFileInfo(NULL, preLinkedKernelPath, &flags, &cachetime) == 0) && ((flags & kFileTypeMask) == kFileTypeFlat)) @@ -694,11 +694,11 @@ void boot(int biosdev) retStatus = LoadThinFatFile(bootFile, &fileLoadBuffer); #if SUPPORT_32BIT_MODE - if (retStatus <= 0 && gArchCPUType == CPU_TYPE_X86_64) + if (retStatus <= 0 && gPlatform.ArchCPUType == CPU_TYPE_X86_64) { _BOOT_DEBUG_DUMP("Load failed for arch=x86_64, trying arch=i386 now.\n"); - gArchCPUType = CPU_TYPE_I386; + gPlatform.ArchCPUType = CPU_TYPE_I386; retStatus = LoadThinFatFile(bootFile, &fileLoadBuffer); } diff --git a/i386/boot2/drivers.c b/i386/boot2/drivers.c index ae5c409..4d9a3cb 100755 --- a/i386/boot2/drivers.c +++ b/i386/boot2/drivers.c @@ -969,17 +969,17 @@ long decodeKernel(void *fileLoadBuffer, entry_t *rentry, char **raddr, int *rsiz ret = ThinFatFile(&fileLoadBuffer, &len); - if (ret == 0 && len == 0 && gArchCPUType == CPU_TYPE_X86_64) + if (ret == 0 && len == 0 && gPlatform.ArchCPUType == CPU_TYPE_X86_64) { - gArchCPUType = CPU_TYPE_I386; + gPlatform.ArchCPUType = CPU_TYPE_I386; ret = ThinFatFile(&fileLoadBuffer, &len); } ret = DecodeMachO(fileLoadBuffer, rentry, raddr, rsize); - if (ret < 0 && gArchCPUType == CPU_TYPE_X86_64) + if (ret < 0 && gPlatform.ArchCPUType == CPU_TYPE_X86_64) { - gArchCPUType = CPU_TYPE_I386; + gPlatform.ArchCPUType = CPU_TYPE_I386; ret = DecodeMachO(fileLoadBuffer, rentry, raddr, rsize); } diff --git a/i386/config/settings-template.h b/i386/config/settings-template.h index 8426894..a393ef7 100755 --- a/i386/config/settings-template.h +++ b/i386/config/settings-template.h @@ -229,6 +229,8 @@ // only to give us feedback for a future release of RevoBoot. #endif +#define DISABLE_LEGACY_XHCI 0 // Set to 0 by default. Change this to 1 when you need to disable legacy XHCI. + #define DEBUG_BOOT 0 // Set to 0 by default. Change this to 1 when things don't seem to work for you. @@ -359,17 +361,20 @@ #define STATIC_SCREEN_HEIGHT 1200 // Used (in RevoBoot v1.0.35 and greater) when USE_STATIC_DISPLAY_RESOLUTION is 1 and when // USE_STATIC_DISPLAY_RESOLUTION is 0 but getResolutionFromEDID() isn't supported (failed). +#define BLACKMODE 1 // Show white Apple logo on a black background. Set to 0 for gray mode. + #define DEBUG_BOOT_GRAPHICS 0 // Set to 0 by default. Use 1 when to see debug info. //------------------------------------------------------------ STRINGTABLE.H ---------------------------------------------------------------- #define INSTALL_ESD_SUPPORT 0 // Set to 0 by default. Setting this to 1 will make RevoBoot search in specific directories - // for com.apple.Boot.plist – required for Mac like Lion OS X installations. + // for com.apple.Boot.plist – required for Mac like installations of OS X. #if (RECOVERY_HD_SUPPORT == 1 && INSTALL_ESD_SUPPORT == 0) #define INSTALL_ESD_SUPPORT 1 // This setting is mandatory for RECOVERY_HD_SUPPORT #endif + //-------------------------------------------------------------- SMBIOS.C ------------------------------------------------------------------ @@ -421,7 +426,8 @@ #if USE_STATIC_SMBIOS_DATA // Do nothing. -#elif OVERRIDE_DYNAMIC_MEMORY_DETECTION +#elif OVERRIDE_DYNAMIC_MEMORY_DETECTION // See settings under SMBIOS.c + // Setup RAM module info. Please note that you may have to expand this when you have more RAM modules. #define STATIC_RAM_SLOTS 4 // Number of RAM slots on mainboard. diff --git a/i386/libsaio/load.c b/i386/libsaio/load.c index 0f537bb..ffba2ef 100755 --- a/i386/libsaio/load.c +++ b/i386/libsaio/load.c @@ -70,8 +70,6 @@ static long DecodeSymbolTable(long cmdBase); static unsigned long gBinaryAddress; -cpu_type_t gArchCPUType = 0; // CPU_TYPE_I386; - //============================================================================== // Public function. @@ -115,7 +113,7 @@ long ThinFatFile(void **binary, unsigned long *length) fapsize = fap->size; } - if (fapcputype == gArchCPUType) + if (fapcputype == gPlatform.ArchCPUType) { *binary = (void *) ((unsigned long)*binary + fapoffset); size = fapsize; @@ -160,14 +158,14 @@ long DecodeMachO(void *binary, entry_t *rentry, char **raddr, int *rsize) sleep(5); #endif - /* if ((gArchCPUType == CPU_TYPE_I386 && mH->magic != MH_MAGIC) || - (gArchCPUType == CPU_TYPE_X86_64 && mH->magic != MH_MAGIC_64)) + /* if ((gPlatform.ArchCPUType == CPU_TYPE_I386 && mH->magic != MH_MAGIC) || + (gPlatform.ArchCPUType == CPU_TYPE_X86_64 && mH->magic != MH_MAGIC_64)) { error("Mach-O file has bad magic number\n"); return -1; } */ - switch (gArchCPUType) + switch (gPlatform.ArchCPUType) { case CPU_TYPE_I386: @@ -202,7 +200,7 @@ long DecodeMachO(void *binary, entry_t *rentry, char **raddr, int *rsize) return -1; } - /* cmdstart = (unsigned long)gBinaryAddress + (gArchCPUType == CPU_TYPE_I386) ? sizeof(struct mach_header) : + /* cmdstart = (unsigned long)gBinaryAddress + (gPlatform.ArchCPUType == CPU_TYPE_I386) ? sizeof(struct mach_header) : sizeof(struct mach_header_64); */ cmdBase = cmdstart; ncmds = mH->ncmds; @@ -564,7 +562,7 @@ static long DecodeSegment(long cmdBase, unsigned int *load_addr, unsigned int *l static long DecodeUnixThread(long cmdBase, unsigned int *entry) { - switch (gArchCPUType) + switch (gPlatform.ArchCPUType) { case CPU_TYPE_I386: { diff --git a/i386/libsaio/platform.c b/i386/libsaio/platform.c index aa95208..149bd4f 100644 --- a/i386/libsaio/platform.c +++ b/i386/libsaio/platform.c @@ -166,11 +166,9 @@ void initPlatform(int biosDevice, bool bootRecoveryHD) * DHP: Booting with arch=i386 and setting this to CPU_TYPE_I386 * and setting the EFI_64_BIT directive in private_data to 0 allowed me * to boot in EFI32 mode. Even with my 64 bit configuration. Pretty sweet. - * - * Note to self: Get rid of gArchCPUType (global alarm) fast. */ - gPlatform.ArchCPUType = gArchCPUType = getArchCPUType(); + gPlatform.ArchCPUType = getArchCPUType(); gPlatform.AddressWidth = (gPlatform.ArchCPUType == CPU_TYPE_X86_64) ? 8 : 4; diff --git a/i386/libsaio/platform.h b/i386/libsaio/platform.h index 59954e2..3813207 100644 --- a/i386/libsaio/platform.h +++ b/i386/libsaio/platform.h @@ -130,8 +130,13 @@ //------------------------------------------------------------------------------ -#define kKernelCachePath "/System/Library/Caches/com.apple.kext.caches/Startup" -#define kKernelCache "kernelcache" +#if ((MAKE_TARGET_OS & YOSEMITE) == YOSEMITE) // Yosemite and El Capitan. + #define kKernelCachePath "/System/Library/Prelinkedkernels" + #define kKernelCache "prelinkedkernel" +#else + #define kKernelCachePath "/System/Library/Caches/com.apple.kext.caches/Startup" + #define kKernelCache "kernelcache" +#endif //------------------------------------------------------------------------------ @@ -366,8 +371,6 @@ typedef struct _PlatformInfo_t extern void initCPUStruct(void); /* platform.c */ -extern cpu_type_t gArchCPUType; // DHP: Fix / remove me! - extern PlatformInfo_t gPlatform; extern void initPlatform(int biosDevice, bool bootRecoveryHD); diff --git a/i386/libsaio/sl.h b/i386/libsaio/sl.h index 2706a24..79715e0 100755 --- a/i386/libsaio/sl.h +++ b/i386/libsaio/sl.h @@ -65,7 +65,4 @@ enum extern void * gFSLoadAddress; -// Used in: boot/drivers/load.c -extern cpu_type_t gArchCPUType; // Formerly known as archCpuType. - #endif /* !__LIBSAIO_SL_H */