Package: ioapps
Version: 1.4r2-3
Severity: important
Tags: patch
User: debian-powerpc...@breakpoint.cc
Usertags: powerpcspe

Hi,

since ioapps uses the rdtsc assembler instruction it fails to build from source
on all architectures except I*tel.

Attaching a patch that fixes the issue on powerpc.

Roland


-- System Information:
Debian Release: 7.0
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: powerpcspe (ppc)

Kernel: Linux 3.9.0-dirty (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
--- ioapps-1.4r2.orig/replicate.c
+++ ioapps-1.4r2/replicate.c
@@ -67,7 +67,27 @@ unsigned long long clock_rate = 0;
 
 struct timeval start_time;
 
+#ifdef __powerpc__
+static inline unsigned long long rdtsc(void)
+{
+	unsigned long long int result;
+	unsigned long int upper, lower, tmp;
+	__asm__ volatile(
+			"0:                     \n"
+			"\tmftbu   %0           \n"
+			"\tmftb    %1           \n"
+			"\tmftbu   %2           \n"
+			"\tcmpw    %2,%0        \n"
+			"\tbne     0b           \n"
+			: "=r"(upper), "=r"(lower), "=r"(tmp)
+			);
+	result = upper;
+	result = result << 32;
+	result = result | lower;
 
+	return result;
+}
+#else
 static inline unsigned long long int rdtsc(void) {
 	unsigned a, d;
 
@@ -75,6 +95,7 @@ static inline unsigned long long int rdt
 
 	return ((unsigned long long)a) | (((unsigned long long)d) << 32);;
 }
+#endif
 
 unsigned long long  get_clock_rate() {
 	unsigned long long x1;

Reply via email to