diff --git a/src/system/kernel/main.cpp b/src/system/kernel/main.cpp index 8f5e4be852..febf860b16 100644 --- a/src/system/kernel/main.cpp +++ b/src/system/kernel/main.cpp @@ -9,6 +9,9 @@ /*! This is main - initializes the kernel and launches the Bootscript */ +#include + +#include #include #include @@ -23,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -49,8 +51,6 @@ #include #include -#include - #include "vm/VMAnonymousCache.h" @@ -69,18 +69,8 @@ static uint32 sCpuRendezvous2; static int32 main2(void *); -#ifdef __cplusplus -extern "C" { -#endif -extern int _start(kernel_args *bootKernelArgs, int cpu); - /* keep compiler happy */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -int +extern "C" int _start(kernel_args *bootKernelArgs, int currentCPU) { if (bootKernelArgs->kernel_args_size != sizeof(kernel_args) @@ -110,8 +100,6 @@ _start(kernel_args *bootKernelArgs, int currentCPU) // if we're not a boot cpu, spin here until someone wakes us up if (smp_trap_non_boot_cpus(currentCPU)) { - thread_id thread; - // init platform arch_platform_init(&sKernelArgs); @@ -214,7 +202,8 @@ _start(kernel_args *bootKernelArgs, int currentCPU) // start a thread to finish initializing the rest of the system TRACE("starting main2 thread\n"); - thread = spawn_kernel_thread(&main2, "main2", B_NORMAL_PRIORITY, NULL); + thread_id thread = spawn_kernel_thread(&main2, "main2", + B_NORMAL_PRIORITY, NULL); TRACE("resuming main2 thread...\n"); resume_thread(thread); } else { @@ -244,6 +233,7 @@ _start(kernel_args *bootKernelArgs, int currentCPU) return 0; } + static int32 main2(void *unused) {