From 5f9f028d674003ab76fb109876736783e17a05d3 Mon Sep 17 00:00:00 2001
From: root <root>
Date: Mon, 13 Jun 2011 08:38:16 +0000
Subject: *** empty log message ***

---
 coro.c | 108 ++++++++++++++++++++++++++++++-----------------------------------
 1 file changed, 50 insertions(+), 58 deletions(-)

diff --git a/coro.c b/coro.c
index 55d2dd2..484b7c9 100644
--- a/coro.c
+++ b/coro.c
@@ -126,74 +126,66 @@ trampoline (int sig)
        /* http://blogs.msdn.com/freik/archive/2005/03/17/398200.aspx */
        #if __amd64
          #ifdef _WIN32
+           /* TODO: xmm6..15 also would need to be saved. sigh. */
            #define NUM_SAVED 8
-           "\tpush %rsi\n"
-           "\tpush %rdi\n"
-           "\tpush %rbp\n"
-           "\tpush %rbx\n"
-           "\tpush %r12\n"
-           "\tpush %r13\n"
-           "\tpush %r14\n"
-           "\tpush %r15\n"
-           #if CORO_WIN_TIB
-             "\tpush %gs:0x0\n"
-             "\tpush %gs:0x8\n"
-             "\tpush %gs:0xc\n"
-           #endif
-           "\tmov %rsp, (%rcx)\n"
-           "\tmov (%rdx), %rsp\n"
-           #if CORO_WIN_TIB
-             "\tpop %gs:0xc\n"
-             "\tpop %gs:0x8\n"
-             "\tpop %gs:0x0\n"
-           #endif
-           "\tpop %r15\n"
-           "\tpop %r14\n"
-           "\tpop %r13\n"
-           "\tpop %r12\n"
-           "\tpop %rbx\n"
-           "\tpop %rbp\n"
-           "\tpop %rdi\n"
-           "\tpop %rsi\n"
+           #undef CORO_WIN_TIB
+           "\tpushq %rsi\n"
+           "\tpushq %rdi\n"
+           "\tpushq %rbp\n"
+           "\tpushq %rbx\n"
+           "\tpushq %r12\n"
+           "\tpushq %r13\n"
+           "\tpushq %r14\n"
+           "\tpushq %r15\n"
+           "\tmovq %rsp, (%rcx)\n"
+           "\tmovq (%rdx), %rsp\n"
+           "\tpopq %r15\n"
+           "\tpopq %r14\n"
+           "\tpopq %r13\n"
+           "\tpopq %r12\n"
+           "\tpopq %rbx\n"
+           "\tpopq %rbp\n"
+           "\tpopq %rdi\n"
+           "\tpopq %rsi\n"
          #else
            #define NUM_SAVED 6
-           "\tpush %rbp\n"
-           "\tpush %rbx\n"
-           "\tpush %r12\n"
-           "\tpush %r13\n"
-           "\tpush %r14\n"
-           "\tpush %r15\n"
-           "\tmov %rsp, (%rdi)\n"
-           "\tmov (%rsi), %rsp\n"
-           "\tpop %r15\n"
-           "\tpop %r14\n"
-           "\tpop %r13\n"
-           "\tpop %r12\n"
-           "\tpop %rbx\n"
-           "\tpop %rbp\n"
+           "\tpushq %rbp\n"
+           "\tpushq %rbx\n"
+           "\tpushq %r12\n"
+           "\tpushq %r13\n"
+           "\tpushq %r14\n"
+           "\tpushq %r15\n"
+           "\tmovq %rsp, (%rdi)\n"
+           "\tmovq (%rsi), %rsp\n"
+           "\tpopq %r15\n"
+           "\tpopq %r14\n"
+           "\tpopq %r13\n"
+           "\tpopq %r12\n"
+           "\tpopq %rbx\n"
+           "\tpopq %rbp\n"
          #endif
        #elif __i386
          #define NUM_SAVED 4
-         "\tpush %ebp\n"
-         "\tpush %ebx\n"
-         "\tpush %esi\n"
-         "\tpush %edi\n"
+         "\tpushl %ebp\n"
+         "\tpushl %ebx\n"
+         "\tpushl %esi\n"
+         "\tpushl %edi\n"
          #if CORO_WIN_TIB
-           "\tpush %fs:0\n"
-           "\tpush %fs:4\n"
-           "\tpush %fs:8\n"
+           "\tpushl %fs:0\n"
+           "\tpushl %fs:4\n"
+           "\tpushl %fs:8\n"
          #endif
-         "\tmov %esp, (%eax)\n"
-         "\tmov (%edx), %esp\n"
+         "\tmovl %esp, (%eax)\n"
+         "\tmovl (%edx), %esp\n"
          #if CORO_WIN_TIB
-           "\tpop %fs:8\n"
-           "\tpop %fs:4\n"
-           "\tpop %fs:0\n"
+           "\tpopl %fs:8\n"
+           "\tpopl %fs:4\n"
+           "\tpopl %fs:0\n"
          #endif
-         "\tpop %edi\n"
-         "\tpop %esi\n"
-         "\tpop %ebx\n"
-         "\tpop %ebp\n"
+         "\tpopl %edi\n"
+         "\tpopl %esi\n"
+         "\tpopl %ebx\n"
+         "\tpopl %ebp\n"
        #else
          #error unsupported architecture
        #endif
-- 
cgit v1.2.3