From 241a59885255867977576558c2abab7c49b37db6 Mon Sep 17 00:00:00 2001
From: Jeffrey Lee <jlee@gitlab.riscosopen.org>
Date: Sun, 14 Oct 2012 03:32:48 +0000
Subject: [PATCH] Add branch predictor maintenance to WB_CR7_LDa ARMops

Detail:
  s/ARMops - Added branch predictor maintenance to WB_CR7_LDa ARMops. If the entire instruction cache is being invalidated then the branch predictors will be invalidated for us, but for ranged invalidation we need to handle it ourselves.
Admin:
  Tested briefly on Raspberry Pi with high processor vectors
  Appears to fix Configure and its plugins misbehaving in various ways


Version 5.35, 4.79.2.173. Tagged as 'Kernel-5_35-4_79_2_173'
---
 VersionASM | 10 +++++-----
 VersionNum | 14 +++++++-------
 s/ARMops   |  3 +++
 3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/VersionASM b/VersionASM
index 36806b4..3cdf7c6 100644
--- a/VersionASM
+++ b/VersionASM
@@ -13,11 +13,11 @@
                         GBLS    Module_ComponentPath
 Module_MajorVersion     SETS    "5.35"
 Module_Version          SETA    535
-Module_MinorVersion     SETS    "4.79.2.172"
-Module_Date             SETS    "10 Oct 2012"
-Module_ApplicationDate  SETS    "10-Oct-12"
+Module_MinorVersion     SETS    "4.79.2.173"
+Module_Date             SETS    "14 Oct 2012"
+Module_ApplicationDate  SETS    "14-Oct-12"
 Module_ComponentName    SETS    "Kernel"
 Module_ComponentPath    SETS    "castle/RiscOS/Sources/Kernel"
-Module_FullVersion      SETS    "5.35 (4.79.2.172)"
-Module_HelpVersion      SETS    "5.35 (10 Oct 2012) 4.79.2.172"
+Module_FullVersion      SETS    "5.35 (4.79.2.173)"
+Module_HelpVersion      SETS    "5.35 (14 Oct 2012) 4.79.2.173"
                         END
diff --git a/VersionNum b/VersionNum
index 8826335..c312452 100644
--- a/VersionNum
+++ b/VersionNum
@@ -5,19 +5,19 @@
  *
  */
 #define Module_MajorVersion_CMHG        5.35
-#define Module_MinorVersion_CMHG        4.79.2.172
-#define Module_Date_CMHG                10 Oct 2012
+#define Module_MinorVersion_CMHG        4.79.2.173
+#define Module_Date_CMHG                14 Oct 2012
 
 #define Module_MajorVersion             "5.35"
 #define Module_Version                  535
-#define Module_MinorVersion             "4.79.2.172"
-#define Module_Date                     "10 Oct 2012"
+#define Module_MinorVersion             "4.79.2.173"
+#define Module_Date                     "14 Oct 2012"
 
-#define Module_ApplicationDate          "10-Oct-12"
+#define Module_ApplicationDate          "14-Oct-12"
 
 #define Module_ComponentName            "Kernel"
 #define Module_ComponentPath            "castle/RiscOS/Sources/Kernel"
 
-#define Module_FullVersion              "5.35 (4.79.2.172)"
-#define Module_HelpVersion              "5.35 (10 Oct 2012) 4.79.2.172"
+#define Module_FullVersion              "5.35 (4.79.2.173)"
+#define Module_HelpVersion              "5.35 (14 Oct 2012) 4.79.2.173"
 #define Module_LibraryVersionInfo       "5:35"
diff --git a/s/ARMops b/s/ARMops
index 9c318da..18edf5a 100644
--- a/s/ARMops
+++ b/s/ARMops
@@ -1278,6 +1278,7 @@ IMB_Range_WB_CR7_LDa ROUT
         BLO     %BT10
         MOV     a1, #0
         MCR     p15, 0, a1, c7, c10, 4           ; drain WBuffer
+        MCR     p15, 0, a1, c7, c5, 6            ; flush branch predictors
         Pull    "pc"
 
 MMU_Changing_WB_CR7_LDa ROUT
@@ -1302,6 +1303,7 @@ MMU_ChangingEntry_WB_CR7_LDa ROUT
         BLO     %BT10
         MOV     lr, #0
         MCR     p15, 0, lr, c7, c10, 4          ; drain WBuffer
+        MCR     p15, 0, a1, c7, c5, 6           ; flush branch predictors
         SUB     a1, a1, #PageSize
         MCR     p15, 0, a1, c8, c6, 1           ; invalidate DTLB entry
         MCR     p15, 0, a1, c8, c5, 1           ; invalidate ITLB entry
@@ -1328,6 +1330,7 @@ MMU_ChangingEntries_WB_CR7_LDa ROUT
         BLO     %BT10
         MOV     a1, #0
         MCR     p15, 0, a1, c7, c10, 4             ; drain WBuffer
+        MCR     p15, 0, a1, c7, c5, 6              ; flush branch predictors
         MOV     a1, lr                             ; restore start address
 20
         MCR     p15, 0, a1, c8, c6, 1              ; invalidate DTLB entry
-- 
GitLab