aboutsummaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorgrischka <grischka>2009-12-19 22:40:28 +0100
committergrischka <grischka>2009-12-20 01:54:37 +0100
commit50b040ef83252730d75463bdeea589294e698532 (patch)
tree92e82f58787576e018858939f97361b486d6bb6f /win32
parent88a3ccab9f3c877e2ffb8fecc3303006e0640907 (diff)
downloadtinycc-50b040ef83252730d75463bdeea589294e698532.tar.gz
tinycc-50b040ef83252730d75463bdeea589294e698532.tar.bz2
win64: add tiny unwind data for setjmp/longjmp
This enables native unwind semantics with longjmp on win64 by putting an entry into the .pdata section for each compiled fuction. Also, the function now use a fixed stack and store arguments into X(%rsp) rather than using push.
Diffstat (limited to 'win32')
-rw-r--r--win32/include/_mingw.h2
-rw-r--r--win32/lib/chkstk.S14
2 files changed, 12 insertions, 4 deletions
diff --git a/win32/include/_mingw.h b/win32/include/_mingw.h
index bbac35e..baa454b 100644
--- a/win32/include/_mingw.h
+++ b/win32/include/_mingw.h
@@ -58,7 +58,7 @@ typedef unsigned __int64 uintptr_t;
#define _AMD64_ 1
#define __x86_64 1
#define USE_MINGW_SETJMP_TWO_ARGS
-#define mingw_getsp tinyc_getsp
+#define mingw_getsp tinyc_getbp
#else
typedef __int32 intptr_t;
typedef unsigned __int32 uintptr_t;
diff --git a/win32/lib/chkstk.S b/win32/lib/chkstk.S
index 90a6f0d..a757b16 100644
--- a/win32/lib/chkstk.S
+++ b/win32/lib/chkstk.S
@@ -57,11 +57,19 @@ P0:
jmp *8(%rax)
/* ---------------------------------------------- */
-/* avoid msvcrt unwind stuff for setjmp/longjmp */
+/* setjmp/longjmp support */
-.globl tinyc_getsp
-tinyc_getsp:
+.globl tinyc_no_getbp
+tinyc_no_getbp:
+ .byte 0x90
+
+.globl tinyc_getbp
+tinyc_getbp:
xor %rax,%rax
+ cmp %al,tinyc_no_getbp(%rax)
+ je t1
+ mov %rbp,%rax
+t1:
ret
/* ---------------------------------------------- */