From ee2fa7bc6f6ff5292b492530c05e7abe6719f09b Mon Sep 17 00:00:00 2001
From: Robert Sprowson <rsprowson@gitlab.riscosopen.org>
Date: Sun, 7 Oct 2012 20:49:08 +0000
Subject: [PATCH] Actually pay attention to configured cache preferences

The kernel recently took back ownership of the *CACHE command and it's configure counterpart, but wasn't reading the CMOS value on startup.
Spotted while looking at bus transactions on IOMD, and wondering where they all are, then realising it's all running from the cache.

Version 5.35, 4.79.2.170. Tagged as 'Kernel-5_35-4_79_2_170'
---
 VersionASM   | 10 +++++-----
 VersionNum   | 14 +++++++-------
 s/PMF/osinit |  9 +++++++++
 3 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/VersionASM b/VersionASM
index 18089a1..ebfe2ed 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.169"
-Module_Date             SETS    "06 Oct 2012"
-Module_ApplicationDate  SETS    "06-Oct-12"
+Module_MinorVersion     SETS    "4.79.2.170"
+Module_Date             SETS    "07 Oct 2012"
+Module_ApplicationDate  SETS    "07-Oct-12"
 Module_ComponentName    SETS    "Kernel"
 Module_ComponentPath    SETS    "castle/RiscOS/Sources/Kernel"
-Module_FullVersion      SETS    "5.35 (4.79.2.169)"
-Module_HelpVersion      SETS    "5.35 (06 Oct 2012) 4.79.2.169"
+Module_FullVersion      SETS    "5.35 (4.79.2.170)"
+Module_HelpVersion      SETS    "5.35 (07 Oct 2012) 4.79.2.170"
                         END
diff --git a/VersionNum b/VersionNum
index 80afa87..40f889a 100644
--- a/VersionNum
+++ b/VersionNum
@@ -5,19 +5,19 @@
  *
  */
 #define Module_MajorVersion_CMHG        5.35
-#define Module_MinorVersion_CMHG        4.79.2.169
-#define Module_Date_CMHG                06 Oct 2012
+#define Module_MinorVersion_CMHG        4.79.2.170
+#define Module_Date_CMHG                07 Oct 2012
 
 #define Module_MajorVersion             "5.35"
 #define Module_Version                  535
-#define Module_MinorVersion             "4.79.2.169"
-#define Module_Date                     "06 Oct 2012"
+#define Module_MinorVersion             "4.79.2.170"
+#define Module_Date                     "07 Oct 2012"
 
-#define Module_ApplicationDate          "06-Oct-12"
+#define Module_ApplicationDate          "07-Oct-12"
 
 #define Module_ComponentName            "Kernel"
 #define Module_ComponentPath            "castle/RiscOS/Sources/Kernel"
 
-#define Module_FullVersion              "5.35 (4.79.2.169)"
-#define Module_HelpVersion              "5.35 (06 Oct 2012) 4.79.2.169"
+#define Module_FullVersion              "5.35 (4.79.2.170)"
+#define Module_HelpVersion              "5.35 (07 Oct 2012) 4.79.2.170"
 #define Module_LibraryVersionInfo       "5:35"
diff --git a/s/PMF/osinit b/s/PMF/osinit
index 5b2c1bc..6f87df0 100644
--- a/s/PMF/osinit
+++ b/s/PMF/osinit
@@ -259,6 +259,15 @@ ReadCMOSDefaults
         BICEQ   R1, R1, #KBStat_NoNumLock
         STRB    R1, KeyBdStatus
 
+        MOV     R0, #SystemSpeedCMOS
+        BL      Read
+        TST     R0, #&20                ; Cache off when b5 set
+        LDR     R2, =:NOT: (MMUC_I + MMUC_C + MMUC_W)
+        LDRNE   R1, =0
+        LDREQ   R1, =MMUC_I + MMUC_C + MMUC_W
+        MOV     R0, #MMUCReason_ModifyControl
+        BL      MMUControlSub
+
  [ ModeSelectors
         BL      Read_Configd_MonitorType
         LDR     r1, =ZeroPage+VduDriverWorkSpace+CurrentMonitorType ; set current to default
-- 
GitLab