--- Gnu-Mach/kern/startup.c 2020/09/02 04:41:11 1.1.1.2 +++ Gnu-Mach/kern/startup.c 2020/09/02 04:49:52 1.1.1.6 @@ -27,12 +27,7 @@ * Mach kernel startup. */ - -#include -#include -#include -#include -#include +#include #include #include @@ -40,48 +35,50 @@ #include #include #include +#include +#include +#include +#include #include +#include #include #include #include #include -#include #include -#include +#include +#include +#include +#include #include #include #include #include +#include +#include #include +#include #include +#include #include +#include - - -extern void vm_mem_init(); -extern void vm_mem_bootstrap(); -extern void init_timeout(); -extern void machine_init(); - -extern void idle_thread(); -extern void vm_pageout(); -extern void reaper_thread(); -extern void swapin_thread(); -extern void sched_thread(); - -extern void bootstrap_create(); -extern void device_service_create(); - -void cpu_launch_first_thread(); /* forward */ -void start_kernel_threads(); /* forward */ +#if MACH_KDB +#include +#endif /* MACH_KDB */ + +#if ! MACH_KBD +boolean_t reboot_on_panic = TRUE; +#endif #if NCPUS > 1 -extern void start_other_cpus(); -extern void action_thread(); -#endif NCPUS > 1 +#include +#include +#endif /* NCPUS > 1 */ /* XX */ extern vm_offset_t phys_first_addr, phys_last_addr; +extern char *kernel_cmdline; /* * Running in virtual memory, on the interrupt stack. @@ -89,15 +86,32 @@ extern vm_offset_t phys_first_addr, phys * * Assumes that master_cpu is set. */ -void setup_main() +void setup_main(void) { thread_t startup_thread; +#if MACH_KDB + /* + * Cause a breakpoint trap to the debugger before proceeding + * any further if the proper option flag was specified + * on the kernel's command line. + * XXX check for surrounding spaces. + */ + if (strstr(kernel_cmdline, "-d ")) { + cninit(); /* need console for debugger */ + SoftDebugger("init"); + } +#else /* MACH_KDB */ + if (strstr (kernel_cmdline, "-H ")) { + reboot_on_panic = FALSE; + } +#endif /* MACH_KDB */ + panic_init(); - printf_init(); sched_init(); vm_mem_bootstrap(); + rdxtree_cache_init(); ipc_bootstrap(); vm_mem_init(); ipc_init(); @@ -113,14 +127,14 @@ void setup_main() #if XPR_DEBUG xprbootstrap(); -#endif XPR_DEBUG +#endif /* XPR_DEBUG */ timestamp_init(); - mapable_time_init(); - machine_init(); + mapable_time_init(); + machine_info.max_cpus = NCPUS; machine_info.memory_size = phys_last_addr - phys_first_addr; /* XXX mem_size */ machine_info.avail_cpus = 0; @@ -135,13 +149,13 @@ void setup_main() swapper_init(); #if MACH_HOST pset_sys_init(); -#endif MACH_HOST +#endif /* MACH_HOST */ /* * Kick off the time-out driven routines by calling * them the first time. */ - recompute_priorities(); + recompute_priorities(NULL); compute_mach_factor(); /* @@ -184,9 +198,9 @@ void setup_main() * Now running in a thread. Create the rest of the kernel threads * and the bootstrap task. */ -void start_kernel_threads() +void start_kernel_threads(void) { - register int i; + int i; /* * Create the idle threads and the other @@ -218,7 +232,7 @@ void start_kernel_threads() * Allow other CPUs to run. */ start_other_cpus(); -#endif NCPUS > 1 +#endif /* NCPUS > 1 */ /* * Create the device service. @@ -226,21 +240,6 @@ void start_kernel_threads() device_service_create(); /* - * Initialize NORMA ipc system. - */ -#if NORMA_IPC - norma_ipc_init(); -#endif NORMA_IPC - - /* - * Initialize NORMA vm system. - */ -#if NORMA_VM - norma_vm_init(); -#endif NORMA_VM - - - /* * Initialize kernel task's creation time. * When we created the kernel task in task_init, the mapped * time was not yet available. Now, last thing before starting @@ -256,7 +255,7 @@ void start_kernel_threads() #if XPR_DEBUG xprinit(); /* XXX */ -#endif XPR_DEBUG +#endif /* XPR_DEBUG */ /* * Become the pageout daemon. @@ -267,20 +266,19 @@ void start_kernel_threads() } #if NCPUS > 1 -void slave_main() +void slave_main(void) { cpu_launch_first_thread(THREAD_NULL); } -#endif NCPUS > 1 +#endif /* NCPUS > 1 */ /* * Start up the first thread on a CPU. * First thread is specified for the master CPU. */ -void cpu_launch_first_thread(th) - register thread_t th; +void cpu_launch_first_thread(thread_t th) { - register int mycpu; + int mycpu; mycpu = cpu_number(); @@ -298,7 +296,6 @@ void cpu_launch_first_thread(th) if (th == THREAD_NULL) panic("cpu_launch_first_thread"); - startrtclock(); /* needs an active thread */ PMAP_ACTIVATE_KERNEL(mycpu); active_threads[mycpu] = th; @@ -310,6 +307,8 @@ void cpu_launch_first_thread(th) PMAP_ACTIVATE_USER(vm_map_pmap(th->task->map), th, mycpu); + startrtclock(); /* needs an active thread */ + load_context(th); /*NOTREACHED*/ }