aboutsummaryrefslogtreecommitdiff
path: root/pk/handlers.c
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2013-08-18 04:17:29 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2013-08-18 04:17:29 -0700
commit186ae3cc353fa3115d4ee0c9fcb18d8b2370c68c (patch)
tree3ecbf5e1e1333195e6f30764f876618fc79e829b /pk/handlers.c
parent2f7d5b9ee2ea937c6734650fecd9952e070a9795 (diff)
downloadpk-186ae3cc353fa3115d4ee0c9fcb18d8b2370c68c.zip
pk-186ae3cc353fa3115d4ee0c9fcb18d8b2370c68c.tar.gz
pk-186ae3cc353fa3115d4ee0c9fcb18d8b2370c68c.tar.bz2
Renumber PCRs; refer to them with new ASM syntax
Diffstat (limited to 'pk/handlers.c')
-rw-r--r--pk/handlers.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/pk/handlers.c b/pk/handlers.c
index d0ca7f5..45b2317 100644
--- a/pk/handlers.c
+++ b/pk/handlers.c
@@ -14,7 +14,10 @@ static void handle_vector_disabled(trapframe_t* tf)
if (have_vector)
tf->sr |= SR_EV;
else
- panic("No vector hardware! pc %lx, insn %x",tf->epc,(uint32_t)tf->insn);
+ {
+ dump_tf(tf);
+ panic("No vector hardware!");
+ }
}
static void handle_vector_bank(trapframe_t* tf)
@@ -37,17 +40,24 @@ static void handle_privileged_instruction(trapframe_t* tf)
static void handle_illegal_instruction(trapframe_t* tf)
{
+ tf->insn = *(uint16_t*)tf->epc;
+ int len = insn_len(tf->insn);
+ if (len == 4)
+ tf->insn |= ((uint32_t)*(uint16_t*)(tf->epc + 2) << 16);
+ else
+ kassert(len == 2);
+
#ifdef PK_ENABLE_FP_EMULATION
- if(emulate_fp(tf) == 0)
+ if (emulate_fp(tf) == 0)
{
- advance_pc(tf);
+ tf->epc += len;
return;
}
#endif
- if(emulate_int(tf) == 0)
+ if (emulate_int(tf) == 0)
{
- advance_pc(tf);
+ tf->epc += len;
return;
}
@@ -121,7 +131,7 @@ static void handle_syscall(trapframe_t* tf)
tf->gpr[16] = ret.result;
tf->gpr[21] = ret.err;
- advance_pc(tf);
+ tf->epc += 4;
}
void handle_trap(trapframe_t* tf)