aboutsummaryrefslogtreecommitdiff
path: root/pk/handlers.c
diff options
context:
space:
mode:
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)