Rev 1693 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1693 | 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 | subl %eax, %ecx |
||
11 | cmpl %fs:4, %ecx # check low stack limit |
||
12 | jb 1f |
||
13 | |||
14 | |||
15 | movl %ecx, %esp /* decrement stack */ |
||
16 | movl (%eax), %ecx /* recover saved temp */ |
||
17 | movl 4(%eax), %eax /* recover return address */ |
||
18 | |||
19 | |||
20 | jumping to %eax preserves the cached call-return stack |
||
21 | used by most modern processors. */ |
||
22 | pushl %eax |
||
23 | ret |
||
24 | 1: |
||
25 | int3 #trap to debugger |
||
26 | .ascii "Stack overflow" |
||
27 |