--- Gnu-Mach/kern/startup.c 2020/09/02 04:42:43 1.1.1.3 +++ Gnu-Mach/kern/startup.c 2020/09/02 04:45:14 1.1.1.4 @@ -27,12 +27,7 @@ * Mach kernel startup. */ - -#include -#include -#include -#include -#include +#include #include #include @@ -40,20 +35,27 @@ #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 @@ -75,6 +77,10 @@ extern void device_service_create(); void cpu_launch_first_thread(); /* forward */ void start_kernel_threads(); /* forward */ +#if ! MACH_KBD +boolean_t reboot_on_panic = 1; +#endif + #if NCPUS > 1 extern void start_other_cpus(); extern void action_thread(); @@ -82,6 +88,7 @@ extern void action_thread(); /* XX */ extern vm_offset_t phys_first_addr, phys_last_addr; +extern char *kernel_cmdline; /* * Running in virtual memory, on the interrupt stack. @@ -93,6 +100,23 @@ void setup_main() { 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 = 0; + } +#endif /* MACH_KDB */ + panic_init(); printf_init(); @@ -117,10 +141,10 @@ void setup_main() 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; @@ -226,21 +250,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 @@ -298,7 +307,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 +318,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*/ }