* [PATCH] xen/arm: Surround HSR_SYSREG macro value with ()
@ 2017-11-29 17:46 Julien Grall
2017-12-08 15:18 ` Julien Grall
0 siblings, 1 reply; 3+ messages in thread
From: Julien Grall @ 2017-11-29 17:46 UTC (permalink / raw)
To: xen-devel; +Cc: sstabellini, Julien Grall, andre.przywara
The value of the macro HCR_SYSREG is not surrounded by (). This means
the behavior may change depend on how it is used.
Thanksfully recent GCC will issue a warning for that.
Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
I am not aware of any "bad" usage today in Xen. This was found whilst
playing with sysreg emulation and GCC complaining about the missing ().
---
xen/include/asm-arm/arm64/sysregs.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/xen/include/asm-arm/arm64/sysregs.h b/xen/include/asm-arm/arm64/sysregs.h
index 084d2a1e5d..1811234249 100644
--- a/xen/include/asm-arm/arm64/sysregs.h
+++ b/xen/include/asm-arm/arm64/sysregs.h
@@ -32,11 +32,11 @@
/* These are used to decode traps with HSR.EC==HSR_EC_SYSREG */
#define HSR_SYSREG(op0,op1,crn,crm,op2) \
- ((__HSR_SYSREG_##op0) << HSR_SYSREG_OP0_SHIFT) | \
- ((__HSR_SYSREG_##op1) << HSR_SYSREG_OP1_SHIFT) | \
- ((__HSR_SYSREG_##crn) << HSR_SYSREG_CRN_SHIFT) | \
- ((__HSR_SYSREG_##crm) << HSR_SYSREG_CRM_SHIFT) | \
- ((__HSR_SYSREG_##op2) << HSR_SYSREG_OP2_SHIFT)
+ (((__HSR_SYSREG_##op0) << HSR_SYSREG_OP0_SHIFT) | \
+ ((__HSR_SYSREG_##op1) << HSR_SYSREG_OP1_SHIFT) | \
+ ((__HSR_SYSREG_##crn) << HSR_SYSREG_CRN_SHIFT) | \
+ ((__HSR_SYSREG_##crm) << HSR_SYSREG_CRM_SHIFT) | \
+ ((__HSR_SYSREG_##op2) << HSR_SYSREG_OP2_SHIFT))
#define HSR_SYSREG_DCISW HSR_SYSREG(1,0,c7,c6,2)
#define HSR_SYSREG_DCCSW HSR_SYSREG(1,0,c7,c10,2)
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xen/arm: Surround HSR_SYSREG macro value with ()
2017-11-29 17:46 [PATCH] xen/arm: Surround HSR_SYSREG macro value with () Julien Grall
@ 2017-12-08 15:18 ` Julien Grall
2017-12-08 21:18 ` Stefano Stabellini
0 siblings, 1 reply; 3+ messages in thread
From: Julien Grall @ 2017-12-08 15:18 UTC (permalink / raw)
To: xen-devel; +Cc: sstabellini, andre.przywara
Hi,
Ping?
Cheers,
On 29/11/17 17:46, Julien Grall wrote:
> The value of the macro HCR_SYSREG is not surrounded by (). This means
> the behavior may change depend on how it is used.
>
> Thanksfully recent GCC will issue a warning for that.
>
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>
> ---
>
> I am not aware of any "bad" usage today in Xen. This was found whilst
> playing with sysreg emulation and GCC complaining about the missing ().
> ---
> xen/include/asm-arm/arm64/sysregs.h | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/xen/include/asm-arm/arm64/sysregs.h b/xen/include/asm-arm/arm64/sysregs.h
> index 084d2a1e5d..1811234249 100644
> --- a/xen/include/asm-arm/arm64/sysregs.h
> +++ b/xen/include/asm-arm/arm64/sysregs.h
> @@ -32,11 +32,11 @@
>
> /* These are used to decode traps with HSR.EC==HSR_EC_SYSREG */
> #define HSR_SYSREG(op0,op1,crn,crm,op2) \
> - ((__HSR_SYSREG_##op0) << HSR_SYSREG_OP0_SHIFT) | \
> - ((__HSR_SYSREG_##op1) << HSR_SYSREG_OP1_SHIFT) | \
> - ((__HSR_SYSREG_##crn) << HSR_SYSREG_CRN_SHIFT) | \
> - ((__HSR_SYSREG_##crm) << HSR_SYSREG_CRM_SHIFT) | \
> - ((__HSR_SYSREG_##op2) << HSR_SYSREG_OP2_SHIFT)
> + (((__HSR_SYSREG_##op0) << HSR_SYSREG_OP0_SHIFT) | \
> + ((__HSR_SYSREG_##op1) << HSR_SYSREG_OP1_SHIFT) | \
> + ((__HSR_SYSREG_##crn) << HSR_SYSREG_CRN_SHIFT) | \
> + ((__HSR_SYSREG_##crm) << HSR_SYSREG_CRM_SHIFT) | \
> + ((__HSR_SYSREG_##op2) << HSR_SYSREG_OP2_SHIFT))
>
> #define HSR_SYSREG_DCISW HSR_SYSREG(1,0,c7,c6,2)
> #define HSR_SYSREG_DCCSW HSR_SYSREG(1,0,c7,c10,2)
>
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xen/arm: Surround HSR_SYSREG macro value with ()
2017-12-08 15:18 ` Julien Grall
@ 2017-12-08 21:18 ` Stefano Stabellini
0 siblings, 0 replies; 3+ messages in thread
From: Stefano Stabellini @ 2017-12-08 21:18 UTC (permalink / raw)
To: Julien Grall; +Cc: sstabellini, andre.przywara, xen-devel
On Fri, 8 Dec 2017, Julien Grall wrote:
> Hi,
>
> Ping?
>
> Cheers,
>
> On 29/11/17 17:46, Julien Grall wrote:
> > The value of the macro HCR_SYSREG is not surrounded by (). This means
> > the behavior may change depend on how it is used.
> >
> > Thanksfully recent GCC will issue a warning for that.
> >
> > Signed-off-by: Julien Grall <julien.grall@linaro.org>
reviewed and committed
> > ---
> >
> > I am not aware of any "bad" usage today in Xen. This was found whilst
> > playing with sysreg emulation and GCC complaining about the missing ().
> > ---
> > xen/include/asm-arm/arm64/sysregs.h | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/xen/include/asm-arm/arm64/sysregs.h
> > b/xen/include/asm-arm/arm64/sysregs.h
> > index 084d2a1e5d..1811234249 100644
> > --- a/xen/include/asm-arm/arm64/sysregs.h
> > +++ b/xen/include/asm-arm/arm64/sysregs.h
> > @@ -32,11 +32,11 @@
> > /* These are used to decode traps with HSR.EC==HSR_EC_SYSREG */
> > #define HSR_SYSREG(op0,op1,crn,crm,op2) \
> > - ((__HSR_SYSREG_##op0) << HSR_SYSREG_OP0_SHIFT) | \
> > - ((__HSR_SYSREG_##op1) << HSR_SYSREG_OP1_SHIFT) | \
> > - ((__HSR_SYSREG_##crn) << HSR_SYSREG_CRN_SHIFT) | \
> > - ((__HSR_SYSREG_##crm) << HSR_SYSREG_CRM_SHIFT) | \
> > - ((__HSR_SYSREG_##op2) << HSR_SYSREG_OP2_SHIFT)
> > + (((__HSR_SYSREG_##op0) << HSR_SYSREG_OP0_SHIFT) | \
> > + ((__HSR_SYSREG_##op1) << HSR_SYSREG_OP1_SHIFT) | \
> > + ((__HSR_SYSREG_##crn) << HSR_SYSREG_CRN_SHIFT) | \
> > + ((__HSR_SYSREG_##crm) << HSR_SYSREG_CRM_SHIFT) | \
> > + ((__HSR_SYSREG_##op2) << HSR_SYSREG_OP2_SHIFT))
> > #define HSR_SYSREG_DCISW HSR_SYSREG(1,0,c7,c6,2)
> > #define HSR_SYSREG_DCCSW HSR_SYSREG(1,0,c7,c10,2)
> >
>
> --
> Julien Grall
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-12-08 21:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-29 17:46 [PATCH] xen/arm: Surround HSR_SYSREG macro value with () Julien Grall
2017-12-08 15:18 ` Julien Grall
2017-12-08 21:18 ` Stefano Stabellini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.