Author: kib
Date: Sat Jul 21 13:47:37 2012
New Revision: 238670
URL: http://svn.freebsd.org/changeset/base/238670

Log:
  Stop caching curpcb in the local variable.
  
  Requested by:     bde
  MFC after:        1 week

Modified:
  head/sys/amd64/amd64/fpu.c

Modified: head/sys/amd64/amd64/fpu.c
==============================================================================
--- head/sys/amd64/amd64/fpu.c  Sat Jul 21 13:06:37 2012        (r238669)
+++ head/sys/amd64/amd64/fpu.c  Sat Jul 21 13:47:37 2012        (r238670)
@@ -582,7 +582,6 @@ static int err_count = 0;
 void
 fpudna(void)
 {
-       struct pcb *pcb;
 
        critical_enter();
        if (PCPU_GET(fpcurthread) == curthread) {
@@ -604,11 +603,10 @@ fpudna(void)
         * Record new context early in case frstor causes a trap.
         */
        PCPU_SET(fpcurthread, curthread);
-       pcb = curpcb;
 
        fpu_clean_state();
 
-       if ((pcb->pcb_flags & PCB_FPUINITDONE) == 0) {
+       if ((curpcb->pcb_flags & PCB_FPUINITDONE) == 0) {
                /*
                 * This is the first time this thread has used the FPU or
                 * the PCB doesn't contain a clean FPU state.  Explicitly
@@ -619,17 +617,17 @@ fpudna(void)
                 * fpu_initialstate, to ignite the XSAVEOPT
                 * tracking engine.
                 */
-               bcopy(fpu_initialstate, pcb->pcb_save, cpu_max_ext_state_size);
-               fpurestore(pcb->pcb_save);
-               if (pcb->pcb_initial_fpucw != __INITIAL_FPUCW__)
-                       fldcw(pcb->pcb_initial_fpucw);
-               if (PCB_USER_FPU(pcb))
-                       set_pcb_flags(pcb,
+               bcopy(fpu_initialstate, curpcb->pcb_save, 
cpu_max_ext_state_size);
+               fpurestore(curpcb->pcb_save);
+               if (curpcb->pcb_initial_fpucw != __INITIAL_FPUCW__)
+                       fldcw(curpcb->pcb_initial_fpucw);
+               if (PCB_USER_FPU(curpcb))
+                       set_pcb_flags(curpcb,
                            PCB_FPUINITDONE | PCB_USERFPUINITDONE);
                else
-                       set_pcb_flags(pcb, PCB_FPUINITDONE);
+                       set_pcb_flags(curpcb, PCB_FPUINITDONE);
        } else
-               fpurestore(pcb->pcb_save);
+               fpurestore(curpcb->pcb_save);
        critical_exit();
 }
 
@@ -963,16 +961,14 @@ fpu_kern_leave(struct thread *td, struct
 int
 fpu_kern_thread(u_int flags)
 {
-       struct pcb *pcb;
 
-       pcb = curpcb;
        KASSERT((curthread->td_pflags & TDP_KTHREAD) != 0,
            ("Only kthread may use fpu_kern_thread"));
-       KASSERT(pcb->pcb_save == get_pcb_user_save_pcb(pcb),
+       KASSERT(curpcb->pcb_save == get_pcb_user_save_pcb(curpcb),
            ("mangled pcb_save"));
-       KASSERT(PCB_USER_FPU(pcb), ("recursive call"));
+       KASSERT(PCB_USER_FPU(curpcb), ("recursive call"));
 
-       set_pcb_flags(pcb, PCB_KERNFPU);
+       set_pcb_flags(curpcb, PCB_KERNFPU);
        return (0);
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to