From 1e74cf4267e4c194bbbc5d3690de29079a3a7e60 Mon Sep 17 00:00:00 2001 From: rafal Date: Mon, 6 Jan 2003 05:56:00 +0000 Subject: [PATCH] Postpone DDB/KGDB init until we know the machine type, so the debugger can be attached to the right place, twiddle the right watchdog registers, etc. --- sys/arch/sgimips/sgimips/machdep.c | 42 ++++++++++++++++-------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/sys/arch/sgimips/sgimips/machdep.c b/sys/arch/sgimips/sgimips/machdep.c index f596101fa040..ac451abcd8d9 100644 --- a/sys/arch/sgimips/sgimips/machdep.c +++ b/sys/arch/sgimips/sgimips/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.45 2003/01/03 09:09:22 rafal Exp $ */ +/* $NetBSD: machdep.c,v 1.46 2003/01/06 05:56:00 rafal Exp $ */ /* * Copyright (c) 2000 Soren S. Jorvang @@ -71,6 +71,7 @@ #include #include +#include #include #include @@ -89,7 +90,6 @@ #include #endif -#include /* For sysctl_hw. */ extern char cpu_model[]; @@ -143,7 +143,7 @@ void sgimips_count_cpus(struct arcbios_component *, struct arcbios_treewalk_context *); #ifdef KGDB -void zs_kgdb_init(void); +void kgdb_port_init(void); void kgdb_connect(int); #endif @@ -300,22 +300,6 @@ mach_init(argc, argv, magic, btinfo) #endif } -#if defined(KGDB) || defined(DDB) - /* Set up DDB hook to turn off watchdog on entry */ - db_trap_callback = ddb_trap_hook; - -#ifdef DDB - ddb_init(nsym, ssym, esym); - if (boothowto & RB_KDB) - Debugger(); -#endif -#ifdef KGDB - zs_kgdb_init(); /* XXX */ - if (boothowto & RB_KDB) - kgdb_connect(0); -#endif -#endif - for (i = 0; arcbios_system_identifier[i] != '\0'; i++) { if (arcbios_system_identifier[i] >= '0' && arcbios_system_identifier[i] <= '9') { @@ -328,6 +312,25 @@ mach_init(argc, argv, magic, btinfo) if (mach_type <= 0) panic("invalid architecture"); +#if defined(KGDB) || defined(DDB) + /* Set up DDB hook to turn off watchdog on entry */ + db_trap_callback = ddb_trap_hook; + +# ifdef DDB + ddb_init(nsym, ssym, esym); + if (boothowto & RB_KDB) + Debugger(); +# endif + + +# ifdef KGDB + kgdb_port_init(); + + if (boothowto & RB_KDB) + kgdb_connect(0); +# endif +#endif + switch (mach_type) { case MACH_SGI_IP20: #ifdef IP20 @@ -347,6 +350,7 @@ mach_init(argc, argv, magic, btinfo) case MACH_SGI_IP32: #ifdef IP32 + boothowto |= AB_DEBUG; /* XXXrkb */ ip32_init(); #else unconfigured_system_type(mach_type);