summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root>2011-06-13 09:00:15 +0000
committerroot <root>2011-06-13 09:00:15 +0000
commitfd8d33edb517daa60a65724494b9ce8a6226f89a (patch)
treeb746e5c4e258a35abb93ca28f98c1b151fa6888b
parent5f9f028d674003ab76fb109876736783e17a05d3 (diff)
*** empty log message ***rel-6_0
-rw-r--r--coro.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/coro.c b/coro.c
index 484b7c9..7e69ab0 100644
--- a/coro.c
+++ b/coro.c
@@ -117,18 +117,20 @@ trampoline (int sig)
# if CORO_ASM
+ #if _WIN32
+ #define CORO_WIN_TIB 1
+ #endif
+
asm (
- ".text\n"
- ".globl coro_transfer\n"
- ".type coro_transfer, @function\n"
+ "\t.text\n"
+ "\t.globl coro_transfer\n"
"coro_transfer:\n"
/* windows, of course, gives a shit on the amd64 ABI and uses different registers */
/* http://blogs.msdn.com/freik/archive/2005/03/17/398200.aspx */
#if __amd64
- #ifdef _WIN32
+ #ifdef WIN32
/* TODO: xmm6..15 also would need to be saved. sigh. */
#define NUM_SAVED 8
- #undef CORO_WIN_TIB
"\tpushq %rsi\n"
"\tpushq %rdi\n"
"\tpushq %rbp\n"
@@ -137,8 +139,18 @@ trampoline (int sig)
"\tpushq %r13\n"
"\tpushq %r14\n"
"\tpushq %r15\n"
+ #if CORO_WIN_TIB
+ "\tpushq %fs:0x0\n"
+ "\tpushq %fs:0x8\n"
+ "\tpushq %fs:0xc\n"
+ #endif
"\tmovq %rsp, (%rcx)\n"
"\tmovq (%rdx), %rsp\n"
+ #if CORO_WIN_TIB
+ "\tpopq %fs:0xc\n"
+ "\tpopq %fs:0x8\n"
+ "\tpopq %fs:0x0\n"
+ #endif
"\tpopq %r15\n"
"\tpopq %r14\n"
"\tpopq %r13\n"