Mercurial > sos > sos
changeset 140:6179de7276a0
Recover from non-critical failure
author | Jonathan Pevarnek <pevarnj@gmail.com> |
---|---|
date | Thu, 22 Sep 2011 14:18:19 -0400 |
parents | adeb47dd7040 |
children | a237afb2f8a0 |
files | src/os/except.c |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/os/except.c Thu Sep 22 13:54:57 2011 -0400 +++ b/src/os/except.c Thu Sep 22 14:18:19 2011 -0400 @@ -3,6 +3,7 @@ #include <std.h> #include <string.h> #include <stdio.h> +#include <prog/svcCalls.h> extern void PROGINT(void); @@ -17,11 +18,8 @@ } void prog_int_handler() { - Psw psw; size_t i; char buffer[512]; - memset(&psw, 0, sizeof(Psw)); //I am going to use the builtin ones - //for a bit longer while I think u64 *regStore = (u64*)PROGINT_REG_LOC; u64 regLoc[NUM_REGS]; memcpy((void*)regLoc, regStore, NUM_REGS*sizeof(u64)); @@ -29,7 +27,15 @@ sprintf(buffer, "REG %x: %x\n", i, regLoc[i]); sPrint(buffer); } + + Psw *oldPsw = (void*)PROGINT_PSW_OLD; + if(oldPsw->p) { //was running in the program mode, switch back to shell + exit(); //not sure if this is the best way to do it... + } + //kill the machine + Psw psw; + memset(&psw, 0, sizeof(Psw)); psw.w = 1; psw.ea = 1; psw.ba = 1;