Commit 4a3f806e authored by Mark Rutland's avatar Mark Rutland Committed by Will Deacon

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: default avatarMark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20230314153700.787701-4-mark.rutland@arm.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
parent 39c8275d
...@@ -327,7 +327,7 @@ do { \ ...@@ -327,7 +327,7 @@ do { \
"2:\n" \ "2:\n" \
_ASM_EXTABLE_##type##ACCESS_ERR(1b, 2b, %w0) \ _ASM_EXTABLE_##type##ACCESS_ERR(1b, 2b, %w0) \
: "+r" (err) \ : "+r" (err) \
: "r" (x), "r" (addr)) : "rZ" (x), "r" (addr))
#define __raw_put_mem(str, x, ptr, err, type) \ #define __raw_put_mem(str, x, ptr, err, type) \
do { \ do { \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment