implement cu_va_start and cu_va_arg in AArch64

This commit is contained in:
mykola2312 2022-05-19 03:26:54 +03:00
parent c6be4302a7
commit bc74c09dac
2 changed files with 19 additions and 1 deletions

View file

@ -175,7 +175,23 @@ cu_memtest:
ret ret
cu_va_start: cu_va_start:
stp xzr, x1, [x0], #16
stp x2, x3, [x0], #16
stp x4, x5, [x0], #16
stp x6, x7, [x0], #16
ret ret
cu_va_arg: cu_va_arg:
// x0 - va_list, x1 - index
mov x1, x1, lsl #3
cmp x1, #56
bgt .va_stack
add x0, x0, x1
ldr x0, [x0]
ret
.va_stack:
sub x1, x1, #48
add x0, sp, x1
ldr x0, [x0]
ret ret

View file

@ -5,7 +5,9 @@
#if (CU_ARCH == x86_64) #if (CU_ARCH == x86_64)
# define VA_NUM 6 # define VA_NUM 6
#else #elif (CU_ARCH == AARCH64)
# define VA_NUM 8
#elif
# define VA_NUM 0 # define VA_NUM 0
#endif #endif