2015-04-10 15:17:22 +03:00
|
|
|
/* ---------------------------------------------- */
|
|
|
|
/* alloca86_64.S */
|
|
|
|
|
|
|
|
.globl __bound_alloca
|
|
|
|
__bound_alloca:
|
|
|
|
|
2017-07-23 22:24:11 +03:00
|
|
|
#ifdef _WIN32
|
2015-04-10 15:17:22 +03:00
|
|
|
# bound checking is not implemented
|
|
|
|
pop %rdx
|
|
|
|
mov %rcx,%rax
|
|
|
|
add $15,%rax
|
|
|
|
and $-16,%rax
|
|
|
|
jz p3
|
|
|
|
|
|
|
|
p1:
|
|
|
|
cmp $4096,%rax
|
|
|
|
jbe p2
|
|
|
|
test %rax,-4096(%rsp)
|
|
|
|
sub $4096,%rsp
|
|
|
|
sub $4096,%rax
|
|
|
|
jmp p1
|
|
|
|
p2:
|
|
|
|
|
|
|
|
sub %rax,%rsp
|
|
|
|
mov %rsp,%rax
|
|
|
|
add $32,%rax
|
|
|
|
|
|
|
|
p3:
|
|
|
|
push %rdx
|
|
|
|
ret
|
|
|
|
#else
|
|
|
|
pop %rdx
|
|
|
|
mov %rdi,%rax
|
2016-10-01 21:47:36 +03:00
|
|
|
mov %rax,%rsi # size, a second parm to the __bound_new_region
|
2015-04-10 15:17:22 +03:00
|
|
|
|
|
|
|
add $15,%rax
|
|
|
|
and $-16,%rax
|
|
|
|
jz p3
|
|
|
|
|
|
|
|
|
|
|
|
sub %rax,%rsp
|
|
|
|
mov %rsp,%rdi # pointer, a first parm to the __bound_new_region
|
|
|
|
mov %rsp,%rax
|
|
|
|
|
|
|
|
push %rdx
|
|
|
|
push %rax
|
|
|
|
call __bound_new_region
|
|
|
|
pop %rax
|
|
|
|
pop %rdx
|
|
|
|
|
|
|
|
p3:
|
|
|
|
push %rdx
|
|
|
|
ret
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* ---------------------------------------------- */
|