From bbd999a00eb4859576db2422ceefc0ebf6d721e5 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Mon, 16 May 2011 14:34:11 -0700 Subject: [sim,pk] cleanups & initial virtual memory support --- pk/handlers.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'pk/handlers.c') 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) -- cgit v1.1