2009-06-08 22:23:08 +04:00
|
|
|
/* ---------------------------------------------- */
|
|
|
|
/* alloca86_64.S */
|
|
|
|
|
|
|
|
.globl alloca
|
|
|
|
|
|
|
|
alloca:
|
|
|
|
pop %rdx
|
2009-07-19 00:06:54 +04:00
|
|
|
#ifdef TCC_TARGET_PE
|
|
|
|
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
|
|
|
|
|
|
|
|
#ifdef TCC_TARGET_PE
|
|
|
|
p1:
|
|
|
|
cmp $4096,%rax
|
|
|
|
jle p2
|
|
|
|
sub $4096,%rsp
|
|
|
|
sub $4096,%rax
|
|
|
|
test %rax,(%rsp)
|
|
|
|
jmp p1
|
|
|
|
p2:
|
|
|
|
#endif
|
|
|
|
|
|
|
|
sub %rax,%rsp
|
|
|
|
mov %rsp,%rax
|
2009-07-19 00:06:54 +04:00
|
|
|
#ifdef TCC_TARGET_PE
|
|
|
|
add $32,%rax
|
|
|
|
#endif
|
|
|
|
|
2009-06-08 22:23:08 +04:00
|
|
|
p3:
|
|
|
|
push %rdx
|
|
|
|
ret
|
|
|
|
|
2011-01-04 11:38:52 +03:00
|
|
|
/* mark stack as nonexecutable */
|
|
|
|
#if defined __ELF__ && defined __linux__
|
|
|
|
.section .note.GNU-stack,"",@progbits
|
|
|
|
#endif
|
2009-06-08 22:23:08 +04:00
|
|
|
/* ---------------------------------------------- */
|