… | |
… | |
115 | asm ( |
115 | asm ( |
116 | ".text\n" |
116 | ".text\n" |
117 | ".globl coro_transfer\n" |
117 | ".globl coro_transfer\n" |
118 | ".type coro_transfer, @function\n" |
118 | ".type coro_transfer, @function\n" |
119 | "coro_transfer:\n" |
119 | "coro_transfer:\n" |
|
|
120 | /* windows, of course, gives a shit on the amd64 ABI and uses different registers */ |
|
|
121 | /* http://blogs.msdn.com/freik/archive/2005/03/17/398200.aspx */ |
120 | #if __amd64 |
122 | #if __amd64 |
121 | #define NUM_SAVED 6 |
123 | #define NUM_SAVED 6 |
122 | "\tpush %rbp\n" |
124 | "\tpush %rbp\n" |
123 | "\tpush %rbx\n" |
125 | "\tpush %rbx\n" |
124 | "\tpush %r12\n" |
126 | "\tpush %r12\n" |
125 | "\tpush %r13\n" |
127 | "\tpush %r13\n" |
126 | "\tpush %r14\n" |
128 | "\tpush %r14\n" |
127 | "\tpush %r15\n" |
129 | "\tpush %r15\n" |
128 | #if CORO_WIN_TIB |
130 | #if CORO_WIN_TIB |
129 | "\tpush %fs:0x0\n" |
131 | "\tpush %gs:0x0\n" |
130 | "\tpush %fs:0x8\n" |
132 | "\tpush %gs:0x8\n" |
131 | "\tpush %fs:0xc\n" |
133 | "\tpush %gs:0xc\n" |
132 | #endif |
134 | #endif |
133 | "\tmov %rsp, (%rdi)\n" |
135 | "\tmov %rsp, (%rdi)\n" |
134 | "\tmov (%rsi), %rsp\n" |
136 | "\tmov (%rsi), %rsp\n" |
135 | #if CORO_WIN_TIB |
137 | #if CORO_WIN_TIB |
136 | "\tpop %fs:0xc\n" |
138 | "\tpop %gs:0xc\n" |
137 | "\tpop %fs:0x8\n" |
139 | "\tpop %gs:0x8\n" |
138 | "\tpop %fs:0x0\n" |
140 | "\tpop %gs:0x0\n" |
139 | #endif |
141 | #endif |
140 | "\tpop %r15\n" |
142 | "\tpop %r15\n" |
141 | "\tpop %r14\n" |
143 | "\tpop %r14\n" |
142 | "\tpop %r13\n" |
144 | "\tpop %r13\n" |
143 | "\tpop %r12\n" |
145 | "\tpop %r12\n" |