From 9cadc8cbec34cefd6e550c50a5b3da1d02225f91 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Fri, 11 Apr 2025 09:31:40 -0700 Subject: [PATCH] xtensa: userspace: use ADDX4 to calculate syscall table index When looking for jump address in the syscall table, we need to multiply the syscall ID by 4 before adding the address offset of the beginning of the table. This is due to the jump address being 32-bit (4 bytes). Instead of using two instructions to shift the ID by 4 first and then the addition, we can use one ADDX4 instruction to achieve the same result. Signed-off-by: Daniel Leung --- arch/xtensa/core/userspace.S | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/xtensa/core/userspace.S b/arch/xtensa/core/userspace.S index 56888ef048f..be143ed1f3a 100644 --- a/arch/xtensa/core/userspace.S +++ b/arch/xtensa/core/userspace.S @@ -119,8 +119,7 @@ _not_checking_user_context: _id_ok: /* Find the function handler for the given syscall id. */ movi a3, _k_syscall_table - slli a2, a2, 2 - add a2, a2, a3 + addx4 a2, a2, a3 l32i a2, a2, 0 #if XCHAL_HAVE_THREADPTR