Fix netbsd build
[tinycc.git] / lib / alloca86.S
blob426c67da8ecb59ab34c48de142bdcb14b261a349
1 /* ---------------------------------------------- */
2 /* alloca86.S */
4 #ifdef __leading_underscore
5 # define _(s) _##s
6 #else
7 # define _(s) s
8 #endif
10 .globl _(alloca), _(__alloca)
11 _(alloca):
12 _(__alloca):
13     push    %ebp
14     mov     %esp,%ebp
15     mov     8(%ebp),%eax
16     add     $3,%eax
17     and     $-4,%eax
18 #ifdef _WIN32
19     jmp     .+16 #p2
20 p1:
21     sub     $4096,%esp
22     sub     $4096,%eax
23     test    %eax,(%esp)
24 p2:
25     cmp     $4096,%eax
26     jae     p1
27 #endif
28     sub     %eax,%esp
29     mov     4(%ebp),%eax
30     mov     0(%ebp),%ebp
31     add     $8,%esp
32     push    %eax
33     lea     8(%esp),%eax
34     ret
36 /* ---------------------------------------------- */