diff options
| author | bellard <bellard> | 2005-04-14 23:49:21 +0000 |
|---|---|---|
| committer | bellard <bellard> | 2005-04-14 23:49:21 +0000 |
| commit | 4821702fb49c72216c307341dc3dfd5a3984cf83 (patch) | |
| tree | a26b97b558b47f741a1aebdc8a9962dd86b7436b /win32/lib/chkstk.S | |
| parent | d733dc752e8d19bdebca46678c70d04d4d1f6f76 (diff) | |
| download | tinycc-4821702fb49c72216c307341dc3dfd5a3984cf83.tar.gz tinycc-4821702fb49c72216c307341dc3dfd5a3984cf83.tar.bz2 | |
win32 merge
Diffstat (limited to 'win32/lib/chkstk.S')
| -rw-r--r-- | win32/lib/chkstk.S | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/win32/lib/chkstk.S b/win32/lib/chkstk.S new file mode 100644 index 0000000..8e16d74 --- /dev/null +++ b/win32/lib/chkstk.S @@ -0,0 +1,29 @@ +// =================================================
+// chkstk.s
+
+.text
+.globl __chkstk
+
+__chkstk:
+ xchg (%esp), %ebp // store ebp, get ret.addr
+ push %ebp // push ret.addr
+ lea 4(%esp), %ebp // setup frame ptr
+ push %ecx // save ecx
+ mov %ebp, %ecx
+P0:
+ sub $4096,%ecx
+ test %eax,(%ecx)
+ sub $4096,%eax
+ cmp $4096,%eax
+ jge P0
+
+ sub %eax,%ecx
+ mov %esp,%eax
+ test %eax,(%ecx)
+ mov %ecx,%esp
+
+ mov (%eax),%ecx // restore ecx
+ mov 4(%eax),%eax
+ push %eax
+ ret
+
|
