Author: bdragon
Date: Sun Dec 13 03:58:43 2020
New Revision: 368604
URL: https://svnweb.freebsd.org/changeset/base/368604

Log:
  [PowerPC] Floating-point exception trap followup
  
  * Fix incorrect operation on 32-bit caused by incorrectly-sized storage
    for a temporary FPSCR.
  * Fix several whitespace problems.
  * Don't try to enable VSX during cleanup_fpscr().
  
  Reviewed by:  alfredo, jhibbits (earlier version)
  Sponsored by: Tag1 Consulting, Inc.
  Differential Revision:        https://reviews.freebsd.org/D27453

Modified:
  head/sys/powerpc/include/cpufunc.h
  head/sys/powerpc/powerpc/exec_machdep.c
  head/sys/powerpc/powerpc/fpu.c

Modified: head/sys/powerpc/include/cpufunc.h
==============================================================================
--- head/sys/powerpc/include/cpufunc.h  Sun Dec 13 02:21:54 2020        
(r368603)
+++ head/sys/powerpc/include/cpufunc.h  Sun Dec 13 03:58:43 2020        
(r368604)
@@ -163,21 +163,21 @@ mttb(u_quad_t time)
        mtspr(TBR_TBWL, (uint32_t)(time & 0xffffffff));
 }
 
-
 static __inline register_t
 mffs(void)
 {
-       register_t value;
+       uint64_t value;
 
        __asm __volatile ("mffs 0; stfd 0,0(%0)"
                        :: "b"(&value));
 
-       return (value);
+       return ((register_t)value);
 }
 
 static __inline void
-mtfsf(register_t value)
+mtfsf(uint64_t value)
 {
+
        __asm __volatile ("lfd 0,0(%0); mtfsf 0xff,0"
                        :: "b"(&value));
 }

Modified: head/sys/powerpc/powerpc/exec_machdep.c
==============================================================================
--- head/sys/powerpc/powerpc/exec_machdep.c     Sun Dec 13 02:21:54 2020        
(r368603)
+++ head/sys/powerpc/powerpc/exec_machdep.c     Sun Dec 13 03:58:43 2020        
(r368604)
@@ -239,14 +239,13 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
                usfp = (void *)((sp - rndfsize) & ~0xFul);
        }
 
-       /* 
+       /*
         * Set Floating Point facility to "Ignore Exceptions Mode" so signal
-        * handler can run. 
+        * handler can run.
         */
        if (td->td_pcb->pcb_flags & PCB_FPU)
                tf->srr1 = tf->srr1 & ~(PSL_FE0 | PSL_FE1);
 
-
        /*
         * Set up the registers to return to sigcode.
         *
@@ -334,10 +333,10 @@ sys_sigreturn(struct thread *td, struct sigreturn_args
        if (error != 0)
                return (error);
 
-       /* 
+       /*
         * Save FPU state if needed. User may have changed it on
-        * signal handler 
-        */ 
+        * signal handler
+        */
        if (uc.uc_mcontext.mc_srr1 & PSL_FP)
                save_fpu(td);
 

Modified: head/sys/powerpc/powerpc/fpu.c
==============================================================================
--- head/sys/powerpc/powerpc/fpu.c      Sun Dec 13 02:21:54 2020        
(r368603)
+++ head/sys/powerpc/powerpc/fpu.c      Sun Dec 13 03:58:43 2020        
(r368604)
@@ -209,7 +209,6 @@ save_fpu_nodrop(struct thread *td)
                save_fpu_int(td);
 }
 
-
 /*
  * Clear Floating-Point Status and Control Register
  */
@@ -217,19 +216,18 @@ void
 cleanup_fpscr()
 {
        register_t msr;
-       msr = mfmsr();
-       mtmsr(msr | PSL_FP | PSL_VSX);
 
+       msr = mfmsr();
+       mtmsr(msr | PSL_FP);
        mtfsf(0);
 
        isync();
        mtmsr(msr);
 }
 
-
 /*
- *  * Returns the current fp exception
- *   */
+ * Get the current fp exception
+ */
 u_int
 get_fpu_exception(struct thread *td)
 {
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to