arm64: uaccess: simplify __uaccess_mask_ptr()

Since commit:

  3d2403fd10a1dbb3 ("arm64: uaccess: remove set_fs()")

... we no loner use the uaccess primitives to access kernel memory, and
the address limit checks only need to verify that addresses fall below
TASK_SIZE_MAX, which is a constant and a power-of-two.

Currently, __task_size_max() takes `TASK_SIZE_MAX - 1` as an input
register operand, so it can check a pointer falls below this limit by
testing the high bits of the poitner with:

| BICS	XZR, %[untagged_addr], %[TASK_SIZE_MAX - 1]

We can instead take `~(TASK_SIZE_MAX - 1)` as an input immediate
operand, and perform an equivalent check with:

| TST	%[untagged addr], #~(TASK_SIZE_MAX - 1)

... which avoids the need for the compiler to allocate a register and
fill it with `TASK_SIZE_MAX - 1`, and gives more freedom w.r.t. codegen.

This patch asjusts __uaccess_mask_ptr() to use `TST` as above.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Will Deacon <will@kernel.org>
1 file changed