aboutsummaryrefslogtreecommitdiff
path: root/win32/lib
diff options
context:
space:
mode:
authorgrischka <grischka>2009-07-18 22:06:54 +0200
committergrischka <grischka>2009-07-18 22:06:54 +0200
commitfc977d56c90b6c6a54b7e831b5c88e37f54a5cae (patch)
tree51d2b865b88ba820373d8240377926bca63f857d /win32/lib
parentc0fc0fa0c4276debb7d0fd24f91e3af38128ad28 (diff)
downloadtinycc-fc977d56c90b6c6a54b7e831b5c88e37f54a5cae.tar.gz
tinycc-fc977d56c90b6c6a54b7e831b5c88e37f54a5cae.tar.bz2
x86-64: chkstk, alloca
Diffstat (limited to 'win32/lib')
-rw-r--r--win32/lib/chkstk.S74
1 files changed, 53 insertions, 21 deletions
diff --git a/win32/lib/chkstk.S b/win32/lib/chkstk.S
index 837d8af..9be9597 100644
--- a/win32/lib/chkstk.S
+++ b/win32/lib/chkstk.S
@@ -1,29 +1,61 @@
-// =================================================
-// chkstk.s
+/* ---------------------------------------------- */
+/* chkstk86.s */
+
+#include "../../config.h"
+
+/* ---------------------------------------------- */
+#ifndef TCC_TARGET_X86_64
+/* ---------------------------------------------- */
-.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
+ 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 $4096,%ecx
+ test %eax,(%ecx)
+ sub $4096,%eax
+ cmp $4096,%eax
+ jge P0
+ sub %eax,%ecx
+ test %eax,(%ecx)
+
+ mov %esp,%eax
+ mov %ecx,%esp
+ mov (%eax),%ecx /* restore ecx */
+ jmp *4(%eax)
+
+/* ---------------------------------------------- */
+#else
+/* ---------------------------------------------- */
- sub %eax,%ecx
- mov %esp,%eax
- test %eax,(%ecx)
- mov %ecx,%esp
+.globl __chkstk
+
+__chkstk:
+ xchg (%rsp),%rbp /* store ebp, get ret.addr */
+ push %rbp /* push ret.addr */
+ lea 8(%rsp),%rbp /* setup frame ptr */
+ push %rcx /* save ecx */
+ mov %rbp,%rcx
+ movslq %eax,%rax
+P0:
+ sub $4096,%rcx
+ test %rax,(%rcx)
+ sub $4096,%rax
+ cmp $4096,%rax
+ jge P0
+ sub %rax,%rcx
+ test %rax,(%rcx)
- mov (%eax),%ecx // restore ecx
- mov 4(%eax),%eax
- push %eax
- ret
+ mov %rsp,%rax
+ mov %rcx,%rsp
+ mov (%rax),%rcx /* restore ecx */
+ jmp *8(%rax)
+/* ---------------------------------------------- */
+#endif
+/* ---------------------------------------------- */