Skip to content

Commit 9cadc8c

Browse files
dcpleungkartben
authored andcommitted
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 <daniel.leung@intel.com>
1 parent 277fa9e commit 9cadc8c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

arch/xtensa/core/userspace.S

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ _not_checking_user_context:
119119
_id_ok:
120120
/* Find the function handler for the given syscall id. */
121121
movi a3, _k_syscall_table
122-
slli a2, a2, 2
123-
add a2, a2, a3
122+
addx4 a2, a2, a3
124123
l32i a2, a2, 0
125124

126125
#if XCHAL_HAVE_THREADPTR

0 commit comments

Comments
 (0)