Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Jan 2020 15:50:48 +0000 (UTC)
From:      Mitchell Horne <mhorne@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r357255 - head/sys/riscv/include
Message-ID:  <202001291550.00TFomHu087892@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001291550.00TFomHu087892>