correct stack depth checking

git-svn-id: svn://kolibrios.org@705 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2008-01-28 16:26:51 +00:00
parent 7ad5e56087
commit 7602a89157
5 changed files with 169 additions and 272 deletions

View File

@ -59,5 +59,5 @@ WFileName
7 7
crt.tgt crt.tgt
0 0
20 32
8 8

View File

@ -1,58 +0,0 @@
;*****************************************************************************
;*
;* Open Watcom Project
;*
;* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
;*
;* ========================================================================
;*
;* This file contains Original Code and/or Modifications of Original
;* Code as defined in and that are subject to the Sybase Open Watcom
;* Public License version 1.0 (the 'License'). You may not use this file
;* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
;* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
;* provided with the Original Code and Modifications, and is also
;* available at www.sybase.com/developer/opensource.
;*
;* The Original Code and all software distributed under the License are
;* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
;* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
;* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
;* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
;* NON-INFRINGEMENT. Please see the License for the specific language
;* governing rights and limitations under the License.
;*
;* ========================================================================
;*
;* Description: WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
;* DESCRIBE IT HERE!
;*
;*****************************************************************************
include mdef.inc
include struct.inc
xref __STK
modstart chk
xdefp __CHK
xdefp __GRO
defp __CHK
xchg eax,4[esp]
call __STK
mov eax,4[esp]
ret 4
endproc __CHK
defp __GRO
ret 4
endproc __GRO
endmod
end

View File

@ -34,35 +34,8 @@
#include "stacklow.h" #include "stacklow.h"
#include "exitwmsg.h" #include "exitwmsg.h"
#if defined(__AXP__) || defined(__PPC__)
void _init_stk( void )
{
}
_WCRTLINK unsigned __CHK( unsigned i )
{
return( i );
}
_WCRTLINK void __GRO( unsigned i )
{
i = i;
}
_WCRTLINK void __STKOVERFLOW( void )
{
__fatal_runtime_error( "stack overflow", -1 );
}
#endif
_WCRTLINK unsigned stackavail() _WCRTLINK unsigned stackavail()
{ {
#if defined(__AXP__) || defined(__PPC__)
unsigned _SP;
_SP = (unsigned)&_SP;
return( _SP - _RWD_stacklow );
#else
return( _SP() - _RWD_stacklow ); return( _SP() - _RWD_stacklow );
#endif
} }

View File

@ -68,7 +68,7 @@ msg db "Stack Overflow!", 0dh, 0ah, 0
_quif ae ; - ... _quif ae ; - ...
sub eax,esp ; - calculate new low point sub eax,esp ; - calculate new low point
neg eax ; - calc what new SP would be neg eax ; - calc what new SP would be
cmp eax,_STACKLOW ; - quit if too much cmp eax,[_STACKLOW] ; - quit if too much
_quif be ; - ... _quif be ; - ...
call __GRO ; - return call __GRO ; - return
ret ret

View File

@ -51,7 +51,7 @@ WVList
0 0
13 13
WPickList WPickList
35 34
14 14
MItem MItem
5 5
@ -178,8 +178,8 @@ WVList
0 0
44 44
MItem MItem
16 19
CLIB\CRT\chk.asm CLIB\CRT\cmodel.asm
45 45
WString WString
6 6
@ -196,8 +196,8 @@ WVList
0 0
48 48
MItem MItem
19 20
CLIB\CRT\cmodel.asm CLIB\CRT\crwd386.asm
49 49
WString WString
6 6
@ -214,8 +214,8 @@ WVList
0 0
52 52
MItem MItem
20 21
CLIB\CRT\crwd386.asm CLIB\CRT\cstrtwnt.asm
53 53
WString WString
6 6
@ -233,7 +233,7 @@ WVList
56 56
MItem MItem
21 21
CLIB\CRT\cstrtwnt.asm CLIB\CRT\segdefns.asm
57 57
WString WString
6 6
@ -251,7 +251,7 @@ WVList
60 60
MItem MItem
21 21
CLIB\CRT\segdefns.asm CLIB\CRT\stjmp386.asm
61 61
WString WString
6 6
@ -268,8 +268,8 @@ WVList
0 0
64 64
MItem MItem
21 19
CLIB\CRT\stjmp386.asm CLIB\CRT\stkwnt.asm
65 65
WString WString
6 6
@ -286,228 +286,228 @@ WVList
0 0
68 68
MItem MItem
19
CLIB\CRT\stkwnt.asm
69
WString
6
ASMOBJ
70
WVList
0
71
WVList
0
14
1
1
0
72
MItem
3 3
*.c *.c
73 69
WString WString
4 4
COBJ COBJ
74 70
WVList WVList
15 15
75 71
MVState MVState
72
WString
3
WCC
73
WString
25
n????Include directories:
1
74
WString
80
$(%watcom)\h;$(%watcom)\h\nt; "E:\Kos\programs\develop\open watcom\trunk\clib\h"
0
75
MRState
76 76
WString WString
3 3
WCC WCC
77 77
WString WString
25
n????Include directories:
1
78
WString
80
$(%watcom)\h;$(%watcom)\h\nt; "E:\Kos\programs\develop\open watcom\trunk\clib\h"
0
79
MRState
80
WString
3
WCC
81
WString
27 27
?????Default byte alignment ?????Default byte alignment
1 1
0 0
82 78
MRState MRState
83 79
WString WString
3 3
WCC WCC
84 80
WString WString
21 21
?????1 byte alignment ?????1 byte alignment
1 1
1 1
85 81
MRState MRState
86 82
WString WString
3 3
WCC WCC
87 83
WString WString
21 21
?????No optimizations ?????No optimizations
1 1
0 0
88 84
MRState MRState
89 85
WString WString
3 3
WCC WCC
90 86
WString WString
24 24
?????Space optimizations ?????Space optimizations
1 1
1 1
91 87
MCState MCState
92 88
WString WString
3 3
WCC WCC
93 89
WString WString
33 33
?????Disable stack depth checking ?????Disable stack depth checking
1 1
1 1
94 90
MCState MCState
95 91
WString WString
3 3
WCC WCC
96 92
WString WString
30 30
?????Call/return optimizations ?????Call/return optimizations
1 1
1 1
97 93
MCState MCState
98 94
WString WString
3 3
WCC WCC
99 95
WString WString
25 25
?????Relax alias checking ?????Relax alias checking
1 1
1 1
100 96
MRState MRState
97
WString
3
WCC
98
WString
21
?????Compiler default
1
0
99
MRState
100
WString
3
WCC
101 101
WString WString
3 21
WCC ?????Compiler default
1
0
102 102
WString MRState
21
?????Compiler default
1
0
103 103
MRState WString
3
WCC
104 104
WString WString
3
WCC
105
WString
21
?????Compiler default
1
0
106
MRState
107
WString
3
WCC
108
WString
37 37
?????In-line Pentium Pro instructions ?????In-line Pentium Pro instructions
1 1
1 1
109 105
MRState MRState
110 106
WString WString
3 3
WCC WCC
111 107
WString WString
21 21
?????Compiler default ?????Compiler default
1 1
0 0
112 108
MRState MRState
113 109
WString WString
3 3
WCC WCC
114 110
WString WString
29 29
?????In-line with coprocessor ?????In-line with coprocessor
1 1
1 1
115 111
MRState MRState
116 112
WString WString
3 3
WCC WCC
117 113
WString WString
21 21
??2??32bit Flat model ??2??32bit Flat model
1 1
0 0
118 114
MRState MRState
119 115
WString WString
3 3
WCC WCC
120 116
WString WString
22 22
??2??32bit Small model ??2??32bit Small model
1 1
1 1
121 117
WVList WVList
0 0
-1 -1
1 1
1 1
0 0
122 118
MItem MItem
17 17
CLIB\CRT\8087cw.c CLIB\CRT\8087cw.c
119
WString
4
COBJ
120
WVList
0
121
WVList
0
68
1
1
0
122
MItem
18
CLIB\CRT\___argc.c
123 123
WString WString
4 4
@ -518,14 +518,14 @@ WVList
125 125
WVList WVList
0 0
72 68
1 1
1 1
0 0
126 126
MItem MItem
18 16
CLIB\CRT\___argc.c CLIB\CRT\_exit.c
127 127
WString WString
4 4
@ -536,14 +536,14 @@ WVList
129 129
WVList WVList
0 0
72 68
1 1
1 1
0 0
130 130
MItem MItem
16 16
CLIB\CRT\_exit.c CLIB\CRT\abort.c
131 131
WString WString
4 4
@ -554,14 +554,14 @@ WVList
133 133
WVList WVList
0 0
72 68
1 1
1 1
0 0
134 134
MItem MItem
16 16
CLIB\CRT\abort.c CLIB\CRT\argcv.c
135 135
WString WString
4 4
@ -572,14 +572,14 @@ WVList
137 137
WVList WVList
0 0
72 68
1 1
1 1
0 0
138 138
MItem MItem
16 17
CLIB\CRT\argcv.c CLIB\CRT\atexit.c
139 139
WString WString
4 4
@ -590,14 +590,14 @@ WVList
141 141
WVList WVList
0 0
72 68
1 1
1 1
0 0
142 142
MItem MItem
17 18
CLIB\CRT\atexit.c CLIB\CRT\binmode.c
143 143
WString WString
4 4
@ -608,14 +608,14 @@ WVList
145 145
WVList WVList
0 0
72 68
1 1
1 1
0 0
146 146
MItem MItem
18 18
CLIB\CRT\binmode.c CLIB\CRT\chk8087.c
147 147
WString WString
4 4
@ -626,14 +626,14 @@ WVList
149 149
WVList WVList
0 0
72 68
1 1
1 1
0 0
150 150
MItem MItem
18 16
CLIB\CRT\chk8087.c CLIB\CRT\cinit.c
151 151
WString WString
4 4
@ -644,14 +644,14 @@ WVList
153 153
WVList WVList
0 0
72 68
1 1
1 1
0 0
154 154
MItem MItem
16 18
CLIB\CRT\cinit.c CLIB\CRT\cmdname.c
155 155
WString WString
4 4
@ -662,14 +662,14 @@ WVList
157 157
WVList WVList
0 0
72 68
1 1
1 1
0 0
158 158
MItem MItem
18 18
CLIB\CRT\cmdname.c CLIB\CRT\commode.c
159 159
WString WString
4 4
@ -680,14 +680,14 @@ WVList
161 161
WVList WVList
0 0
72 68
1 1
1 1
0 0
162 162
MItem MItem
18 17
CLIB\CRT\commode.c CLIB\CRT\cvtbuf.c
163 163
WString WString
4 4
@ -698,14 +698,14 @@ WVList
165 165
WVList WVList
0 0
72 68
1 1
1 1
0 0
166 166
MItem MItem
17 16
CLIB\CRT\cvtbuf.c CLIB\CRT\errno.c
167 167
WString WString
4 4
@ -716,14 +716,14 @@ WVList
169 169
WVList WVList
0 0
72 68
1 1
1 1
0 0
170 170
MItem MItem
16 19
CLIB\CRT\errno.c CLIB\CRT\errnovar.c
171 171
WString WString
4 4
@ -734,14 +734,14 @@ WVList
173 173
WVList WVList
0 0
72 68
1 1
1 1
0 0
174 174
MItem MItem
19 15
CLIB\CRT\errnovar.c CLIB\CRT\exit.c
175 175
WString WString
4 4
@ -752,14 +752,14 @@ WVList
177 177
WVList WVList
0 0
72 68
1 1
1 1
0 0
178 178
MItem MItem
15 18
CLIB\CRT\exit.c CLIB\CRT\fltused.c
179 179
WString WString
4 4
@ -770,14 +770,14 @@ WVList
181 181
WVList WVList
0 0
72 68
1 1
1 1
0 0
182 182
MItem MItem
18 19
CLIB\CRT\fltused.c CLIB\CRT\fpexcept.c
183 183
WString WString
4 4
@ -788,14 +788,14 @@ WVList
185 185
WVList WVList
0 0
72 68
1 1
1 1
0 0
186 186
MItem MItem
19 19
CLIB\CRT\fpexcept.c CLIB\CRT\initargv.c
187 187
WString WString
4 4
@ -806,14 +806,14 @@ WVList
189 189
WVList WVList
0 0
72 68
1 1
1 1
0 0
190 190
MItem MItem
19 19
CLIB\CRT\initargv.c CLIB\CRT\initrtns.c
191 191
WString WString
4 4
@ -824,14 +824,14 @@ WVList
193 193
WVList WVList
0 0
72 68
1 1
1 1
0 0
194 194
MItem MItem
19 17
CLIB\CRT\initrtns.c CLIB\CRT\ioexit.c
195 195
WString WString
4 4
@ -842,14 +842,14 @@ WVList
197 197
WVList WVList
0 0
72 68
1 1
1 1
0 0
198 198
MItem MItem
17 18
CLIB\CRT\ioexit.c CLIB\CRT\ljmphdl.c
199 199
WString WString
4 4
@ -860,14 +860,14 @@ WVList
201 201
WVList WVList
0 0
72 68
1 1
1 1
0 0
202 202
MItem MItem
18 19
CLIB\CRT\ljmphdl.c CLIB\CRT\main2wnt.c
203 203
WString WString
4 4
@ -878,14 +878,14 @@ WVList
205 205
WVList WVList
0 0
72 68
1 1
1 1
0 0
206 206
MItem MItem
19 19
CLIB\CRT\main2wnt.c CLIB\CRT\seterrno.c
207 207
WString WString
4 4
@ -896,14 +896,14 @@ WVList
209 209
WVList WVList
0 0
72 68
1 1
1 1
0 0
210 210
MItem MItem
19 19
CLIB\CRT\seterrno.c CLIB\CRT\stackwnt.c
211 211
WString WString
4 4
@ -914,14 +914,14 @@ WVList
213 213
WVList WVList
0 0
72 68
1 1
1 1
0 0
214 214
MItem MItem
19 18
CLIB\CRT\stackwnt.c CLIB\CRT\xmsgwnt.c
215 215
WString WString
4 4
@ -932,25 +932,7 @@ WVList
217 217
WVList WVList
0 0
72 68
1
1
0
218
MItem
18
CLIB\CRT\xmsgwnt.c
219
WString
4
COBJ
220
WVList
0
221
WVList
0
72
1 1
1 1
0 0