implement cu_memtest in AArch64
This commit is contained in:
parent
dea3141a34
commit
c6be4302a7
2 changed files with 26 additions and 0 deletions
|
|
@ -149,6 +149,29 @@ cu_memzero:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
cu_memtest:
|
cu_memtest:
|
||||||
|
// x0 - src, x1 - size
|
||||||
|
mov x2, x1, lsr #3
|
||||||
|
tst x2, x2
|
||||||
|
beq .test1_
|
||||||
|
.test8:
|
||||||
|
ldr x3, [x0], #8
|
||||||
|
cmp x3, xzr
|
||||||
|
bne .testnot
|
||||||
|
subs x2, x2, #1
|
||||||
|
bne .test8
|
||||||
|
.test1_:
|
||||||
|
and x2, x1, #7
|
||||||
|
beq .testok
|
||||||
|
.test1:
|
||||||
|
ldrb w3, [x0], #1
|
||||||
|
cmp w3, wzr
|
||||||
|
bne .testnot
|
||||||
|
subs x2, x2, #1
|
||||||
|
bne .test1
|
||||||
|
.testok:
|
||||||
|
mov x0, xzr
|
||||||
|
ret
|
||||||
|
.testnot:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
cu_va_start:
|
cu_va_start:
|
||||||
|
|
|
||||||
3
test.c
3
test.c
|
|
@ -163,6 +163,9 @@ int main()
|
||||||
printf("value_offset\t%u\n", value_offset(CU_STRUCT(test_s), 5, &test));
|
printf("value_offset\t%u\n", value_offset(CU_STRUCT(test_s), 5, &test));
|
||||||
printf("value_size\t%u\n", value_size(CU_STRUCT(test_s), 5, &test));
|
printf("value_size\t%u\n", value_size(CU_STRUCT(test_s), 5, &test));
|
||||||
|
|
||||||
|
char c0 = 0;
|
||||||
|
printf("cu_memset\tc0\t%p\n", cu_memtest(&c0, 1));
|
||||||
|
|
||||||
printf("[va_list]\n");
|
printf("[va_list]\n");
|
||||||
va_test(1337, 1, 2, 3, 4, 5);
|
va_test(1337, 1, 2, 3, 4, 5);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue