Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Jan 2020 13:17:41 -0800
From:      Conrad Meyer <cem@freebsd.org>
To:        John Baldwin <jhb@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>,  svn-src-head <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r357337 - head/sys/riscv/include
Message-ID:  <CAG6CVpX53GHOBiB8h7QqSXpo%2BwmP81Nf1Uh__NPB60wGuLE2NA@mail.gmail.com>
In-Reply-To: <202001311749.00VHnFb7090545@repo.freebsd.org>
References:  <202001311749.00VHnFb7090545@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi John,

Isn't the 32-bit MSTATUS_SD and SSTATUS_SD also UB without explicit
unsigned suffix?

Best,
Conrad

On Fri, Jan 31, 2020 at 9:49 AM John Baldwin <jhb@freebsd.org> wrote:
>
> Author: jhb
> Date: Fri Jan 31 17:49:15 2020
> New Revision: 357337
> URL: https://svnweb.freebsd.org/changeset/base/357337
>
> Log:
>   Fix 64-bit value of SSTATUS_SD to use an unsigned long.
>
>   While here, fix MSTATUS_SD to match SSTATUS_SD.
>
>   Reviewed by:  mhorne
>   MFC after:    2 weeks
>   Sponsored by: DARPA
>   Differential Revision:        https://reviews.freebsd.org/D23434
>
> Modified:
>   head/sys/riscv/include/riscvreg.h
>
> Modified: head/sys/riscv/include/riscvreg.h
> ==============================================================================
> --- head/sys/riscv/include/riscvreg.h   Fri Jan 31 17:40:41 2020        (r357336)
> +++ head/sys/riscv/include/riscvreg.h   Fri Jan 31 17:49:15 2020        (r357337)
> @@ -73,7 +73,7 @@
>  #define        SSTATUS_XS_MASK                 (0x3 << SSTATUS_XS_SHIFT)
>  #define        SSTATUS_SUM                     (1 << 18)
>  #if __riscv_xlen == 64
> -#define        SSTATUS_SD                      (1 << 63)
> +#define        SSTATUS_SD                      (1ul << 63)
>  #else
>  #define        SSTATUS_SD                      (1 << 31)
>  #endif
> @@ -110,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?CAG6CVpX53GHOBiB8h7QqSXpo%2BwmP81Nf1Uh__NPB60wGuLE2NA>