From 068c62341c7d6f3f086b16102abf1c5f5eaabffe Mon Sep 17 00:00:00 2001
From: John Romein <romein@astron.nl>
Date: Thu, 13 Jul 2006 07:57:35 +0000
Subject: [PATCH] BugID: 225 Use SPRs instead of mftb(u), since it is not clear
 whether all PPC implementations support mftb(u) and there is confusion about
 the right opcode for these instructions.

---
 Appl/CEP/CS1/CS1_BGLProc/src/FIR.S |  6 +++---
 LCS/Common/include/Common/Timer.h  | 12 ++++++------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/FIR.S b/Appl/CEP/CS1/CS1_BGLProc/src/FIR.S
index 15b47b9248e..44def8072c8 100644
--- a/Appl/CEP/CS1/CS1_BGLProc/src/FIR.S
+++ b/Appl/CEP/CS1/CS1_BGLProc/src/FIR.S
@@ -56,9 +56,9 @@ _bgl_mutex_unlock:
 
 .global _rdtsc
 _rdtsc:
-loop6:	mftbu	3
-	mftb	4
-	mftbu	5
+loop6:	mfspr	3,269
+	mfspr	4,268
+	mfspr	5,269
 	cmpw	5,3
 	bne-	loop6
 	blr
diff --git a/LCS/Common/include/Common/Timer.h b/LCS/Common/include/Common/Timer.h
index 49ccdf3e2f3..c2bf8a9a0cf 100644
--- a/LCS/Common/include/Common/Timer.h
+++ b/LCS/Common/include/Common/Timer.h
@@ -216,9 +216,9 @@ namespace LOFAR {
     asm
     (
 	"0:\n\t"
-	"mftbu %0\n\t"
-	"mftb %1\n\t"
-	"mftbu %2\n\t"
+	"mfspr %0,269\n\t"
+	"mfspr %1,268\n\t"
+	"mfspr %2,269\n\t"
 	"cmpw %2,%0\n\t"
 	"bne 0b\n\t"
 	"subfc %3,%1,%3\n\t"
@@ -301,9 +301,9 @@ namespace LOFAR {
     asm
     (
 	"0:\n\t"
-	"mftbu %0\n\t"
-	"mftb %1\n\t"
-	"mftbu %2\n\t"
+	"mfspr %0,269\n\t"
+	"mfspr %1,268\n\t"
+	"mfspr %2,269\n\t"
 	"cmpw %2,%0\n\t"
 	"bne 0b\n\t"
 	"addc %3,%3,%1\n\t"
-- 
GitLab