extern "C" void start(void *openFirmwareEntry) { char bootargs[512]; // stage2 args - might be set via the command line one day stage2_args args; args.heap_size = HEAP_SIZE; args.arguments = NULL; of_init((int (*)(void*))openFirmwareEntry); // check for arguments if (of_getprop(gChosen, "bootargs", bootargs, sizeof(bootargs)) != OF_FAILED) { static const char *sArgs[] = { NULL, NULL }; sArgs[0] = (const char *)bootargs; args.arguments = sArgs; args.arguments_count = 1; } determine_machine(); console_init(); if ((gMachine & MACHINE_QEMU) != 0) dprintf("OpenBIOS (QEMU?) OpenFirmware machine detected\n"); else if ((gMachine & MACHINE_PEGASOS) != 0) dprintf("Pegasos PowerPC machine detected\n"); else dprintf("Apple PowerPC machine assumed\n"); // Initialize and take over MMU and set the OpenFirmware callbacks - it // will ask us for memory after that instead of maintaining it itself // (the kernel will need to adjust the callback later on as well) arch_mmu_init(); if (boot_arch_cpu_init() != B_OK) of_exit(); if (init_real_time_clock() != B_OK) of_exit(); // check for key presses once sBootOptions = 0; int key = console_check_for_key(); if (key == 32) { // space bar: option menu sBootOptions |= BOOT_OPTION_MENU; } else if (key == 27) { // ESC: debug output sBootOptions |= BOOT_OPTION_DEBUG_OUTPUT; } gKernelArgs.platform_args.openfirmware_entry = openFirmwareEntry; main(&args); // if everything goes fine, main() never returns of_exit(); }
void platform_init(void) { uart_init(); platform_init_keyboard(); #ifndef ARCH_X86_64 pci_init(); #endif /* MMU init for x86_64 done after the heap is setup */ #ifdef ARCH_X86_64 arch_mmu_init(); platform_init_mmu_mappings(); #endif }