- added exception vector table.

S/W can write exception handler entry to this table.
  Exception handler can now reside anywhere in memory.

Committed on the Free edition of March Hare Software CVSNT Server.
Upgrade to CVS Suite for more features and support:
http://march-hare.com/cvsnt/


git-svn-id: http://moon:8086/svn/vhdl/trunk@494 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
2009-10-03 16:48:28 +00:00
parent f706de00bb
commit 21f33a1768
3 changed files with 50 additions and 13 deletions
+15 -11
View File
@@ -1,9 +1,13 @@
#include <regdef.h>
#include <xcpt_asm.h>
.section .ktext,"ax"
.section .exc_vect
_xcpt_vector_tbl:
.fill 16, 4, 0
.text
LEAF(xcptlow_handler)
LEAF(_xcpt_handler)
.set noreorder
.set noat
/* Note: exceptions do not save and restore registers k0 and k1.
@@ -91,21 +95,21 @@ LEAF(xcptlow_handler)
/* and call the C exception handler */
move a0, sp # arg1 = &xcp
subu sp, 16 # (arg save area)
j _xcptcall
j _xcpt_call
move ra, zero # fake return address
/* This strange call to _xcptcall with zero return address is to
/* This strange call to _xcpt_call with zero return address is to
* help exception-aware debuggers to trace back over the exception event.
* We are basically interposing a bogus stackframe (with a zero return
* address) between the C exception handler and the actual machine
* exception.
*/
xcptrest:
$xcptrest:
.set noat
add AT, sp, 16
/* at points to exception frame */
xcptrestother:
$xcptrestother:
/* restore all state */
/* restore most general registers */
lw t0, XCP_T0(AT)
@@ -160,10 +164,10 @@ xcptrestother:
.set reorder
.set at
END(xcptlow_handler)
END(_xcpt_handler)
LEAF(_xcptcall)
LEAF(_xcpt_call)
/* on entry: a0 == &xcp */
subu sp, 24
sw ra, 16(sp)
@@ -173,8 +177,8 @@ LEAF(_xcptcall)
nop
lw ra, 16(sp)
addu sp, 24
beqz ra, xcptrest
beqz ra, $xcptrest
nop
j ra
nop
END(_xcptcall)
END(_xcpt_call)