[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#127739: please add patch to support s390



Package: libhoard
Version: 2.1.0-1
Severity: serious
Tags: patch


Hi,
could you please apply the attached patch to support s390. I have sent it 
already to upstream since he contacted me regarding my previous NMU.

Thanks,
Gerhard
diff -urN libhoard-2.1.0/arch-specific.cpp libhoard-2.1.0-s390/arch-specific.cpp
--- libhoard-2.1.0/arch-specific.cpp	Fri Jan  4 06:44:38 2002
+++ libhoard-2.1.0-s390/arch-specific.cpp	Fri Jan  4 06:44:04 2002
@@ -293,7 +293,30 @@
 	: "r"(oldval), "r"(newval), "r"(*oldval)
 	: "cr0", "memory");
 #endif
-#if !(defined(__sparc__) || defined(i386) || defined(__sgi) || defined(__powerpc__))
+#if defined(__s390__)
+        __asm__ __volatile__(
+             "   lhi   1,3\n"          /* CS must be aligned on 4 byte b. */
+             "   nr    1,%1\n"         /* isolate last 2 bits of address */
+             "   xr    %1,1\n"         /* make addr % 4 == 0 */
+             "   sll   1,3\n"
+             "   ar    %0,1\n"         /* add alignement to bitnr */ 
+             "   lhi   1,31\n"
+             "   nr    1,%0\n"         /* make shift value */
+             "   xr    %0,1\n"
+             "   srl   %0,3\n"
+             "   la    %1,0(%0,%1)\n"  /* calc. address for CS */
+             "   lhi   2,1\n"
+             "   sll   2,0(1)\n"       /* make OR mask */
+             "   l     %0,0(%1)\n"
+             "0: lr    1,%0\n"         /* CS loop starts here */
+             "   xr    1,2\n"          /* set bit */
+             "   cs    %0,1,0(%1)\n"
+             "   jl    0b\n"
+             "   nr    %0,2\n"         /* isolate old bit */
+             : "+a" (newval), "+a" (oldval) :
+             : "cc", "memory", "1", "2" );
+#endif
+#if !(defined(__sparc__) || defined(i386) || defined(__sgi) || defined(__powerpc__) || !defined(__s390__))
 #error "Hoard does not include support for user-level locks for this platform."
 #endif
   return newval;

Reply to: