File haveged-otherarch.patch of Package haveged

--- configure.ac
+++ configure.ac
@@ -81,6 +81,14 @@
     HA_CPPFLAGS="-DHAVE_ISA_IA64"
  ;;
 
+ s390-*)
+    HA_CPPFLAGS="-DHAVE_ISA_S390"
+ ;;
+
+ s390x-*)
+    HA_CPPFLAGS="-DHAVE_ISA_S390X"
+ ;;
+
  powerpc*|pcc-*|powerpc64|ppc64)
     HA_CPPFLAGS="-DHAVE_ISA_PPC"
  ;;
--- src/havegecollect.h
+++ src/havegecollect.h
@@ -124,12 +124,25 @@
 
 #ifdef HAVE_ISA_IA64
 #define ARCH "ia64"
-#define CPUID(op,reg) ASM("mov %0=cpuid[%1]"\
+/* commented out, does not compile, ro 2011-11-01
+hash define CPUID(op,reg) ASM("mov %0=cpuid[%1]"\
    : "=r" (value)\
    : "r" (reg))
+hash define HASCPUID(x) x=1
+ */
 #define HARDCLOCK(x) ASM("mov %0=ar.itc" : "=r"(x))
-#define HASCPUID(x) x=1
 #endif
+
+#ifdef HAVE_ISA_S390
+#define ARCH "s390"
+#define HARDCLOCK(x) { unsigned long long cycles ; __asm__("stck 0(%0)" : : "a" (&(cycles)) : "memory", "cc"); x = cycles; }
+#endif
+
+#ifdef HAVE_ISA_S390X
+#define ARCH "s390x"
+#define HARDCLOCK(x) { unsigned long long cycles ; __asm__("stck 0(%0)" : : "a" (&(cycles)) : "memory", "cc"); x = cycles; }
+#endif
+
 #endif
 /**
  *  Use the "&&" extension to calculate the LOOP_PT
openSUSE Build Service is sponsored by