- added mixed I/D exceptions (13, 14)

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@437 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
2009-04-15 13:46:00 +00:00
parent 4372265ee2
commit 30340bd6cf
+59 -9
View File
@@ -7,7 +7,7 @@ void _exc_break(void)
__asm
(
".set noreorder\n"
"break 0x123\n"
"break 0x9\n"
".set reorder\n"
);
@@ -47,10 +47,18 @@ void _exc_store_err(void)
void _exc_load_err(void)
{
volatile int *pSrc = (int*)0x40000002;
volatile int *pDst = (int*)sys_led_port;
__asm
(
".set noreorder\n"
" li $t0, 0x40000000\n"
" li $t1, 0x40000000\n"
" lw $t1, 0($t1)\n"
" lw $t0, 2($t0)\n"
" lw $t1, 4($t0)\n"
"nop\n"
".set reorder\n"
*pDst = *pSrc;
);
}
@@ -68,12 +76,44 @@ void _exc_kaddr_err(void)
}
void _exc_iaddr_daddr_err(void)
{
__asm
(
".set noreorder\n"
" li $t0, 0x40000003\n"
" li $t1, 0x40000002\n"
" jr $t0\n"
" lw $t1, 0($t1)\n"
"nop\n"
".set reorder\n"
);
}
void _exc_daddr_iaddr_err(void)
{
__asm
(
".set noreorder\n"
" li $t0, 0x40000003\n"
" li $t1, 0x40000002\n"
" lw $t1, 0($t1)\n"
" jr $t0\n"
"nop\n"
".set reorder\n"
);
}
void _exc_iaddr_err(void)
{
__asm
(
".set noreorder\n"
" li $t0, 0x80000003\n"
" li $t0, 0x40000003\n"
" jr $t0\n"
"nop\n"
".set reorder\n"
@@ -154,17 +194,19 @@ int main(void)
{
printf("Welche exception möchten Sie testen?\n");
printf(" 1 : Reserved instruction\n");
printf(" 2 : Privileged address\n");
printf(" 2 : Privileged address (BadVAddr = 0x80000000)\n");
printf(" 3 : Arithmetic overflow\n");
printf(" 4 : Syscall\n");
printf(" 5 : Breakpoint\n");
printf(" 6 : Load error on instruction\n");
printf(" 7 : Load error on data\n");
printf(" 8 : Store error on data\n");
printf(" 6 : Load error on instruction (BadVAddr = 0x40000003)\n");
printf(" 7 : Load error on data (BadVAddr = 0x40000002)\n");
printf(" 8 : Store error on data (BadVAddr = 0x40000001)\n");
printf(" 9 : Bus error on instruction\n");
printf("10 : Bus error on data\n");
printf("11 : SW-interrupt 0\n");
printf("12 : SW-interrupt 1\n");
printf("13 : Load error on instruction and Load error on data (BadVAddr = 0x40000003)\n");
printf("14 : Load error on data and Load error on instruction (BadVAddr = 0x40000002)\n");
scanf("%d", &sel);
printf("Jetzt kommt die exception (%d)!\n", sel);
@@ -218,6 +260,14 @@ int main(void)
interrupt_set(sel-11);
break;
case 13:
_exc_iaddr_daddr_err();
break;
case 14:
_exc_daddr_iaddr_err();
break;
default:
break;
}