implement _cu_memcpy in AArch64
This commit is contained in:
parent
9a9c972e24
commit
a80088be55
2 changed files with 21 additions and 0 deletions
|
|
@ -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:
|
||||
|
|
|
|||
1
test.c
1
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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue