Subversion Repositories Kolibri OS

Rev

Rev 2040 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2040 Rev 2827
Line 1... Line 1...
1
.global ___chkstk
1
.global ___chkstk
-
 
2
.global ___chkstk_ms
2
.global __alloca
3
.global __alloca
Line 3... Line 4...
3
 
4
 
Line 4... Line 5...
4
.section .text
5
.section .text
-
 
6
 
5
 
7
#.def	___chkstk;	.scl	2;	.type	32;	.endef
-
 
8
#.def ___chkstk_ms;  .scl  2;  .type 32; .endef
6
#.def	___chkstk;	.scl	2;	.type	32;	.endef 
9
#.def __alloca; .scl  2;  .type 32; .endef
7
#.def	__alloca;	.scl	2;	.type	32;	.endef 
10
 
8
___chkstk:
11
___chkstk:
9
__alloca:
12
__alloca:
10
        pushl   %ecx            /* save temp */
13
        pushl   %ecx            /* save temp */
Line 27... Line 30...
27
        int3                    #trap to debugger
30
        int3                    #trap to debugger
28
        .ascii "Stack overflow"
31
        .ascii "Stack overflow"
29
32
 
Line -... Line 33...
-
 
33
 
-
 
34
___chkstk_ms:
-
 
35
       pushl  %ecx            /* save temp */
-
 
36
       pushl  %eax
-
 
37
       cmpl $0x1000, %eax     /* > 4k ?*/
-
 
38
       leal 12(%esp), %ecx    /* point past return addr */
-
 
39
       jb 2f
-
 
40
 
-
 
41
1:
-
 
42
       subl $0x1000, %ecx     /* yes, move pointer down 4k*/
-
 
43
       cmpl %fs:4, %ecx       /* check low stack limit    */
-
 
44
       jb 3f
-
 
45
 
-
 
46
       orl $0x0, (%ecx)       /* probe there */
-
 
47
       subl $0x1000, %eax     /* decrement count */
-
 
48
       cmpl $0x1000, %eax
-
 
49
       ja 1b                  /* and do it again */
-
 
50
 
-
 
51
2:
-
 
52
       subl %eax, %ecx
-
 
53
       orl $0x0, (%ecx) /* less than 4k, just peek here */
-
 
54
 
-
 
55
       popl %eax
-
 
56
       popl %ecx
-
 
57
       ret
-
 
58
3:
-
 
59
       int3                    #trap to debugger