svn commit: r360862 - stable/12/sys/riscv/include
John Baldwin
jhb at FreeBSD.org
Sun May 10 00:34:09 UTC 2020
Author: jhb
Date: Sun May 10 00:34:09 2020
New Revision: 360862
URL: https://svnweb.freebsd.org/changeset/base/360862
Log:
MFC 357255,357337: Fix definition of SSTATUS_SD and MSTATUS_SD.
357255:
Fix definition of SSTATUS_SD
The SD bit is defined as the MSB of the sstatus register, meaning its
position will vary depending on the CSR's length. Previously, there were
two (unused) defines for this, for the 32 and 64-bit cases, but their
definitions were swapped.
Consolidate these into one define: SSTATUS_SD, and make the definition
dependent on the value of __riscv_xlen.
357337:
Fix 64-bit value of SSTATUS_SD to use an unsigned long.
While here, fix MSTATUS_SD to match SSTATUS_SD.
Modified:
stable/12/sys/riscv/include/riscvreg.h
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/riscv/include/riscvreg.h
==============================================================================
--- stable/12/sys/riscv/include/riscvreg.h Sun May 10 00:28:43 2020 (r360861)
+++ stable/12/sys/riscv/include/riscvreg.h Sun May 10 00:34:09 2020 (r360862)
@@ -72,8 +72,11 @@
#define SSTATUS_XS_SHIFT 15
#define SSTATUS_XS_MASK (0x3 << SSTATUS_XS_SHIFT)
#define SSTATUS_SUM (1 << 18)
-#define SSTATUS32_SD (1 << 63)
-#define SSTATUS64_SD (1 << 31)
+#if __riscv_xlen == 64
+#define SSTATUS_SD (1ul << 63)
+#else
+#define SSTATUS_SD (1 << 31)
+#endif
#define MSTATUS_UIE (1 << 0)
#define MSTATUS_SIE (1 << 1)
@@ -107,8 +110,11 @@
#define MSTATUS_VM_SV48 10
#define MSTATUS_VM_SV57 11
#define MSTATUS_VM_SV64 12
-#define MSTATUS32_SD (1 << 63)
-#define MSTATUS64_SD (1 << 31)
+#if __riscv_xlen == 64
+#define MSTATUS_SD (1ul << 63)
+#else
+#define MSTATUS_SD (1 << 31)
+#endif
#define MSTATUS_PRV_U 0 /* user */
#define MSTATUS_PRV_S 1 /* supervisor */
More information about the svn-src-all
mailing list