For RISC-V, don't save/restore FP regs
authorAndrew Waterman <waterman@cs.berkeley.edu>
Mon, 7 Jan 2013 03:32:38 +0000 (19:32 -0800)
committerAndrew Waterman <waterman@cs.berkeley.edu>
Mon, 7 Jan 2013 03:32:38 +0000 (19:32 -0800)
Before making this work correctly for no-FP machines, we need to sort out how
we handle silly state.  I think the plan is to only ever restore it lazily,
but that requires many changes to the mainline kernel.

kern/arch/riscv/env.c
kern/arch/riscv/trap.c

index 0f9f3e8..baddfb3 100644 (file)
@@ -14,6 +14,7 @@ env_push_ancillary_state(env_t* e)
 void
 save_fp_state(ancillary_state_t* silly)
 {
+       return; // don't save FP state for now
        uintptr_t sr = mfpcr(PCR_SR);
        mtpcr(PCR_SR, sr | SR_EF);
 
@@ -65,6 +66,7 @@ env_pop_ancillary_state(env_t* e)
 void
 restore_fp_state(ancillary_state_t* silly)
 {
+       return; // don't restore FP state for now
        uintptr_t sr = mfpcr(PCR_SR);
        mtpcr(PCR_SR, sr | SR_EF);
 
index 0ac96ab..8cf342a 100644 (file)
@@ -236,11 +236,17 @@ handle_fault_store(trapframe_t* state)
 static void
 handle_illegal_instruction(trapframe_t* state)
 {
-       set_current_tf(&per_cpu_info[core_id()], state);
+       assert(!in_kernel(state));
+
+       // XXX for noFP demo purposes we're ignoring illegal insts in the user.
+       advance_pc(state);
+       env_pop_tf(state); /* We didn't save our TF, so don't use proc_restartcore */
 
+       struct per_cpu_info *pcpui = &per_cpu_info[core_id()];
+       set_current_tf(pcpui, state);
        if (emulate_fpu(state) == 0)
        {
-               advance_pc(per_cpu_info[core_id()].cur_tf);
+               advance_pc(pcpui->cur_tf);
                return;
        }