X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fppc%2Fkernel%2Fppc-stub.c;h=5f9ee7bb67ec32b7bca5557bde3dd0119a9b54d2;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=37c9c8b2c57863be6d240cfb9f57b84ac4bf02e0;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/arch/ppc/kernel/ppc-stub.c b/arch/ppc/kernel/ppc-stub.c index 37c9c8b2c..5f9ee7bb6 100644 --- a/arch/ppc/kernel/ppc-stub.c +++ b/arch/ppc/kernel/ppc-stub.c @@ -99,12 +99,13 @@ * ****************************************************************************/ -#include #include #include #include #include #include +#include +#include #include #include @@ -232,7 +233,7 @@ mem2hex(const char *mem, char *buf, int count) } else { /* error condition */ } - debugger_fault_handler = 0; + debugger_fault_handler = NULL; *buf = 0; return buf; } @@ -298,7 +299,7 @@ hex2mem(char *buf, char *mem, int count) } else { /* error condition */ } - debugger_fault_handler = 0; + debugger_fault_handler = NULL; return mem; } @@ -329,7 +330,7 @@ hexToInt(char **ptr, int *intValue) } else { /* error condition */ } - debugger_fault_handler = 0; + debugger_fault_handler = NULL; return (numChars); } @@ -496,7 +497,7 @@ static struct hard_trap_info unsigned int tt; /* Trap type code for powerpc */ unsigned char signo; /* Signal that we map this trap into */ } hard_trap_info[] = { -#if defined(CONFIG_40x) +#if defined(CONFIG_40x) || defined(CONFIG_BOOKE) { 0x100, SIGINT }, /* critical input interrupt */ { 0x200, SIGSEGV }, /* machine check */ { 0x300, SIGSEGV }, /* data storage */ @@ -519,7 +520,7 @@ static struct hard_trap_info ** 0x1100 data TLB miss ** 0x1200 instruction TLB miss */ - { 0x2000, SIGTRAP}, /* debug */ + { 0x2002, SIGTRAP}, /* debug */ #else { 0x200, SIGSEGV }, /* machine check */ { 0x300, SIGSEGV }, /* address error (store) */ @@ -600,11 +601,6 @@ handle_exception (struct pt_regs *regs) sigval = computeSignal(regs->trap); ptr = remcomOutBuffer; -#if defined(CONFIG_40x) - *ptr++ = 'S'; - *ptr++ = hexchars[sigval >> 4]; - *ptr++ = hexchars[sigval & 0xf]; -#else *ptr++ = 'T'; *ptr++ = hexchars[sigval >> 4]; *ptr++ = hexchars[sigval & 0xf]; @@ -618,8 +614,6 @@ handle_exception (struct pt_regs *regs) *ptr++ = ':'; ptr = mem2hex(((char *)regs) + SP_REGNUM*4, ptr, 4); *ptr++ = ';'; -#endif - *ptr++ = 0; putpacket(remcomOutBuffer); @@ -772,10 +766,6 @@ handle_exception (struct pt_regs *regs) * some location may have changed something that is in the instruction cache. */ kgdb_flush_cache_all(); -#if defined(CONFIG_40x) - strcpy(remcomOutBuffer, "OK"); - putpacket(remcomOutBuffer); -#endif mtmsr(msr); kgdb_interruptible(1); @@ -789,10 +779,9 @@ handle_exception (struct pt_regs *regs) case 's': kgdb_flush_cache_all(); -#if defined(CONFIG_40x) +#if defined(CONFIG_40x) || defined(CONFIG_BOOKE) + mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC); regs->msr |= MSR_DE; - regs->dbcr0 |= (DBCR0_IDM | DBCR0_IC); - mtmsr(msr); #else regs->msr |= MSR_SE; #endif @@ -855,3 +844,23 @@ kgdb_output_string (const char* s, unsigned int count) return 1; } #endif + +static void sysrq_handle_gdb(int key, struct pt_regs *pt_regs, + struct tty_struct *tty) +{ + printk("Entering GDB stub\n"); + breakpoint(); +} +static struct sysrq_key_op sysrq_gdb_op = { + .handler = sysrq_handle_gdb, + .help_msg = "Gdb", + .action_msg = "GDB", +}; + +static int gdb_register_sysrq(void) +{ + printk("Registering GDB sysrq handler\n"); + register_sysrq_key('g', &sysrq_gdb_op); + return 0; +} +module_init(gdb_register_sysrq);