x86-64: chkstk, alloca

This commit is contained in:
grischka
2009-07-18 22:06:54 +02:00
parent c0fc0fa0c4
commit fc977d56c9
8 changed files with 104 additions and 59 deletions

View File

@ -1,5 +1,5 @@
/* ---------------------------------------------- */
/* alloca86b.S */
/* alloca86-bt.S */
#include "../config.h"

View File

@ -7,13 +7,16 @@
alloca:
pop %rdx
#ifdef TCC_TARGET_PE
mov %rcx,%rax
#else
mov %rdi,%rax
#endif
add $15,%rax
and $-16,%rax
jz p3
#ifdef TCC_TARGET_PE
/* XXX: not tested */
p1:
cmp $4096,%rax
jle p2
@ -26,6 +29,10 @@ p2:
sub %rax,%rsp
mov %rsp,%rax
#ifdef TCC_TARGET_PE
add $32,%rax
#endif
p3:
push %rdx
ret