static int ExecKernel(void *binary) { int ret; entry_t kernelEntry; bootArgs->kaddr = bootArgs->ksize = 0; execute_hook("ExecKernel", (void*)binary, NULL, NULL, NULL); ret = DecodeKernel(binary, &kernelEntry, (char **) &bootArgs->kaddr, (int *)&bootArgs->ksize ); if ( ret != 0 ) return ret; // Reserve space for boot args reserveKernBootStruct(); // Notify modules that the kernel has been decoded execute_hook("DecodedKernel", (void*)binary, (void*)bootArgs->kaddr, (void*)bootArgs->ksize, NULL); setupFakeEfi(); // Load boot drivers from the specifed root path. //if (!gHaveKernelCache) LoadDrivers("/"); execute_hook("DriversLoaded", (void*)binary, NULL, NULL, NULL); clearActivityIndicator(); if (gErrors) { printf("Errors encountered while starting up the computer.\n"); printf("Pausing %d seconds...\n", kBootErrorTimeout); sleep(kBootErrorTimeout); } md0Ramdisk(); // Cleanup the PXE base code. if ( (gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit ) { if ( (ret = nbpUnloadBaseCode()) != nbpStatusSuccess ) { printf("nbpUnloadBaseCode error %d\n", (int) ret); sleep(2); } } bool dummyVal; if (getBoolForKey(kWaitForKeypressKey, &dummyVal, &bootInfo->chameleonConfig) && dummyVal) { showTextBuffer(msgbuf, strlen(msgbuf)); } usb_loop(); // If we were in text mode, switch to graphics mode. // This will draw the boot graphics unless we are in // verbose mode. if (gVerboseMode) { setVideoMode( GRAPHICS_MODE, 0 ); } else { drawBootGraphics(); } DBG("Starting Darwin/%s [%s]\n",( archCpuType == CPU_TYPE_I386 ) ? "x86" : "x86_64", gDarwinBuildVerStr); DBG("Boot Args: %s\n", bootArgs->CommandLine); setupBooterLog(); finalizeBootStruct(); // Jump to kernel's entry point. There's no going back now. if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9"))) { // Notify modules that the kernel is about to be started execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgs, NULL, NULL); // Masking out so that Lion doesn't doublefault outb(0x21, 0xff); /* Maskout all interrupts Pic1 */ outb(0xa1, 0xff); /* Maskout all interrupts Pic2 */ startprog( kernelEntry, bootArgs ); } else { // Notify modules that the kernel is about to be started execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgsPreLion, NULL, NULL); startprog( kernelEntry, bootArgsPreLion ); } // Not reached return 0; }
static int ExecKernel(void *binary) { entry_t kernelEntry; int ret; bootArgs->kaddr = bootArgs->ksize = 0; execute_hook("ExecKernel", (void*)binary, NULL, NULL, NULL); //Azi: gHaveKernelCache is set here ret = DecodeKernel(binary, &kernelEntry, (char **) &bootArgs->kaddr, (int *)&bootArgs->ksize ); if ( ret != 0 ) return ret; // Reserve space for boot args reserveKernBootStruct(); //Azi: ... // Load boot drivers from the specifed root path, // if we don't have a prelinked kernel - check load.c 43 & 264 if (!gHaveKernelCache) { LoadDrivers("/"); } clearActivityIndicator(); if (gErrors) { printf("Errors encountered while starting up the computer.\n"); printf("Pausing %d seconds...\n", kBootErrorTimeout); sleep(kBootErrorTimeout); } setupFakeEfi(); //Azi: check position on Mek (plkernel) md0Ramdisk(); verbose("Starting Darwin %s\n",( archCpuType == CPU_TYPE_I386 ) ? "x86" : "x86_64"); // Cleanup the PXE base code. if ( (gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit ) { if ( (ret = nbpUnloadBaseCode()) != nbpStatusSuccess ) { printf("nbpUnloadBaseCode error %d\n", (int) ret); sleep(2); } } bool dummyVal; //Azi: Wait=y is breaking other keys when typed "after them" at boot prompt. // Works properly if typed in first place or used on Boot.plist. if (getBoolForKey(kWaitForKeypressKey, &dummyVal, &bootInfo->bootConfig) && dummyVal) { printf("(Wait) "); // Add to trunk?? don't forget that puse uses printf, not verbose!! pause(); } usb_loop(); //autoresolution - Check if user disabled AutoResolution at the boot prompt. // we can't check the plist here if we have AutoResolution=n there and we anabled it // at boot prompt...????? // getBoolForKey(kAutoResolutionKey, &gAutoResolution, &bootInfo->bootConfig); finishAutoRes(); //Azi: closing Vbios after "if (gVerboseMode)" stuff eliminates the need for setting // AutoResolution = true above; but creates another bug when booting in TextMode with -v arg. // Simptoms include: staring some seconds at a nicely drawn white screen, after boot prompt. // Think i'm just going to end up removing setting gAutoResolution = false // on closeVbios().. the more i think, the less sense it makes doing it there!! //autoresolution - end // Notify modules that the kernel is about to be started // testing... if (gMacOSVersion[3] <= '6') execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgsPreLion, NULL, NULL); else execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgs, NULL, NULL); // If we were in text mode, switch to graphics mode. // This will draw the boot graphics unless we are in // verbose mode. if(gVerboseMode) setVideoMode( GRAPHICS_MODE, 0 ); else drawBootGraphics(); setupBooterLog(); finalizeBootStruct(); //Azi: see asm.s LABEL(_disableIRQs) // outb(0x21, 0xff); // outb(0xa1, 0xff); // Jump to kernel's entry point. There's no going back now. if (gMacOSVersion[3] <= '6') startprog( kernelEntry, bootArgsPreLion ); else startprog( kernelEntry, bootArgs ); // Not reached return 0; }