Skip to content

Commit

Permalink
arch: arm: aarch32: Fix syscall inline asm
Browse files Browse the repository at this point in the history
The inline asm code was not conveying in all cases that registers r1-r3
would get clobbered by the SVC handler code.  In the cases that we can't
list r1-r3 in the clobber list the registers need to show up as outputs
to know that they values are not preserved by the callee.

Fixes zephyrproject-rtos#30393

Signed-off-by: Kumar Gala <[email protected]>
  • Loading branch information
galak committed Jan 14, 2021
1 parent 129ddfe commit b49fa2b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions include/arch/arm/aarch32/syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static inline uintptr_t arch_syscall_invoke6(uintptr_t arg1, uintptr_t arg2,
register uint32_t r6 __asm__("r6") = call_id;

__asm__ volatile("svc %[svid]\n"
: "=r"(ret)
: "=r"(ret), "=r"(r1), "=r"(r2), "=r"(r3)
: [svid] "i" (_SVC_CALL_SYSTEM_CALL),
"r" (ret), "r" (r1), "r" (r2), "r" (r3),
"r" (r4), "r" (r5), "r" (r6)
Expand All @@ -72,7 +72,7 @@ static inline uintptr_t arch_syscall_invoke5(uintptr_t arg1, uintptr_t arg2,
register uint32_t r6 __asm__("r6") = call_id;

__asm__ volatile("svc %[svid]\n"
: "=r"(ret)
: "=r"(ret), "=r"(r1), "=r"(r2), "=r"(r3)
: [svid] "i" (_SVC_CALL_SYSTEM_CALL),
"r" (ret), "r" (r1), "r" (r2), "r" (r3),
"r" (r4), "r" (r6)
Expand All @@ -92,7 +92,7 @@ static inline uintptr_t arch_syscall_invoke4(uintptr_t arg1, uintptr_t arg2,
register uint32_t r6 __asm__("r6") = call_id;

__asm__ volatile("svc %[svid]\n"
: "=r"(ret)
: "=r"(ret), "=r"(r1), "=r"(r2), "=r"(r3)
: [svid] "i" (_SVC_CALL_SYSTEM_CALL),
"r" (ret), "r" (r1), "r" (r2), "r" (r3),
"r" (r6)
Expand All @@ -111,7 +111,7 @@ static inline uintptr_t arch_syscall_invoke3(uintptr_t arg1, uintptr_t arg2,
register uint32_t r6 __asm__("r6") = call_id;

__asm__ volatile("svc %[svid]\n"
: "=r"(ret)
: "=r"(ret), "=r"(r1), "=r"(r2)
: [svid] "i" (_SVC_CALL_SYSTEM_CALL),
"r" (ret), "r" (r1), "r" (r2), "r" (r6)
: "r8", "memory", "r3", "ip");
Expand All @@ -127,7 +127,7 @@ static inline uintptr_t arch_syscall_invoke2(uintptr_t arg1, uintptr_t arg2,
register uint32_t r6 __asm__("r6") = call_id;

__asm__ volatile("svc %[svid]\n"
: "=r"(ret)
: "=r"(ret), "=r"(r1)
: [svid] "i" (_SVC_CALL_SYSTEM_CALL),
"r" (ret), "r" (r1), "r" (r6)
: "r8", "memory", "r2", "r3", "ip");
Expand Down

0 comments on commit b49fa2b

Please sign in to comment.