diff --git a/am/Makefile b/am/Makefile index ac8efe4b..9dbb61c4 100644 --- a/am/Makefile +++ b/am/Makefile @@ -1,4 +1,3 @@ NAME = am SRCS = $(shell find -L ./arch/$(ARCH)/src/ -name "*.c" -o -name "*.cpp" -o -name "*.S") -LIBS += klib include $(AM_HOME)/Makefile.lib diff --git a/am/arch/mips32-minimal/src/exception/exc_handler.c b/am/arch/mips32-minimal/src/exception/exc_handler.c index dd16a649..d6d868a7 100644 --- a/am/arch/mips32-minimal/src/exception/exc_handler.c +++ b/am/arch/mips32-minimal/src/exception/exc_handler.c @@ -1,7 +1,9 @@ #include -#include +void printstr(char *str) { + while(*str ++) _putc(*str); +} uint get_cause() { uint ret; @@ -17,15 +19,21 @@ uint get_epc() { void exception_handle() { uint cause = get_cause(); - uint epc = get_epc(); + //uint epc = get_epc(); uint exccode = (cause >> 2) & 0x1f; switch(exccode) { + /* printf verison 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 10: printf("Invalid OPCODE @PC = 0x%d.\n", epc); break; 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);