Commit 8a81d818 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/davem/netfix-2.6

into home.osdl.org:/home/torvalds/v2.5/linux
parents d5acfb1f 49555a7c
...@@ -356,9 +356,16 @@ config MAGIC_SYSRQ ...@@ -356,9 +356,16 @@ config MAGIC_SYSRQ
keys are documented in <file:Documentation/sysrq.txt>. Don't say Y keys are documented in <file:Documentation/sysrq.txt>. Don't say Y
unless you really know what this hack does. unless you really know what this hack does.
config DEBUGGER
bool "Enable debugger hooks"
depends on DEBUG_KERNEL
help
Include in-kernel hooks for kernel debuggers. Unless you are
intending to debug the kernel, say N here.
config XMON config XMON
bool "Include xmon kernel debugger" bool "Include xmon kernel debugger"
depends on DEBUG_KERNEL depends on DEBUGGER
help help
Include in-kernel hooks for the xmon kernel monitor/debugger. Include in-kernel hooks for the xmon kernel monitor/debugger.
Unless you are intending to debug the kernel, say N here. Unless you are intending to debug the kernel, say N here.
......
...@@ -11,9 +11,6 @@ ...@@ -11,9 +11,6 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#define BITS_PER_LONG 32
#include <asm/div64.h>
int (*prom)(void *); int (*prom)(void *);
void *chosen_handle; void *chosen_handle;
...@@ -28,6 +25,9 @@ void chrpboot(int a1, int a2, void *prom); /* in main.c */ ...@@ -28,6 +25,9 @@ void chrpboot(int a1, int a2, void *prom); /* in main.c */
void printk(char *fmt, ...); void printk(char *fmt, ...);
/* there is no convenient header to get this from... -- paulus */
extern unsigned long strlen(const char *);
int int
write(void *handle, void *ptr, int nb) write(void *handle, void *ptr, int nb)
{ {
...@@ -352,7 +352,7 @@ static int skip_atoi(const char **s) ...@@ -352,7 +352,7 @@ static int skip_atoi(const char **s)
#define SPECIAL 32 /* 0x */ #define SPECIAL 32 /* 0x */
#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */ #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
static char * number(char * str, long long num, int base, int size, int precision, int type) static char * number(char * str, long num, int base, int size, int precision, int type)
{ {
char c,sign,tmp[66]; char c,sign,tmp[66];
const char *digits="0123456789abcdefghijklmnopqrstuvwxyz"; const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
...@@ -388,8 +388,10 @@ static char * number(char * str, long long num, int base, int size, int precisio ...@@ -388,8 +388,10 @@ static char * number(char * str, long long num, int base, int size, int precisio
i = 0; i = 0;
if (num == 0) if (num == 0)
tmp[i++]='0'; tmp[i++]='0';
else while (num != 0) else while (num != 0) {
tmp[i++] = digits[do_div(num,base)]; tmp[i++] = digits[num % base];
num /= base;
}
if (i > precision) if (i > precision)
precision = i; precision = i;
size -= precision; size -= precision;
...@@ -424,7 +426,7 @@ int sprintf(char * buf, const char *fmt, ...); ...@@ -424,7 +426,7 @@ int sprintf(char * buf, const char *fmt, ...);
int vsprintf(char *buf, const char *fmt, va_list args) int vsprintf(char *buf, const char *fmt, va_list args)
{ {
int len; int len;
unsigned long long num; unsigned long num;
int i, base; int i, base;
char * str; char * str;
const char *s; const char *s;
...@@ -575,9 +577,7 @@ int vsprintf(char *buf, const char *fmt, va_list args) ...@@ -575,9 +577,7 @@ int vsprintf(char *buf, const char *fmt, va_list args)
--fmt; --fmt;
continue; continue;
} }
if (qualifier == 'L') if (qualifier == 'l') {
num = va_arg(args, long long);
else if (qualifier == 'l') {
num = va_arg(args, unsigned long); num = va_arg(args, unsigned long);
if (flags & SIGN) if (flags & SIGN)
num = (signed long) num; num = (signed long) num;
......
...@@ -102,9 +102,8 @@ extern char *z_errmsg[]; /* indexed by 1-zlib_error */ ...@@ -102,9 +102,8 @@ extern char *z_errmsg[]; /* indexed by 1-zlib_error */
/* functions */ /* functions */
#include <linux/string.h> extern void *memcpy(void *, const void *, unsigned long);
#define zmemcpy memcpy #define zmemcpy memcpy
#define zmemzero(dest, len) memset(dest, 0, len)
/* Diagnostic functions */ /* Diagnostic functions */
#ifdef DEBUG_ZLIB #ifdef DEBUG_ZLIB
......
...@@ -645,9 +645,9 @@ void openpic_request_IPIs(void) ...@@ -645,9 +645,9 @@ void openpic_request_IPIs(void)
request_irq(openpic_vec_ipi+1, openpic_ipi_action, SA_INTERRUPT, request_irq(openpic_vec_ipi+1, openpic_ipi_action, SA_INTERRUPT,
"IPI1 (reschedule)", 0); "IPI1 (reschedule)", 0);
request_irq(openpic_vec_ipi+2, openpic_ipi_action, SA_INTERRUPT, request_irq(openpic_vec_ipi+2, openpic_ipi_action, SA_INTERRUPT,
"IPI2 (invalidate tlb)", 0); "IPI2 (unused)", 0);
request_irq(openpic_vec_ipi+3, openpic_ipi_action, SA_INTERRUPT, request_irq(openpic_vec_ipi+3, openpic_ipi_action, SA_INTERRUPT,
"IPI3 (xmon break)", 0); "IPI3 (debugger break)", 0);
for ( i = 0; i < OPENPIC_NUM_IPI ; i++ ) for ( i = 0; i < OPENPIC_NUM_IPI ; i++ )
openpic_enable_ipi(openpic_vec_ipi+i); openpic_enable_ipi(openpic_vec_ipi+i);
......
...@@ -206,25 +206,6 @@ EXPORT_SYMBOL(timer_interrupt); ...@@ -206,25 +206,6 @@ EXPORT_SYMBOL(timer_interrupt);
EXPORT_SYMBOL(irq_desc); EXPORT_SYMBOL(irq_desc);
EXPORT_SYMBOL(get_wchan); EXPORT_SYMBOL(get_wchan);
EXPORT_SYMBOL(console_drivers); EXPORT_SYMBOL(console_drivers);
#ifdef CONFIG_XMON
EXPORT_SYMBOL(xmon);
#endif
#ifdef CONFIG_DEBUG_KERNEL
extern void (*debugger)(struct pt_regs *regs);
extern int (*debugger_bpt)(struct pt_regs *regs);
extern int (*debugger_sstep)(struct pt_regs *regs);
extern int (*debugger_iabr_match)(struct pt_regs *regs);
extern int (*debugger_dabr_match)(struct pt_regs *regs);
extern void (*debugger_fault_handler)(struct pt_regs *regs);
EXPORT_SYMBOL(debugger);
EXPORT_SYMBOL(debugger_bpt);
EXPORT_SYMBOL(debugger_sstep);
EXPORT_SYMBOL(debugger_iabr_match);
EXPORT_SYMBOL(debugger_dabr_match);
EXPORT_SYMBOL(debugger_fault_handler);
#endif
EXPORT_SYMBOL(tb_ticks_per_usec); EXPORT_SYMBOL(tb_ticks_per_usec);
EXPORT_SYMBOL(paca); EXPORT_SYMBOL(paca);
......
...@@ -194,8 +194,8 @@ void show_regs(struct pt_regs * regs) ...@@ -194,8 +194,8 @@ void show_regs(struct pt_regs * regs)
regs->msr&MSR_DR ? 1 : 0); regs->msr&MSR_DR ? 1 : 0);
if (regs->trap == 0x300 || regs->trap == 0x380 || regs->trap == 0x600) if (regs->trap == 0x300 || regs->trap == 0x380 || regs->trap == 0x600)
printk("DAR: %016lx, DSISR: %016lx\n", regs->dar, regs->dsisr); printk("DAR: %016lx, DSISR: %016lx\n", regs->dar, regs->dsisr);
printk("TASK = %p[%d] '%s' ", printk("TASK: %p[%d] '%s' THREAD: %p",
current, current->pid, current->comm); current, current->pid, current->comm, current->thread_info);
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
printk(" CPU: %d", smp_processor_id()); printk(" CPU: %d", smp_processor_id());
...@@ -217,6 +217,8 @@ void show_regs(struct pt_regs * regs) ...@@ -217,6 +217,8 @@ void show_regs(struct pt_regs * regs)
*/ */
printk("NIP [%016lx] ", regs->nip); printk("NIP [%016lx] ", regs->nip);
print_symbol("%s\n", regs->nip); print_symbol("%s\n", regs->nip);
printk("LR [%016lx] ", regs->link);
print_symbol("%s\n", regs->link);
show_stack(current, (unsigned long *)regs->gpr[1]); show_stack(current, (unsigned long *)regs->gpr[1]);
} }
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/btext.h> #include <asm/btext.h>
#include <asm/nvram.h> #include <asm/nvram.h>
#include <asm/system.h>
extern unsigned long klimit; extern unsigned long klimit;
/* extern void *stab; */ /* extern void *stab; */
...@@ -79,10 +80,6 @@ unsigned long decr_overclock_proc0_set = 0; ...@@ -79,10 +80,6 @@ unsigned long decr_overclock_proc0_set = 0;
int powersave_nap; int powersave_nap;
#ifdef CONFIG_XMON
extern void xmon_map_scc(void);
#endif
char saved_command_line[256]; char saved_command_line[256];
unsigned char aux_device_present; unsigned char aux_device_present;
...@@ -159,15 +156,11 @@ void setup_system(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -159,15 +156,11 @@ void setup_system(unsigned long r3, unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7) unsigned long r6, unsigned long r7)
{ {
#ifdef CONFIG_PPC_PSERIES #ifdef CONFIG_PPC_PSERIES
unsigned int ret, i; unsigned int ret, i;
#endif #endif
#ifdef CONFIG_XMON_DEFAULT #ifdef CONFIG_XMON_DEFAULT
debugger = xmon; xmon_init();
debugger_bpt = xmon_bpt;
debugger_sstep = xmon_sstep;
debugger_iabr_match = xmon_iabr_match;
debugger_dabr_match = xmon_dabr_match;
#endif #endif
#ifdef CONFIG_PPC_ISERIES #ifdef CONFIG_PPC_ISERIES
...@@ -601,13 +594,15 @@ void __init setup_arch(char **cmdline_p) ...@@ -601,13 +594,15 @@ void __init setup_arch(char **cmdline_p)
calibrate_delay = ppc64_calibrate_delay; calibrate_delay = ppc64_calibrate_delay;
ppc64_boot_msg(0x12, "Setup Arch"); ppc64_boot_msg(0x12, "Setup Arch");
#ifdef CONFIG_XMON #ifdef CONFIG_XMON
xmon_map_scc(); if (strstr(cmd_line, "xmon")) {
if (strstr(cmd_line, "xmon")) /* ensure xmon is enabled */
xmon(0); xmon_init();
debugger(0);
}
#endif /* CONFIG_XMON */ #endif /* CONFIG_XMON */
/* /*
* Set cache line size based on type of cpu as a default. * Set cache line size based on type of cpu as a default.
* Systems with OF can look in the properties on the cpu node(s) * Systems with OF can look in the properties on the cpu node(s)
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/xics.h> #include <asm/xics.h>
#include <asm/cputable.h> #include <asm/cputable.h>
#include <asm/system.h>
int smp_threads_ready; int smp_threads_ready;
unsigned long cache_decay_ticks; unsigned long cache_decay_ticks;
...@@ -394,7 +395,7 @@ void smp_local_timer_interrupt(struct pt_regs * regs) ...@@ -394,7 +395,7 @@ void smp_local_timer_interrupt(struct pt_regs * regs)
void smp_message_recv(int msg, struct pt_regs *regs) void smp_message_recv(int msg, struct pt_regs *regs)
{ {
switch( msg ) { switch(msg) {
case PPC_MSG_CALL_FUNCTION: case PPC_MSG_CALL_FUNCTION:
smp_call_function_interrupt(); smp_call_function_interrupt();
break; break;
...@@ -407,11 +408,11 @@ void smp_message_recv(int msg, struct pt_regs *regs) ...@@ -407,11 +408,11 @@ void smp_message_recv(int msg, struct pt_regs *regs)
/* spare */ /* spare */
break; break;
#endif #endif
#ifdef CONFIG_XMON #ifdef CONFIG_DEBUGGER
case PPC_MSG_XMON_BREAK: case PPC_MSG_DEBUGGER_BREAK:
xmon(regs); debugger(regs);
break; break;
#endif /* CONFIG_XMON */ #endif
default: default:
printk("SMP %d: smp_message_recv(): unknown msg %d\n", printk("SMP %d: smp_message_recv(): unknown msg %d\n",
smp_processor_id(), msg); smp_processor_id(), msg);
...@@ -424,12 +425,12 @@ void smp_send_reschedule(int cpu) ...@@ -424,12 +425,12 @@ void smp_send_reschedule(int cpu)
smp_message_pass(cpu, PPC_MSG_RESCHEDULE, 0, 0); smp_message_pass(cpu, PPC_MSG_RESCHEDULE, 0, 0);
} }
#ifdef CONFIG_XMON #ifdef CONFIG_DEBUGGER
void smp_send_xmon_break(int cpu) void smp_send_debugger_break(int cpu)
{ {
smp_message_pass(cpu, PPC_MSG_XMON_BREAK, 0, 0); smp_message_pass(cpu, PPC_MSG_DEBUGGER_BREAK, 0, 0);
} }
#endif /* CONFIG_XMON */ #endif
static void stop_this_cpu(void *dummy) static void stop_this_cpu(void *dummy)
{ {
...@@ -507,10 +508,7 @@ int smp_call_function (void (*func) (void *info), void *info, int nonatomic, ...@@ -507,10 +508,7 @@ int smp_call_function (void (*func) (void *info), void *info, int nonatomic,
printk("smp_call_function on cpu %d: other cpus not " printk("smp_call_function on cpu %d: other cpus not "
"responding (%d)\n", smp_processor_id(), "responding (%d)\n", smp_processor_id(),
atomic_read(&data.started)); atomic_read(&data.started));
#ifdef CONFIG_DEBUG_KERNEL debugger(0);
if (debugger)
debugger(0);
#endif
goto out; goto out;
} }
} }
...@@ -525,10 +523,7 @@ int smp_call_function (void (*func) (void *info), void *info, int nonatomic, ...@@ -525,10 +523,7 @@ int smp_call_function (void (*func) (void *info), void *info, int nonatomic,
smp_processor_id(), smp_processor_id(),
atomic_read(&data.finished), atomic_read(&data.finished),
atomic_read(&data.started)); atomic_read(&data.started));
#ifdef CONFIG_DEBUG_KERNEL debugger(0);
if (debugger)
debugger(0);
#endif
goto out; goto out;
} }
} }
......
...@@ -45,13 +45,20 @@ extern void bad_page_fault(struct pt_regs *, unsigned long, int); ...@@ -45,13 +45,20 @@ extern void bad_page_fault(struct pt_regs *, unsigned long, int);
extern int fwnmi_active; extern int fwnmi_active;
#endif #endif
#ifdef CONFIG_DEBUG_KERNEL #ifdef CONFIG_DEBUGGER
void (*debugger)(struct pt_regs *regs); int (*__debugger)(struct pt_regs *regs);
int (*debugger_bpt)(struct pt_regs *regs); int (*__debugger_bpt)(struct pt_regs *regs);
int (*debugger_sstep)(struct pt_regs *regs); int (*__debugger_sstep)(struct pt_regs *regs);
int (*debugger_iabr_match)(struct pt_regs *regs); int (*__debugger_iabr_match)(struct pt_regs *regs);
int (*debugger_dabr_match)(struct pt_regs *regs); int (*__debugger_dabr_match)(struct pt_regs *regs);
void (*debugger_fault_handler)(struct pt_regs *regs); int (*__debugger_fault_handler)(struct pt_regs *regs);
EXPORT_SYMBOL(__debugger);
EXPORT_SYMBOL(__debugger_bpt);
EXPORT_SYMBOL(__debugger_sstep);
EXPORT_SYMBOL(__debugger_iabr_match);
EXPORT_SYMBOL(__debugger_dabr_match);
EXPORT_SYMBOL(__debugger_fault_handler);
#endif #endif
/* /*
...@@ -88,10 +95,8 @@ static void ...@@ -88,10 +95,8 @@ static void
_exception(int signr, siginfo_t *info, struct pt_regs *regs) _exception(int signr, siginfo_t *info, struct pt_regs *regs)
{ {
if (!user_mode(regs)) { if (!user_mode(regs)) {
#ifdef CONFIG_DEBUG_KERNEL if (debugger(regs))
if (debugger) return;
debugger(regs);
#endif
die("Exception in kernel mode\n", regs, signr); die("Exception in kernel mode\n", regs, signr);
} }
...@@ -146,12 +151,8 @@ SystemResetException(struct pt_regs *regs) ...@@ -146,12 +151,8 @@ SystemResetException(struct pt_regs *regs)
} }
#endif #endif
#ifdef CONFIG_DEBUG_KERNEL if (!debugger(regs))
if (debugger) die("System Reset", regs, 0);
debugger(regs);
else
#endif
panic("System Reset");
/* Must die if the interrupt is not recoverable */ /* Must die if the interrupt is not recoverable */
if (!(regs->msr & MSR_RI)) if (!(regs->msr & MSR_RI))
...@@ -228,23 +229,12 @@ MachineCheckException(struct pt_regs *regs) ...@@ -228,23 +229,12 @@ MachineCheckException(struct pt_regs *regs)
} }
#endif #endif
#ifdef CONFIG_DEBUG_KERNEL if (debugger_fault_handler(regs))
if (debugger_fault_handler) {
debugger_fault_handler(regs);
return; return;
} if (debugger(regs))
if (debugger) return;
debugger(regs);
#endif die("Machine check in kernel mode", regs, 0);
console_verbose();
spin_lock_irq(&die_lock);
bust_spinlocks(1);
printk("Machine check in kernel mode.\n");
printk("Caused by (from SRR1=%lx): ", regs->msr);
show_regs(regs);
bust_spinlocks(0);
spin_unlock_irq(&die_lock);
panic("Unrecoverable Machine Check");
} }
void void
...@@ -267,10 +257,8 @@ InstructionBreakpointException(struct pt_regs *regs) ...@@ -267,10 +257,8 @@ InstructionBreakpointException(struct pt_regs *regs)
{ {
siginfo_t info; siginfo_t info;
#ifdef CONFIG_DEBUG_KERNEL if (debugger_iabr_match(regs))
if (debugger_iabr_match && debugger_iabr_match(regs))
return; return;
#endif
info.si_signo = SIGTRAP; info.si_signo = SIGTRAP;
info.si_errno = 0; info.si_errno = 0;
info.si_code = TRAP_BRKPT; info.si_code = TRAP_BRKPT;
...@@ -372,6 +360,9 @@ ProgramCheckException(struct pt_regs *regs) ...@@ -372,6 +360,9 @@ ProgramCheckException(struct pt_regs *regs)
{ {
siginfo_t info; siginfo_t info;
if (debugger_fault_handler(regs))
return;
if (regs->msr & 0x100000) { if (regs->msr & 0x100000) {
/* IEEE FP exception */ /* IEEE FP exception */
...@@ -387,10 +378,9 @@ ProgramCheckException(struct pt_regs *regs) ...@@ -387,10 +378,9 @@ ProgramCheckException(struct pt_regs *regs)
} else if (regs->msr & 0x20000) { } else if (regs->msr & 0x20000) {
/* trap exception */ /* trap exception */
#ifdef CONFIG_DEBUG_KERNEL if (debugger_bpt(regs))
if (debugger_bpt && debugger_bpt(regs))
return; return;
#endif
if (check_bug_trap(regs)) { if (check_bug_trap(regs)) {
regs->nip += 4; regs->nip += 4;
return; return;
...@@ -414,17 +404,13 @@ ProgramCheckException(struct pt_regs *regs) ...@@ -414,17 +404,13 @@ ProgramCheckException(struct pt_regs *regs)
void void
KernelFPUnavailableException(struct pt_regs *regs) KernelFPUnavailableException(struct pt_regs *regs)
{ {
printk("Illegal floating point used in kernel (task=0x%p, " die("Unrecoverable FP Unavailable Exception in Kernel", regs, 0);
"pc=0x%016lx, trap=0x%lx)\n", current, regs->nip, regs->trap);
panic("Unrecoverable FP Unavailable Exception in Kernel");
} }
void void
KernelAltivecUnavailableException(struct pt_regs *regs) KernelAltivecUnavailableException(struct pt_regs *regs)
{ {
printk("Illegal VMX/Altivec used in kernel (task=0x%p, " die("Unrecoverable VMX/Altivec Unavailable Exception in Kernel", regs, 0);
"pc=0x%016lx, trap=0x%lx)\n", current, regs->nip, regs->trap);
panic("Unrecoverable VMX/Altivec Unavailable Exception in Kernel");
} }
void void
...@@ -434,10 +420,9 @@ SingleStepException(struct pt_regs *regs) ...@@ -434,10 +420,9 @@ SingleStepException(struct pt_regs *regs)
regs->msr &= ~MSR_SE; /* Turn off 'trace' bit */ regs->msr &= ~MSR_SE; /* Turn off 'trace' bit */
#ifdef CONFIG_DEBUG_KERNEL if (debugger_sstep(regs))
if (debugger_sstep && debugger_sstep(regs))
return; return;
#endif
info.si_signo = SIGTRAP; info.si_signo = SIGTRAP;
info.si_errno = 0; info.si_errno = 0;
info.si_code = TRAP_TRACE; info.si_code = TRAP_TRACE;
......
...@@ -353,11 +353,11 @@ irqreturn_t xics_ipi_action(int irq, void *dev_id, struct pt_regs *regs) ...@@ -353,11 +353,11 @@ irqreturn_t xics_ipi_action(int irq, void *dev_id, struct pt_regs *regs)
smp_message_recv(PPC_MSG_MIGRATE_TASK, regs); smp_message_recv(PPC_MSG_MIGRATE_TASK, regs);
} }
#endif #endif
#ifdef CONFIG_XMON #ifdef CONFIG_DEBUGGER
if (test_and_clear_bit(PPC_MSG_XMON_BREAK, if (test_and_clear_bit(PPC_MSG_DEBUGGER_BREAK,
&xics_ipi_message[cpu].value)) { &xics_ipi_message[cpu].value)) {
mb(); mb();
smp_message_recv(PPC_MSG_XMON_BREAK, regs); smp_message_recv(PPC_MSG_DEBUGGER_BREAK, regs);
} }
#endif #endif
} }
......
...@@ -37,12 +37,6 @@ ...@@ -37,12 +37,6 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/ppcdebug.h>
#ifdef CONFIG_DEBUG_KERNEL
int debugger_kernel_faults = 1;
#endif
void bad_page_fault(struct pt_regs *, unsigned long, int); void bad_page_fault(struct pt_regs *, unsigned long, int);
/* /*
...@@ -60,13 +54,10 @@ void do_page_fault(struct pt_regs *regs, unsigned long address, ...@@ -60,13 +54,10 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
unsigned long code = SEGV_MAPERR; unsigned long code = SEGV_MAPERR;
unsigned long is_write = error_code & 0x02000000; unsigned long is_write = error_code & 0x02000000;
#ifdef CONFIG_DEBUG_KERNEL if (regs->trap == 0x300 || regs->trap == 0x380) {
if (debugger_fault_handler && (regs->trap == 0x300 || if (debugger_fault_handler(regs))
regs->trap == 0x380)) { return;
debugger_fault_handler(regs);
return;
} }
#endif
/* On a kernel SLB miss we can only check for a valid exception entry */ /* On a kernel SLB miss we can only check for a valid exception entry */
if (!user_mode(regs) && (regs->trap == 0x380)) { if (!user_mode(regs) && (regs->trap == 0x380)) {
...@@ -74,13 +65,10 @@ void do_page_fault(struct pt_regs *regs, unsigned long address, ...@@ -74,13 +65,10 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
return; return;
} }
#ifdef CONFIG_DEBUG_KERNEL
if (error_code & 0x00400000) { if (error_code & 0x00400000) {
/* DABR match */
if (debugger_dabr_match(regs)) if (debugger_dabr_match(regs))
return; return;
} }
#endif
if (in_atomic() || mm == NULL) { if (in_atomic() || mm == NULL) {
bad_page_fault(regs, address, SIGSEGV); bad_page_fault(regs, address, SIGSEGV);
...@@ -149,11 +137,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long address, ...@@ -149,11 +137,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
info.si_errno = 0; info.si_errno = 0;
info.si_code = code; info.si_code = code;
info.si_addr = (void *) address; info.si_addr = (void *) address;
#ifdef CONFIG_XMON
ifppcdebug(PPCDBG_SIGNALXMON)
PPCDBG_ENTER_DEBUGGER_REGS(regs);
#endif
force_sig_info(SIGSEGV, &info, current); force_sig_info(SIGSEGV, &info, current);
return; return;
} }
...@@ -207,9 +190,7 @@ bad_page_fault(struct pt_regs *regs, unsigned long address, int sig) ...@@ -207,9 +190,7 @@ bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
} }
/* kernel has accessed a bad area */ /* kernel has accessed a bad area */
#ifdef CONFIG_DEBUG_KERNEL if (debugger(regs))
if (debugger_kernel_faults && debugger) return;
debugger(regs);
#endif
die("Kernel access of bad area", regs, sig); die("Kernel access of bad area", regs, sig);
} }
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
#include <asm/cputable.h> #include <asm/cputable.h>
#include <asm/ppcdebug.h> #include <asm/ppcdebug.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/system.h>
#ifdef CONFIG_PPC_ISERIES #ifdef CONFIG_PPC_ISERIES
#include <asm/iSeries/iSeries_dma.h> #include <asm/iSeries/iSeries_dma.h>
...@@ -691,11 +692,7 @@ void __init do_init_bootmem(void) ...@@ -691,11 +692,7 @@ void __init do_init_bootmem(void)
bootmap_pages = bootmem_bootmap_pages(total_pages); bootmap_pages = bootmem_bootmap_pages(total_pages);
start = (unsigned long)__a2p(lmb_alloc(bootmap_pages<<PAGE_SHIFT, PAGE_SIZE)); start = (unsigned long)__a2p(lmb_alloc(bootmap_pages<<PAGE_SHIFT, PAGE_SIZE));
if (start == 0) { BUG_ON(!start);
udbg_printf("do_init_bootmem: failed to allocate a bitmap.\n");
udbg_printf("\tbootmap_pages = 0x%lx.\n", bootmap_pages);
PPCDBG_ENTER_DEBUGGER();
}
boot_mapsize = init_bootmem(start >> PAGE_SHIFT, total_pages); boot_mapsize = init_bootmem(start >> PAGE_SHIFT, total_pages);
......
...@@ -43,39 +43,12 @@ GSETSPR(274, sprg2) ...@@ -43,39 +43,12 @@ GSETSPR(274, sprg2)
GSETSPR(275, sprg3) GSETSPR(275, sprg3)
GSETSPR(282, ear) GSETSPR(282, ear)
GSETSPR(287, pvr) GSETSPR(287, pvr)
GSETSPR(528, bat0u)
GSETSPR(529, bat0l)
GSETSPR(530, bat1u)
GSETSPR(531, bat1l)
GSETSPR(532, bat2u)
GSETSPR(533, bat2l)
GSETSPR(534, bat3u)
GSETSPR(535, bat3l)
GSETSPR(1008, hid0) GSETSPR(1008, hid0)
GSETSPR(1009, hid1) GSETSPR(1009, hid1)
GSETSPR(1010, iabr) GSETSPR(1010, iabr)
GSETSPR(1013, dabr) GSETSPR(1013, dabr)
GSETSPR(1023, pir) GSETSPR(1023, pir)
static inline int get_sr(int n)
{
int ret;
#if 0
// DRENG does not assemble
asm (" mfsrin %0,%1" : "=r" (ret) : "r" (n << 28));
#endif
return ret;
}
static inline void set_sr(int n, int val)
{
#if 0
// DRENG does not assemble
asm ("mtsrin %0,%1" : : "r" (val), "r" (n << 28));
#endif
}
static inline void store_inst(void *p) static inline void store_inst(void *p)
{ {
asm volatile ("dcbst 0,%0; sync; icbi 0,%0; isync" : : "r" (p)); asm volatile ("dcbst 0,%0; sync; icbi 0,%0; isync" : : "r" (p));
...@@ -90,4 +63,3 @@ static inline void cinval(void *p) ...@@ -90,4 +63,3 @@ static inline void cinval(void *p)
{ {
asm volatile ("dcbi 0,%0; icbi 0,%0" : : "r" (p)); asm volatile ("dcbi 0,%0; icbi 0,%0" : : "r" (p));
} }
...@@ -11,31 +11,23 @@ ...@@ -11,31 +11,23 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/sysrq.h> #include <linux/sysrq.h>
#include <linux/init.h>
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/udbg.h> #include <asm/udbg.h>
#include <asm/system.h>
extern void xmon_printf(const char *fmt, ...);
#define TB_SPEED 25000000
static inline unsigned int readtb(void)
{
unsigned int ret;
asm volatile("mftb %0" : "=r" (ret) :);
return ret;
}
#ifdef CONFIG_MAGIC_SYSRQ #ifdef CONFIG_MAGIC_SYSRQ
static void sysrq_handle_xmon(int key, struct pt_regs *pt_regs, static void sysrq_handle_xmon(int key, struct pt_regs *pt_regs,
struct tty_struct *tty) struct tty_struct *tty)
{ {
xmon(pt_regs); /* ensure xmon is enabled */
xmon_init();
debugger(pt_regs);
} }
static struct sysrq_key_op sysrq_xmon_op = static struct sysrq_key_op sysrq_xmon_op =
...@@ -45,16 +37,13 @@ static struct sysrq_key_op sysrq_xmon_op = ...@@ -45,16 +37,13 @@ static struct sysrq_key_op sysrq_xmon_op =
.action_msg = "Entering xmon\n", .action_msg = "Entering xmon\n",
}; };
#endif /* CONFIG_MAGIC_SYSRQ */ static int __init setup_xmon_sysrq(void)
void
xmon_map_scc(void)
{ {
#ifdef CONFIG_MAGIC_SYSRQ
/* This maybe isn't the best place to register sysrq 'x' */
__sysrq_put_key_op('x', &sysrq_xmon_op); __sysrq_put_key_op('x', &sysrq_xmon_op);
#endif /* CONFIG_MAGIC_SYSRQ */ return 0;
} }
__initcall(setup_xmon_sysrq);
#endif /* CONFIG_MAGIC_SYSRQ */
int int
xmon_write(void *handle, void *ptr, int nb) xmon_write(void *handle, void *ptr, int nb)
...@@ -62,8 +51,6 @@ xmon_write(void *handle, void *ptr, int nb) ...@@ -62,8 +51,6 @@ xmon_write(void *handle, void *ptr, int nb)
return udbg_write(ptr, nb); return udbg_write(ptr, nb);
} }
int xmon_wants_key;
int int
xmon_read(void *handle, void *ptr, int nb) xmon_read(void *handle, void *ptr, int nb)
{ {
...@@ -80,11 +67,6 @@ void *xmon_stdin; ...@@ -80,11 +67,6 @@ void *xmon_stdin;
void *xmon_stdout; void *xmon_stdout;
void *xmon_stderr; void *xmon_stderr;
void
xmon_init(void)
{
}
int int
xmon_putc(int c, void *f) xmon_putc(int c, void *f)
{ {
......
This diff is collapsed.
...@@ -95,11 +95,6 @@ extern char *trace_names[64]; ...@@ -95,11 +95,6 @@ extern char *trace_names[64];
#define ppcdebugset(FLAGS) (udbg_ifdebug(FLAGS)) #define ppcdebugset(FLAGS) (udbg_ifdebug(FLAGS))
#define PPCDBG_BINFMT (test_thread_flag(TIF_32BIT) ? PPCDBG_BINFMT32 : PPCDBG_BINFMT64) #define PPCDBG_BINFMT (test_thread_flag(TIF_32BIT) ? PPCDBG_BINFMT32 : PPCDBG_BINFMT64)
#ifdef CONFIG_XMON
#define PPCDBG_ENTER_DEBUGGER() xmon(0)
#define PPCDBG_ENTER_DEBUGGER_REGS(X) xmon(X)
#endif
#else #else
#define PPCDBG(...) do {;} while (0) #define PPCDBG(...) do {;} while (0)
#define PPCDBGCALL(FLAGS,FUNCTION) do {;} while (0) #define PPCDBGCALL(FLAGS,FUNCTION) do {;} while (0)
...@@ -107,12 +102,4 @@ extern char *trace_names[64]; ...@@ -107,12 +102,4 @@ extern char *trace_names[64];
#define ppcdebugset(FLAGS) (0) #define ppcdebugset(FLAGS) (0)
#endif /* CONFIG_PPCDBG */ #endif /* CONFIG_PPCDBG */
#ifndef PPCDBG_ENTER_DEBUGGER
#define PPCDBG_ENTER_DEBUGGER() do {;} while(0)
#endif
#ifndef PPCDBG_ENTER_DEBUGGER_REGS
#define PPCDBG_ENTER_DEBUGGER_REGS(A) do {;} while(0)
#endif
#endif /*__PPCDEBUG_H */ #endif /*__PPCDEBUG_H */
...@@ -29,8 +29,7 @@ ...@@ -29,8 +29,7 @@
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
extern void smp_message_pass(int target, int msg, unsigned long data, int wait); extern void smp_message_pass(int target, int msg, unsigned long data, int wait);
extern void smp_send_tlb_invalidate(int); extern void smp_send_debugger_break(int cpu);
extern void smp_send_xmon_break(int cpu);
struct pt_regs; struct pt_regs;
extern void smp_message_recv(int, struct pt_regs *); extern void smp_message_recv(int, struct pt_regs *);
...@@ -63,17 +62,22 @@ extern cpumask_t cpu_available_map; ...@@ -63,17 +62,22 @@ extern cpumask_t cpu_available_map;
* in /proc/interrupts will be wrong!!! --Troy */ * in /proc/interrupts will be wrong!!! --Troy */
#define PPC_MSG_CALL_FUNCTION 0 #define PPC_MSG_CALL_FUNCTION 0
#define PPC_MSG_RESCHEDULE 1 #define PPC_MSG_RESCHEDULE 1
/* This is unused now */
#if 0
#define PPC_MSG_MIGRATE_TASK 2 #define PPC_MSG_MIGRATE_TASK 2
#define PPC_MSG_XMON_BREAK 3 #endif
#define PPC_MSG_DEBUGGER_BREAK 3
void smp_init_iSeries(void); void smp_init_iSeries(void);
void smp_init_pSeries(void); void smp_init_pSeries(void);
#endif /* !(CONFIG_SMP) */ #endif /* !(CONFIG_SMP) */
#endif /* __ASSEMBLY__ */
#define get_hard_smp_processor_id(CPU) (paca[(CPU)].xHwProcNum) #define get_hard_smp_processor_id(CPU) (paca[(CPU)].xHwProcNum)
#define set_hard_smp_processor_id(CPU, VAL) do { (paca[(CPU)].xHwProcNum = VAL); } while (0) #define set_hard_smp_processor_id(CPU, VAL) \
do { (paca[(CPU)].xHwProcNum = VAL); } while (0)
#endif /* __ASSEMBLY__ */
#endif /* !(_PPC64_SMP_H) */ #endif /* !(_PPC64_SMP_H) */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/compiler.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/hw_irq.h> #include <asm/hw_irq.h>
...@@ -52,31 +53,41 @@ ...@@ -52,31 +53,41 @@
#define smp_read_barrier_depends() do { } while(0) #define smp_read_barrier_depends() do { } while(0)
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
#ifdef CONFIG_DEBUG_KERNEL #ifdef CONFIG_DEBUGGER
extern void (*debugger)(struct pt_regs *regs);
extern int (*debugger_bpt)(struct pt_regs *regs); extern int (*__debugger)(struct pt_regs *regs);
extern int (*debugger_sstep)(struct pt_regs *regs); extern int (*__debugger_bpt)(struct pt_regs *regs);
extern int (*debugger_iabr_match)(struct pt_regs *regs); extern int (*__debugger_sstep)(struct pt_regs *regs);
extern int (*debugger_dabr_match)(struct pt_regs *regs); extern int (*__debugger_iabr_match)(struct pt_regs *regs);
extern void (*debugger_fault_handler)(struct pt_regs *regs); extern int (*__debugger_dabr_match)(struct pt_regs *regs);
extern int (*__debugger_fault_handler)(struct pt_regs *regs);
#define DEBUGGER_BOILERPLATE(__NAME) \
static inline int __NAME(struct pt_regs *regs) \
{ \
if (unlikely(__ ## __NAME)) \
return __ ## __NAME(regs); \
return 0; \
}
DEBUGGER_BOILERPLATE(debugger)
DEBUGGER_BOILERPLATE(debugger_bpt)
DEBUGGER_BOILERPLATE(debugger_sstep)
DEBUGGER_BOILERPLATE(debugger_iabr_match)
DEBUGGER_BOILERPLATE(debugger_dabr_match)
DEBUGGER_BOILERPLATE(debugger_fault_handler)
#ifdef CONFIG_XMON
extern void xmon_init(void);
#endif
#else #else
#define debugger(regs) do { } while (0) #define debugger(regs) 0
#define debugger_bpt(regs) 0 #define debugger_bpt(regs) 0
#define debugger_sstep(regs) 0 #define debugger_sstep(regs) 0
#define debugger_iabr_match(regs) 0 #define debugger_iabr_match(regs) 0
#define debugger_dabr_match(regs) 0 #define debugger_dabr_match(regs) 0
#define debugger_fault_handler ((void (*)(struct pt_regs *))0) #define debugger_fault_handler(regs) 0
#endif
#ifdef CONFIG_XMON
extern void xmon_irq(int, void *, struct pt_regs *);
extern void xmon(struct pt_regs *regs);
extern int xmon_bpt(struct pt_regs *regs);
extern int xmon_sstep(struct pt_regs *regs);
extern int xmon_iabr_match(struct pt_regs *regs);
extern int xmon_dabr_match(struct pt_regs *regs);
extern void (*xmon_fault_handler)(struct pt_regs *regs);
#endif #endif
extern void show_regs(struct pt_regs * regs); extern void show_regs(struct pt_regs * regs);
......
#ifndef __PPC_XMON_H
#define __PPC_XMON_H
#ifdef __KERNEL__
struct pt_regs;
extern void xmon(struct pt_regs *excp);
extern void xmon_printf(const char *fmt, ...);
extern void xmon_map_scc(void);
extern int xmon_bpt(struct pt_regs *regs);
extern int xmon_sstep(struct pt_regs *regs);
extern int xmon_iabr_match(struct pt_regs *regs);
extern int xmon_dabr_match(struct pt_regs *regs);
extern void (*xmon_fault_handler)(struct pt_regs *regs);
#endif
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment