2009-06-08 22:23:08 +04:00
|
|
|
/* ---------------------------------------------- */
|
|
|
|
/* alloca86_64.S */
|
|
|
|
|
|
|
|
.globl alloca
|
|
|
|
|
|
|
|
alloca:
|
|
|
|
pop %rdx
|
2017-07-23 22:24:11 +03:00
|
|
|
#ifdef _WIN32
|
2009-07-19 00:06:54 +04:00
|
|
|
mov %rcx,%rax
|
|
|
|
#else
|
2009-06-08 22:23:08 +04:00
|
|
|
mov %rdi,%rax
|
2009-07-19 00:06:54 +04:00
|
|
|
#endif
|
2009-06-11 03:33:41 +04:00
|
|
|
add $15,%rax
|
|
|
|
and $-16,%rax
|
2009-06-08 22:23:08 +04:00
|
|
|
jz p3
|
|
|
|
|
2017-07-23 22:24:11 +03:00
|
|
|
#ifdef _WIN32
|
2009-06-08 22:23:08 +04:00
|
|
|
p1:
|
|
|
|
cmp $4096,%rax
|
2014-07-11 04:41:51 +04:00
|
|
|
jbe p2
|
2014-07-10 08:37:20 +04:00
|
|
|
test %rax,-4096(%rsp)
|
2009-06-08 22:23:08 +04:00
|
|
|
sub $4096,%rsp
|
|
|
|
sub $4096,%rax
|
|
|
|
jmp p1
|
|
|
|
p2:
|
|
|
|
#endif
|
|
|
|
sub %rax,%rsp
|
|
|
|
mov %rsp,%rax
|
|
|
|
p3:
|
|
|
|
push %rdx
|
|
|
|
ret
|
|
|
|
|
|
|
|
/* ---------------------------------------------- */
|