aboutsummaryrefslogtreecommitdiff
path: root/pk/handlers.c
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@s141.Millennium.Berkeley.EDU>2011-05-16 14:34:11 -0700
committerAndrew Waterman <waterman@s141.Millennium.Berkeley.EDU>2011-05-16 14:34:11 -0700
commitbbd999a00eb4859576db2422ceefc0ebf6d721e5 (patch)
treebb7131ba32e89bd2f2944f740f134ce38c9cb7d2 /pk/handlers.c
parent5fa814486ad9b7e14f76f8c4cdc1f058bd0db706 (diff)
downloadriscv-pk-bbd999a00eb4859576db2422ceefc0ebf6d721e5.zip
riscv-pk-bbd999a00eb4859576db2422ceefc0ebf6d721e5.tar.gz
riscv-pk-bbd999a00eb4859576db2422ceefc0ebf6d721e5.tar.bz2
[sim,pk] cleanups & initial virtual memory support
Diffstat (limited to 'pk/handlers.c')
-rw-r--r--pk/handlers.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/pk/handlers.c b/pk/handlers.c
index c9b6a96..3634135 100644
--- a/pk/handlers.c
+++ b/pk/handlers.c
@@ -4,14 +4,6 @@
int have_fp = 1; // initialized to 1 because it can't be in the .bss section!
int have_vector = 1;
-static void handle_fp_disabled(trapframe_t* tf)
-{
- irq_enable();
-
- kassert(have_fp);
- init_fp(tf);
-}
-
static void handle_vector_disabled(trapframe_t* tf)
{
if (have_vector)
@@ -42,6 +34,16 @@ static void handle_illegal_instruction(trapframe_t* tf)
panic("An illegal instruction was executed!");
}
+static void handle_fp_disabled(trapframe_t* tf)
+{
+ irq_enable();
+
+ if(have_fp && !(mfpcr(PCR_SR) & SR_EF))
+ init_fp(tf);
+ else
+ handle_illegal_instruction(tf);
+}
+
static void handle_breakpoint(trapframe_t* tf)
{
dump_tf(tf);
@@ -92,7 +94,7 @@ static void handle_bad_interrupt(trapframe_t* tf, int interrupt)
static void handle_timer_interrupt(trapframe_t* tf)
{
- mtpcr(mfpcr(PCR_COMPARE)+TIMER_PERIOD,PCR_COMPARE);
+ mtpcr(PCR_COMPARE, mfpcr(PCR_COMPARE)+TIMER_PERIOD);
}
static void handle_interrupt(trapframe_t* tf)