… | |
… | |
126 | ".text\n" |
126 | ".text\n" |
127 | ".globl coro_transfer\n" |
127 | ".globl coro_transfer\n" |
128 | ".type coro_transfer, @function\n" |
128 | ".type coro_transfer, @function\n" |
129 | "coro_transfer:\n" |
129 | "coro_transfer:\n" |
130 | #if __amd64 |
130 | #if __amd64 |
131 | # define NUM_ALIGN 1 |
|
|
132 | # define NUM_SAVED 5 |
131 | # define NUM_SAVED 6 |
|
|
132 | "\tpush %rbp\n" |
133 | "\tpush %rbx\n" |
133 | "\tpush %rbx\n" |
134 | "\tpush %r12\n" |
134 | "\tpush %r12\n" |
135 | "\tpush %r13\n" |
135 | "\tpush %r13\n" |
136 | "\tpush %r14\n" |
136 | "\tpush %r14\n" |
137 | "\tpush %r15\n" |
137 | "\tpush %r15\n" |
… | |
… | |
140 | "\tpop %r15\n" |
140 | "\tpop %r15\n" |
141 | "\tpop %r14\n" |
141 | "\tpop %r14\n" |
142 | "\tpop %r13\n" |
142 | "\tpop %r13\n" |
143 | "\tpop %r12\n" |
143 | "\tpop %r12\n" |
144 | "\tpop %rbx\n" |
144 | "\tpop %rbx\n" |
|
|
145 | "\tpop %rbp\n" |
145 | #elif __i386 |
146 | #elif __i386 |
146 | # define NUM_ALIGN 1 |
|
|
147 | # define NUM_SAVED 4 |
147 | # define NUM_SAVED 4 |
|
|
148 | "\tpush %ebp\n" |
148 | "\tpush %ebx\n" |
149 | "\tpush %ebx\n" |
149 | "\tpush %esi\n" |
150 | "\tpush %esi\n" |
150 | "\tpush %edi\n" |
151 | "\tpush %edi\n" |
151 | "\tpush %ebp\n" |
|
|
152 | "\tmov %esp, (%eax)\n" |
152 | "\tmov %esp, (%eax)\n" |
153 | "\tmov (%edx), %esp\n" |
153 | "\tmov (%edx), %esp\n" |
154 | "\tpop %ebp\n" |
|
|
155 | "\tpop %edi\n" |
154 | "\tpop %edi\n" |
156 | "\tpop %esi\n" |
155 | "\tpop %esi\n" |
157 | "\tpop %ebx\n" |
156 | "\tpop %ebx\n" |
|
|
157 | "\tpop %ebp\n" |
158 | #else |
158 | #else |
159 | # error unsupported architecture |
159 | # error unsupported architecture |
160 | #endif |
160 | #endif |
161 | "\tret\n" |
161 | "\tret\n" |
162 | ); |
162 | ); |
… | |
… | |
327 | ctx->env[JB_SP] = (__uint64_t)STACK_ADJUST_PTR (sptr, ssize) - sizeof (long); |
327 | ctx->env[JB_SP] = (__uint64_t)STACK_ADJUST_PTR (sptr, ssize) - sizeof (long); |
328 | |
328 | |
329 | # elif CORO_ASM |
329 | # elif CORO_ASM |
330 | |
330 | |
331 | ctx->sp = (volatile void **)(ssize + (char *)sptr); |
331 | ctx->sp = (volatile void **)(ssize + (char *)sptr); |
332 | ctx->sp -= NUM_ALIGN; |
332 | *--ctx->sp = (void *)abort; /* needed for alignment only */ |
333 | *--ctx->sp = (void *)coro_init; |
333 | *--ctx->sp = (void *)coro_init; |
334 | ctx->sp -= NUM_SAVED; |
334 | ctx->sp -= NUM_SAVED; |
335 | |
335 | |
336 | # endif |
336 | # endif |
337 | |
337 | |