Get MbedTLS and its unit tests passing AARCH64

This commit is contained in:
Justine Tunney 2023-05-11 21:53:15 -07:00
parent 5e2f7f7ced
commit 4edbc98811
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
37 changed files with 632 additions and 725 deletions

View file

@ -68,7 +68,13 @@ _start:
lea 8(%rsp),%rsi // argv
lea 16(%rsp,%rbx,8),%rdx // envp
mov %rsp,__oldstack(%rip)
and $-16,%rsp
// setup a stack frame
// align stack to GetStackSize() so GetStackAddr() is fast
.weak ape_stack_memsz
mov $ape_stack_memsz,%r8d
neg %r8
and %r8,%rsp
xor %ebp,%ebp
// bofram 9f
@ -107,10 +113,23 @@ _start:
////////////////////////////////////////////////////////////////////////////////
#elif defined(__aarch64__)
// save original stack pointer
// this is the first argument to cosmo() below
mov x0,sp
// setup stack frame
mov x29,#0
mov x30,#0
mov x0,sp
and sp,x0,#-16
// align stack to GetStackSize() so GetStackAddr() is fast
mov x1,sp
.weak ape_stack_memsz
ldr x2,=ape_stack_memsz
neg x2,x2
and x1,x2,x1
mov sp,x1
// switch to c start function
b cosmo
////////////////////////////////////////////////////////////////////////////////