Date: Sun, 10 May 2020 00:34:09 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r360862 - stable/12/sys/riscv/include Message-ID: <202005100034.04A0Y92J071141@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005100034.04A0Y92J071141>