Author: mhorne
Date: Wed Jan 29 15:50:48 2020
New Revision: 357255
URL: https://svnweb.freebsd.org/changeset/base/357255

Log:
  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.
  
  Reviewed by:  br
  MFC after:    3 days
  Differential Revision:        https://reviews.freebsd.org/D23402

Modified:
  head/sys/riscv/include/riscvreg.h

Modified: head/sys/riscv/include/riscvreg.h
==============================================================================
--- head/sys/riscv/include/riscvreg.h   Wed Jan 29 12:10:42 2020        
(r357254)
+++ head/sys/riscv/include/riscvreg.h   Wed Jan 29 15:50:48 2020        
(r357255)
@@ -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                      (1 << 63)
+#else
+#define        SSTATUS_SD                      (1 << 31)
+#endif
 
 #define        MSTATUS_UIE                     (1 << 0)
 #define        MSTATUS_SIE                     (1 << 1)
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to