[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 1/6] xen/arm: smccc-1.1: Make return values unsigned long



On Tue, 25 Sep 2018, Julien Grall wrote:
> From: Marc Zyngier <marc.zyngier@xxxxxxx>
> 
> An unfortunate consequence of having a strong typing for the input
> values to the SMC call is that it also affects the type of the
> return values, limiting r0 to 32 bits and r{1,2,3} to whatever
> was passed as an input.
> 
> Let's turn everything into "unsigned long", which satisfies the
> requirements of both architectures, and allows for the full
> range of return values.
> 
> Reported-by: Stefano Stabellini <stefanos@xxxxxxxxxx>
> Signed-off-by: Marc Zyngier <marc.zyngier@xxxxxxx>
> Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
> Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>

Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>


> ---
>     Changes in v2:
>         - Add Volodymyr reviewed-by
> ---
>  xen/include/asm-arm/smccc.h | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/xen/include/asm-arm/smccc.h b/xen/include/asm-arm/smccc.h
> index 74c13f8419..a31d67a1de 100644
> --- a/xen/include/asm-arm/smccc.h
> +++ b/xen/include/asm-arm/smccc.h
> @@ -119,35 +119,35 @@ struct arm_smccc_res {
>  
>  #define __declare_arg_0(a0, res)                        \
>      struct arm_smccc_res    *___res = res;              \
> -    register uin32_t        r0 asm("r0") = a0;          \
> +    register unsigned long  r0 asm("r0") = (uint32_t)a0;\
>      register unsigned long  r1 asm("r1");               \
>      register unsigned long  r2 asm("r2");               \
>      register unsigned long  r3 asm("r3")
>  
>  #define __declare_arg_1(a0, a1, res)                    \
>      struct arm_smccc_res    *___res = res;              \
> -    register uint32_t       r0 asm("r0") = a0;          \
> -    register typeof(a1)     r1 asm("r1") = a1;          \
> +    register unsigned long  r0 asm("r0") = (uint32_t)a0;\
> +    register unsigned long  r1 asm("r1") = a1;          \
>      register unsigned long  r2 asm("r2");               \
>      register unsigned long  r3 asm("r3")
>  
>  #define __declare_arg_2(a0, a1, a2, res)                \
>      struct arm_smccc_res    *___res = res;                           \
> -    register u32            r0 asm("r0") = a0;          \
> -    register typeof(a1)     r1 asm("r1") = a1;          \
> -    register typeof(a2)     r2 asm("r2") = a2;          \
> +    register unsigned long  r0 asm("r0") = (uint32_t)a0;\
> +    register unsigned long  r1 asm("r1") = a1;          \
> +    register unsigned long  r2 asm("r2") = a2;          \
>      register unsigned long  r3 asm("r3")
>  
>  #define __declare_arg_3(a0, a1, a2, a3, res)            \
>      struct arm_smccc_res    *___res = res;              \
> -    register u32            r0 asm("r0") = a0;          \
> -    register typeof(a1)     r1 asm("r1") = a1;          \
> -    register typeof(a2)     r2 asm("r2") = a2;          \
> -    register typeof(a3)     r3 asm("r3") = a3
> +    register unsigned long  r0 asm("r0") = (uint32_t)a0;\
> +    register unsigned long  r1 asm("r1") = a1;          \
> +    register unsigned long  r2 asm("r2") = a2;          \
> +    register unsigned long  r3 asm("r3") = a3
>  
>  #define __declare_arg_4(a0, a1, a2, a3, a4, res)        \
>      __declare_arg_3(a0, a1, a2, a3, res);               \
> -    register typeof(a4) r4 asm("r4") = a4
> +    register unsigned long r4 asm("r4") = a4
>  
>  #define __declare_arg_5(a0, a1, a2, a3, a4, a5, res)    \
>      __declare_arg_4(a0, a1, a2, a3, a4, res);           \
> -- 
> 2.11.0
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.