Skip to content

Commit 1d8f574

Browse files
Marc Zyngierwildea01
authored andcommitted
arm/arm64: smccc-1.1: Make return values unsigned long
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: Julien Grall <julien.grall@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent afce0cc commit 1d8f574

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

include/linux/arm-smccc.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,31 +199,31 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1,
199199

200200
#define __declare_arg_0(a0, res) \
201201
struct arm_smccc_res *___res = res; \
202-
register u32 r0 asm("r0") = a0; \
202+
register unsigned long r0 asm("r0") = (u32)a0; \
203203
register unsigned long r1 asm("r1"); \
204204
register unsigned long r2 asm("r2"); \
205205
register unsigned long r3 asm("r3")
206206

207207
#define __declare_arg_1(a0, a1, res) \
208208
struct arm_smccc_res *___res = res; \
209-
register u32 r0 asm("r0") = a0; \
210-
register typeof(a1) r1 asm("r1") = a1; \
209+
register unsigned long r0 asm("r0") = (u32)a0; \
210+
register unsigned long r1 asm("r1") = a1; \
211211
register unsigned long r2 asm("r2"); \
212212
register unsigned long r3 asm("r3")
213213

214214
#define __declare_arg_2(a0, a1, a2, res) \
215215
struct arm_smccc_res *___res = res; \
216-
register u32 r0 asm("r0") = a0; \
217-
register typeof(a1) r1 asm("r1") = a1; \
218-
register typeof(a2) r2 asm("r2") = a2; \
216+
register unsigned long r0 asm("r0") = (u32)a0; \
217+
register unsigned long r1 asm("r1") = a1; \
218+
register unsigned long r2 asm("r2") = a2; \
219219
register unsigned long r3 asm("r3")
220220

221221
#define __declare_arg_3(a0, a1, a2, a3, res) \
222222
struct arm_smccc_res *___res = res; \
223-
register u32 r0 asm("r0") = a0; \
224-
register typeof(a1) r1 asm("r1") = a1; \
225-
register typeof(a2) r2 asm("r2") = a2; \
226-
register typeof(a3) r3 asm("r3") = a3
223+
register unsigned long r0 asm("r0") = (u32)a0; \
224+
register unsigned long r1 asm("r1") = a1; \
225+
register unsigned long r2 asm("r2") = a2; \
226+
register unsigned long r3 asm("r3") = a3
227227

228228
#define __declare_arg_4(a0, a1, a2, a3, a4, res) \
229229
__declare_arg_3(a0, a1, a2, a3, res); \

0 commit comments

Comments
 (0)