diff options
author | Eric Norum <WENorum@lbl.gov> | 2006-04-11 19:17:09 +0000 |
---|---|---|
committer | Eric Norum <WENorum@lbl.gov> | 2006-04-11 19:17:09 +0000 |
commit | e846fc90ab036e78377165d09689453842fe3698 (patch) | |
tree | af4d94a72472b38f383d32bc2a01871879a4a254 /c | |
parent | Keep the frame pointer since its presence makes various diagnostic tools (diff) | |
download | rtems-e846fc90ab036e78377165d09689453842fe3698.tar.bz2 |
Add default exception handler.
Diffstat (limited to 'c')
-rw-r--r-- | c/src/lib/libbsp/m68k/uC5282/ChangeLog | 6 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/uC5282/startup/bspstart.c | 52 |
2 files changed, 57 insertions, 1 deletions
diff --git a/c/src/lib/libbsp/m68k/uC5282/ChangeLog b/c/src/lib/libbsp/m68k/uC5282/ChangeLog index 16e8f24706..f0652a7cff 100644 --- a/c/src/lib/libbsp/m68k/uC5282/ChangeLog +++ b/c/src/lib/libbsp/m68k/uC5282/ChangeLog @@ -1,6 +1,10 @@ +2006-04-11 Eric Norum <norume@aps.anl.gov> + + * startup/bspstart.c: Install default exception handler. + 2006-03-24 Eric Norum <norume@aps.anl.gov> - * startup/bspstart.c: Add missing reset-cause bit + * startup/bspstart.c: Add missing reset-cause bit. 2006-02-08 Joel Sherrill <joel@OARcorp.com> diff --git a/c/src/lib/libbsp/m68k/uC5282/startup/bspstart.c b/c/src/lib/libbsp/m68k/uC5282/startup/bspstart.c index e860fd46f4..26541d280e 100644 --- a/c/src/lib/libbsp/m68k/uC5282/startup/bspstart.c +++ b/c/src/lib/libbsp/m68k/uC5282/startup/bspstart.c @@ -20,6 +20,7 @@ #include <bsp.h> #include <rtems/libio.h> +#include <rtems/error.h> #include <rtems/libcsupport.h> #include <stdio.h> #include <string.h> @@ -186,12 +187,56 @@ void bsp_libc_init( void *, uint32_t, int ); void bsp_pretasking_hook(void); /* m68k version */ /* + * The Arcturus boot ROM prints exception information improperly + * so use this default exception handler instead. This one also + * prints a call backtrace + */ +static void handler(int pc) +{ + int level; + static volatile int reent; + extern char _RamSize[]; + + rtems_interrupt_disable(level); + if (reent++) bsp_reset(0); + { + int *p = &pc; + int info = p[-1]; + int pc = p[0]; + int format = (info >> 28) & 0xF; + int faultStatus = ((info >> 24) & 0xC) | ((info >> 16) & 0x3); + int vector = (info >> 18) & 0xFF; + int statusRegister = info & 0xFFFF; + int *fp; + + printk("\n\nPC:%x SR:%x VEC:%x FORMAT:%x STATUS:%x\n", pc, + statusRegister, + vector, + format, + faultStatus); + fp = &p[-2]; + for(;;) { + int *nfp = (int *)*fp; + if ((nfp <= fp) + || ((char *)nfp >= _RamSize) + || ((char *)(nfp[1]) >= _RamSize)) + break; + printk("FP:%x -> %x PC:%x\n", fp, nfp, nfp[1]); + fp = nfp; + } + } + rtems_task_suspend(0); + rtems_panic("done"); +} + +/* * bsp_start * * This routine does the bulk of the system initialisation. */ void bsp_start( void ) { + int i; extern char _WorkspaceBase[]; extern char _RamBase[], _RamSize[]; extern unsigned long _M68k_Ramsize; @@ -206,6 +251,13 @@ void bsp_start( void ) * of work space from the last physical address on the CPU board. */ + /* + * Set up default exception handler + */ + for (i = 2 ; i < 256 ; i++) + if (i != (32+2)) /* Catch all but bootrom system calls */ + *((void (**)(int))(i * 4)) = handler; + /* * Need to "allocate" the memory for the RTEMS Workspace and * tell the RTEMS configuration where it is. This memory is |