svn commit: r357337 - head/sys/riscv/include

Conrad Meyer cem at freebsd.org
Fri Jan 31 21:17:55 UTC 2020


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 at 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 */


More information about the svn-src-all mailing list