Skip to content

Commit 4a3f806

Browse files
mrutland-armwilldeacon
authored andcommitted
arm64: uaccess: permit put_{user,kernel} to use zero register
Currently the asm constraints for __put_mem_asm() require that the value is placed in a "real" GPR (i.e. one other than [XW]ZR or SP). This means that for cases such as: __put_user(0, addr) ... the compiler has to move '0' into "real" GPR, e.g. mov xN, #0 sttr xN, [<addr>] This is unfortunate, as using the zero register would require fewer instructions and save a "real" GPR for other usage, allowing the compiler to generate: sttr xzr, [<addr>] Modify the asm constaints for __put_mem_asm() to permit the use of the zero register for the value. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Robin Murphy <[email protected]> Cc: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 39c8275 commit 4a3f806

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arm64/include/asm/uaccess.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ do { \
327327
"2:\n" \
328328
_ASM_EXTABLE_##type##ACCESS_ERR(1b, 2b, %w0) \
329329
: "+r" (err) \
330-
: "r" (x), "r" (addr))
330+
: "rZ" (x), "r" (addr))
331331

332332
#define __raw_put_mem(str, x, ptr, err, type) \
333333
do { \

0 commit comments

Comments
 (0)