summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/shared/vectors/vectors_init.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2002-05-14 17:10:17 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2002-05-14 17:10:17 +0000
commit69ed59f083a083fd96d08b5f6d54f2c80f267f03 (patch)
tree3d8fcd08bcface88cea636117b47dd1520b2874c /c/src/lib/libbsp/powerpc/shared/vectors/vectors_init.c
parent2001-05-14 Till Straumann <strauman@slac.stanford.edu> (diff)
downloadrtems-69ed59f083a083fd96d08b5f6d54f2c80f267f03.tar.bz2
2001-05-14 Till Straumann <strauman@slac.stanford.edu>
* bootloader/misc.c, console/Makefile.am, console/console.c, console/consoleIo.h, console/inch.c, console/polled_io.c, console/uart.c, console/uart.h, include/bsp.h, irq/Makefile.am, irq/irq.c, irq/irq.h, irq/irq_init.c, openpic/openpic.c, openpic/openpic.h, pci/Makefile.am, pci/pci.c, pci/pci.h, residual/Makefile.am, start/start.S, startup/bspstart.c, vectors/vectors.S, vectors/vectors.h, vectors/vectors_init.c: Per PR216, "libbsp/powerpc/shared" BSP has been modified considerably with the goal to make it more flexible and reusable by other BSPs. The main strategies were: - eliminate hardcoded base addresses; devices use offsets and a BSP defined base address. - separate functionality into different files (e.g. reboot from inch.c to reboot.c) which can be overridden by a 'derived' BSP. - separate initialization code into separate files (e.g. PCI bridge detection/initialization was separated from the more generic PCI access routines), also to make it easier for 'derived' BSPs to substitute their own initialization code. There are also a couple of enhancements and fixes: - IRQ handling code now has a hook for attaching a VME bridge. - OpenPIC is now explicitely initialized (polarities, senses). Eliminated the implicit assumption on the presence of an ISA PIC. - UART and console driver now supports more than 1 port. The current maximum of 2 can easily be extended by enlarging a table (it would even be easier if the ISR API was not broken by design). - fixed polled_io.c so it correctly supports console on COM2 - fixed TLB invalidation code (start.S). - exception handler prints a stack backtrace. - added BSP_pciFindDevice() to scan the pci bus for a particular vendor/device/instance.
Diffstat (limited to 'c/src/lib/libbsp/powerpc/shared/vectors/vectors_init.c')
-rw-r--r--c/src/lib/libbsp/powerpc/shared/vectors/vectors_init.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/c/src/lib/libbsp/powerpc/shared/vectors/vectors_init.c b/c/src/lib/libbsp/powerpc/shared/vectors/vectors_init.c
index 9a339250e2..40b360e461 100644
--- a/c/src/lib/libbsp/powerpc/shared/vectors/vectors_init.c
+++ b/c/src/lib/libbsp/powerpc/shared/vectors/vectors_init.c
@@ -23,6 +23,38 @@ static rtems_raw_except_connect_data exception_table[LAST_VALID_EXC + 1];
exception_handler_t globalExceptHdl;
+/* T. Straumann: provide a stack trace
+ * <strauman@slac.stanford.edu>, 6/26/2001
+ */
+typedef struct LRFrameRec_ {
+ struct LRFrameRec_ *frameLink;
+ unsigned long *lr;
+} LRFrameRec, *LRFrame;
+
+#define STACK_CLAMP 50 /* in case we have a corrupted bottom */
+
+void
+BSP_printStackTrace(BSP_Exception_frame* excPtr)
+{
+LRFrame f;
+int i;
+
+ printk("Stack Trace: ");
+ printk(" IP: 0x%08x, LR: 0x%08x\n",
+ excPtr->EXC_SRR0, excPtr->EXC_LR);
+ for (f=(LRFrame)excPtr->GPR1, i=0; f->frameLink && i<STACK_CLAMP; f=f->frameLink) {
+ printk("--^ 0x%08x", (long)(f->frameLink->lr));
+ if (!(++i%5))
+ printk("\n");
+ }
+ if (i>=STACK_CLAMP) {
+ printk("Too many stack frames (stack possibly corrupted), giving up...\n");
+ } else {
+ if (i%5)
+ printk("\n");
+ }
+}
+
void C_exception_handler(BSP_Exception_frame* excPtr)
{
int recoverable = 0;
@@ -66,7 +98,10 @@ void C_exception_handler(BSP_Exception_frame* excPtr)
printk("\t CTR = %x\n", excPtr->EXC_CTR);
printk("\t XER = %x\n", excPtr->EXC_XER);
printk("\t LR = %x\n", excPtr->EXC_LR);
- printk("\t MSR = %x\n", excPtr->EXC_MSR);
+ printk("\t DAR = %x\n", excPtr->EXC_DAR);
+
+ BSP_printStackTrace(excPtr);
+
if (excPtr->_EXC_number == ASM_DEC_VECTOR)
recoverable = 1;
if (excPtr->_EXC_number == ASM_SYS_VECTOR)