Skip to contentSkip to conversation

used_math not cleared for new processes?

DISCUSSION Zhang Fuxin 1 participant 1 message Mar 1, 2002 MIPS

lore
Share & tools
lore
#0 lore raw

hi,
sorry,it seems this patch bring other problem,please don't use.
i am investigating it.

Quoted 39 lines
Quoted 6 lines

I think it make sense to clear used_math in do_exec(). It also improvies the performance slightly by not loading the parent's FPU context when it uses the FPU for the first time.

Do you have a patch for this?

Yes. Here it is.

processor.h Thu Feb 28 15:00:10 2002 renamed from processor.h.ori Thu Feb 28 15:02:20 2002 +1 -0
@@ -215,6 +215,7 @@
       regs->cp0_epc = new_pc;                                         \
       regs->regs[29] = new_sp;                                        \
       current->thread.current_ds = USER_DS;                           \
+       current->used_math = 0;                                         \
 } while (0)
 
 unsigned long get_wchan(struct task_struct *p);
traps.c Thu Feb 28 15:05:23 2002 renamed from traps.c.ori Thu Feb 28 15:04:48 2002 +5 -1
@@ -668,8 +668,12 @@
       if (current->used_math) {               /* Using the FPU again.  */
               lazy_fpu_switch(last_task_used_math);
       } else {                                /* First time FPU user.  */
-               if (last_task_used_math != NULL)
+               if (last_task_used_math != NULL) {
+                       int status = read_32bit_cp0_register(CP0_STATUS);
+                       write_32bit_cp0_register(CP0_STATUS,status|ST0_CU1);
+
                       save_fp(last_task_used_math);
+               }
               init_fpu();
               current->used_math = 1;
       }
Quoted 3 lines
Quoted 5 lines
Quoted 1 line

Jun

Regards
Zhang Fuxin
[email protected]

Regards
Zhang Fuxin
[email protected]