Author: jhibbits
Date: Sun Jan 13 04:51:24 2019
New Revision: 342988
URL: https://svnweb.freebsd.org/changeset/base/342988

Log:
  powerpcspe: Correct SPE high-component loading
  
  Don't clobber the low part of the register restoring the high component of.
  This could lead to very bad behavior if it's an ABI-affected register.
  
  While here, also mark the asm volatile in the SPE high save case, to match
  the load case.
  
  Reported by:  Branden Bergren (git_bdragon.rtk0.net)
  MFC after:    1 week

Modified:
  head/sys/powerpc/booke/spe.c

Modified: head/sys/powerpc/booke/spe.c
==============================================================================
--- head/sys/powerpc/booke/spe.c        Sun Jan 13 02:38:14 2019        
(r342987)
+++ head/sys/powerpc/booke/spe.c        Sun Jan 13 04:51:24 2019        
(r342988)
@@ -425,7 +425,7 @@ static uint32_t
 spe_save_reg_high(int reg)
 {
        uint32_t vec[2];
-#define EVSTDW(n)   case n: __asm ("evstdw %1,0(%0)" \
+#define EVSTDW(n)   case n: __asm __volatile ("evstdw %1,0(%0)" \
                :: "b"(vec), "n"(n)); break;
        switch (reg) {
        EVSTDW(0);      EVSTDW(1);      EVSTDW(2);      EVSTDW(3);
@@ -448,7 +448,7 @@ spe_save_reg_high(int reg)
 static void
 spe_load_reg_high(int reg, uint32_t val)
 {
-#define        EVLDW(n)   case n: __asm __volatile("evmergelo "#n",%0,0," \
+#define        EVLDW(n)   case n: __asm __volatile("evmergelo "#n",%0,"#n \
            :: "r"(val)); break;
        switch (reg) {
        EVLDW(1);       EVLDW(2);       EVLDW(3);       EVLDW(4);
_______________________________________________
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