Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1905 serge 1
 
2
        .global __alloca
3
4
 
5
6
 
7
__alloca:
8
        pushl   %ecx            /* save temp */
9
        leal    8(%esp), %ecx   /* point past return addr */
10
        cmpl    $0x1000, %eax   /* > 4k ?*/
11
        jb      Ldone
12
13
 
14
        subl    $0x1000, %ecx           /* yes, move pointer down 4k*/
15
        orl     $0x0, (%ecx)            /* probe there */
16
        subl    $0x1000, %eax           /* decrement count */
17
        cmpl    $0x1000, %eax
18
        ja      Lprobe                  /* and do it again */
19
20
 
21
        subl    %eax, %ecx
22
        orl     $0x0, (%ecx)    /* less than 4k, just peek here */
23
24
 
25
        movl    %ecx, %esp      /* decrement stack */
26
        movl    (%eax), %ecx    /* recover saved temp */
27
        movl    4(%eax), %eax   /* recover return address */
28
29
 
30
           jumping to %eax preserves the cached call-return stack
31
           used by most modern processors.  */
32
        pushl   %eax
33
        ret
34