From owner-svn-src-stable-12@freebsd.org Sun May 10 00:34:09 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C85032D32F0; Sun, 10 May 2020 00:34:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49KQ6n4sxhz4VdS; Sun, 10 May 2020 00:34:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A26D7247EB; Sun, 10 May 2020 00:34:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 04A0Y9C2071142; Sun, 10 May 2020 00:34:09 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 04A0Y92J071141; Sun, 10 May 2020 00:34:09 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202005100034.04A0Y92J071141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sun, 10 May 2020 00:34:09 +0000 (UTC) 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 X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/sys/riscv/include X-SVN-Commit-Revision: 360862 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.32 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2020 00:34:09 -0000 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 */