rm klib because of unimplemented instructions

This commit is contained in:
bingo 2017-05-31 20:41:59 +08:00
parent c5d439da2e
commit 4c6452d4e4
2 changed files with 10 additions and 3 deletions

View File

@ -1,4 +1,3 @@
NAME = am NAME = am
SRCS = $(shell find -L ./arch/$(ARCH)/src/ -name "*.c" -o -name "*.cpp" -o -name "*.S") SRCS = $(shell find -L ./arch/$(ARCH)/src/ -name "*.c" -o -name "*.cpp" -o -name "*.S")
LIBS += klib
include $(AM_HOME)/Makefile.lib include $(AM_HOME)/Makefile.lib

View File

@ -1,7 +1,9 @@
#include <am.h> #include <am.h>
#include <klib.h>
void printstr(char *str) {
while(*str ++) _putc(*str);
}
uint get_cause() { uint get_cause() {
uint ret; uint ret;
@ -17,15 +19,21 @@ uint get_epc() {
void exception_handle() { void exception_handle() {
uint cause = get_cause(); uint cause = get_cause();
uint epc = get_epc(); //uint epc = get_epc();
uint exccode = (cause >> 2) & 0x1f; uint exccode = (cause >> 2) & 0x1f;
switch(exccode) { switch(exccode) {
/* printf verison
case 4: printf("BadVAddr when loading @PC = 0x%d.\n", epc); break; case 4: printf("BadVAddr when loading @PC = 0x%d.\n", epc); break;
case 5: printf("BadVAddr when storing @PC = 0x%d.\n", epc); break; case 5: printf("BadVAddr when storing @PC = 0x%d.\n", epc); break;
case 10: printf("Invalid OPCODE @PC = 0x%d.\n", epc); break; case 10: printf("Invalid OPCODE @PC = 0x%d.\n", epc); break;
default: printf("Unhandled exception, ExcCode = %d.\n", exccode); default: printf("Unhandled exception, ExcCode = %d.\n", exccode);
*/
case 4: printstr("BadVAddr when loading.\n"); break;
case 5: printstr("BadVAddr when storing.\n"); break;
case 10: printstr("Invalid OPCODE.\n"); break;
default: printstr("Unhandled exception.\n");
} }
_halt(1); _halt(1);