From a80088be55ff22a9dae387178d4ed53b2e4be0e5 Mon Sep 17 00:00:00 2001 From: mykola2312 <49044616+mykola2312@users.noreply.github.com> Date: Thu, 19 May 2022 00:53:44 +0300 Subject: [PATCH] implement _cu_memcpy in AArch64 --- arch/AArch64.S | 20 ++++++++++++++++++++ test.c | 1 + 2 files changed, 21 insertions(+) diff --git a/arch/AArch64.S b/arch/AArch64.S index 22265eb..510bb63 100644 --- a/arch/AArch64.S +++ b/arch/AArch64.S @@ -13,6 +13,8 @@ .text hw_bswap16: + rev w0, w0 + mov w0, w0, lsr #16 ret hw_bswap32: @@ -24,6 +26,24 @@ hw_bswap64: ret _cu_memcpy: + // x0 - dst, x1 - src, x2 - size + mov x3, x2, lsr #3 + tst x3, x3 + beq .cpy1_ +.cpy8: + ldr x4, [x1], #8 + str x4, [x0], #8 + subs x3, x3, #1 + bne .cpy8 +.cpy1_: + and x3, x2, #7 + beq .cpy0 +.cpy1: + ldrb w4, [x1], #1 + strb w4, [x0], #1 + subs x3, x3, #1 + bne .cpy1 +.cpy0: ret _cu_memmove: diff --git a/test.c b/test.c index 9eb8ccf..3f4aee3 100644 --- a/test.c +++ b/test.c @@ -53,6 +53,7 @@ u8 internal_heap[4096]; int main() { cutil_init(internal_heap, 4096); + printf("[list]\n"); list_t list; list_init(&list);