mirror of
https://github.com/frida/tinycc
synced 2024-12-19 03:42:33 +03:00
5d2f4cb403
* alloca needs to be _alloca * int64_t and uint64_t are also defined in <sys/_types/_int64_t.h> but as long long, not as long, so adjust out <stddef.h> to agree on Darwin * define __APPLE_CC__ so that <TargetConditionals.h> correctly defines various macros like TARGET_OS_MAC and TARGET_CPU_X86_64
37 lines
571 B
ArmAsm
37 lines
571 B
ArmAsm
/* ---------------------------------------------- */
|
|
/* alloca86_64.S */
|
|
|
|
#ifdef __APPLE__
|
|
#define alloca _alloca
|
|
#endif
|
|
.globl alloca
|
|
|
|
alloca:
|
|
pop %rdx
|
|
#ifdef _WIN32
|
|
mov %rcx,%rax
|
|
#else
|
|
mov %rdi,%rax
|
|
#endif
|
|
add $15,%rax
|
|
and $-16,%rax
|
|
jz p3
|
|
|
|
#ifdef _WIN32
|
|
p1:
|
|
cmp $4096,%rax
|
|
jbe p2
|
|
test %rax,-4096(%rsp)
|
|
sub $4096,%rsp
|
|
sub $4096,%rax
|
|
jmp p1
|
|
p2:
|
|
#endif
|
|
sub %rax,%rsp
|
|
mov %rsp,%rax
|
|
p3:
|
|
push %rdx
|
|
ret
|
|
|
|
/* ---------------------------------------------- */
|