copy_template currently copies the destination pointer to x6 then operates on that copy, while it directly operates on the source pointer (x1). In both cases a copy of the original pointer is required for the final fixup in copy_*_user, but not in copy_template itself.
Make things a little easier to follow by saving both pointers in copy_*_user, letting copy_template operate on the original pointers (x0 and x1) directly.
While at it, remove the "Returns" comment in copy_template, which is irrelevant.
Signed-off-by: Kevin Brodsky kevin.brodsky@arm.com --- arch/arm64/lib/copy_from_user.S | 2 ++ arch/arm64/lib/copy_template.S | 6 +----- arch/arm64/lib/copy_to_user.S | 2 ++ 3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/arm64/lib/copy_from_user.S b/arch/arm64/lib/copy_from_user.S index 2445663b4466..46dc57cd8d34 100644 --- a/arch/arm64/lib/copy_from_user.S +++ b/arch/arm64/lib/copy_from_user.S @@ -65,9 +65,11 @@ .endm
end .req x5 +dstin .req x6 srcin .req x15 SYM_FUNC_START(COPY_FUNC_NAME) add end, x0, x2 + mov dstin, x0 mov srcin, x1 #include "copy_template.S" mov x0, #0 // Nothing to copy diff --git a/arch/arm64/lib/copy_template.S b/arch/arm64/lib/copy_template.S index ace9f2dde856..1c54c338d078 100644 --- a/arch/arm64/lib/copy_template.S +++ b/arch/arm64/lib/copy_template.S @@ -18,17 +18,14 @@ * x0 - dest * x1 - src * x2 - n - * Returns: - * x0 - dest */ -dstin .req x0 +dst .req x0 src .req x1 count .req x2 tmp1 .req x3 tmp1w .req w3 tmp2 .req x4 tmp2w .req w4 -dst .req x6
A_l .req x7 A_h .req x8 @@ -49,7 +46,6 @@ Bc_l .req c9 Bc_h .req c10 #endif
- mov dst, dstin cmp count, #16 /*When memory length is less than 16, the accessed are not aligned.*/ b.lo .Ltiny15 diff --git a/arch/arm64/lib/copy_to_user.S b/arch/arm64/lib/copy_to_user.S index 9f6aed913750..a501e7665e77 100644 --- a/arch/arm64/lib/copy_to_user.S +++ b/arch/arm64/lib/copy_to_user.S @@ -64,9 +64,11 @@ .endm
end .req x5 +dstin .req x6 srcin .req x15 SYM_FUNC_START(COPY_FUNC_NAME) add end, x0, x2 + mov dstin, x0 mov srcin, x1 #include "copy_template.S" mov x0, #0