Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1873 | serge | 1 | |
2 | .global __alloca |
||
3 | |||
4 | |||
5 | |||
6 | |||
7 | ___chkstk: |
||
8 | __alloca: |
||
9 | pushl %ecx /* save temp */ |
||
10 | leal 8(%esp), %ecx /* point past return addr */ |
||
11 | subl %eax, %ecx |
||
12 | call *__imp__GetStackBase |
||
13 | cmpl %eax, %ecx # check low stack limit |
||
14 | jb 1f |
||
15 | |||
16 | |||
17 | movl %ecx, %esp /* decrement stack */ |
||
18 | movl (%eax), %ecx /* recover saved temp */ |
||
19 | movl 4(%eax), %eax /* recover return address */ |
||
20 | |||
21 | |||
22 | jumping to %eax preserves the cached call-return stack |
||
23 | used by most modern processors. */ |
||
24 | pushl %eax |
||
25 | ret |
||
26 | 1: |
||
27 | int3 #trap to debugger. |
||
28 | #Oh wait... there is no kernel debugger |
||
29 | .ascii "Stack overflow" |
||
30 |