From c5e1672a23634eb59f1f9d87f3fb7b6c9fc77029 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 15 Jan 2011 21:29:37 +0100 Subject: Move -d and -H parse to kern/startup.c The code is arch-independant, and reboot_on_panic, used by kern/debug.c would be undefined on non-i386. * i386/i386at/model_dep.c (reboot_on_panic, c_boot_entry): Move -d and -H parse to... * kern/startup.c (reboot_on_panic,setup_main): ... here. Include --- i386/i386at/model_dep.c | 20 -------------------- kern/startup.c | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c index 953bcdc..cf8466d 100644 --- a/i386/i386at/model_dep.c +++ b/i386/i386at/model_dep.c @@ -134,10 +134,6 @@ void inittodr(); /* forward */ int rebootflag = 0; /* exported to kdintr */ -#if ! MACH_KBD -boolean_t reboot_on_panic = 1; -#endif - /* XX interrupt stack pointer and highwater mark, for locore.S. */ vm_offset_t int_stack_top, int_stack_high; @@ -553,22 +549,6 @@ void c_boot_entry(vm_offset_t bi) { aout_db_sym_init(kern_sym_start, kern_sym_end, "mach", 0); } - - /* - * 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 - if (strstr (kernel_cmdline, "-H ")) - { - reboot_on_panic = 0; - } #endif /* MACH_KDB */ machine_slot[0].is_cpu = TRUE; diff --git a/kern/startup.c b/kern/startup.c index 417fa4a..a4b5a6f 100644 --- a/kern/startup.c +++ b/kern/startup.c @@ -27,6 +27,8 @@ * Mach kernel startup. */ +#include + #include #include #include @@ -76,6 +78,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(); @@ -83,6 +89,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. @@ -94,6 +101,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(); -- cgit v1.2.3