From 219bfa538d69dee2c109c85659715b74e387c26a Mon Sep 17 00:00:00 2001 From: mykola2312 <49044616+mykola2312@users.noreply.github.com> Date: Thu, 19 May 2022 01:04:20 +0300 Subject: [PATCH] implement _cu_memmove in AArch64 --- arch/AArch64.S | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/arch/AArch64.S b/arch/AArch64.S index 510bb63..9a98e09 100644 --- a/arch/AArch64.S +++ b/arch/AArch64.S @@ -47,6 +47,29 @@ _cu_memcpy: ret _cu_memmove: + // x0 - dst, x1 - src, x2 - size + cmp x0, x1 + beq .move0 + blt .less1 + + add x0, x0, x2 + add x1, x1, x2 + sub x0, x0, #1 + sub x1, x1, #1 +.greater1: + ldrb w3, [x1] + strb w3, [x0] + sub x0, x0, #1 + sub x1, x1, #1 + subs x2, x2, #1 + bne .greater1 + b .move0 +.less1: + ldrb w3, [x1], #1 + strb w3, [x0], #1 + subs x2, x2, #1 + bne .less1 +.move0: ret _cu_memcmp: