ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libcoro/coro.c
(Generate patch)

Comparing libcoro/coro.c (file contents):
Revision 1.49 by root, Fri Apr 2 19:04:04 2010 UTC vs.
Revision 1.50 by root, Fri Apr 2 19:13:54 2010 UTC

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 #if __amd64 120 #if __amd64
121 #if CORO_WIN_TIB
122 #define NUM_SAVED 6+3
123 "\tpush %fs:0x0\n"
124 "\tpush %fs:0x8\n"
125 "\tpush %fs:0xc\n"
126 #else
127 #define NUM_SAVED 6 121 #define NUM_SAVED 6
128 #endif
129 "\tpush %rbp\n" 122 "\tpush %rbp\n"
130 "\tpush %rbx\n" 123 "\tpush %rbx\n"
131 "\tpush %r12\n" 124 "\tpush %r12\n"
132 "\tpush %r13\n" 125 "\tpush %r13\n"
133 "\tpush %r14\n" 126 "\tpush %r14\n"
134 "\tpush %r15\n" 127 "\tpush %r15\n"
128 #if CORO_WIN_TIB
129 "\tpush %fs:0xc\n"
130 "\tpush %fs:0x8\n"
131 "\tpush %fs:0x0\n"
132 #endif
135 "\tmov %rsp, (%rdi)\n" 133 "\tmov %rsp, (%rdi)\n"
136 "\tmov (%rsi), %rsp\n" 134 "\tmov (%rsi), %rsp\n"
135 #if CORO_WIN_TIB
136 "\tpop %fs:0x0\n"
137 "\tpop %fs:0x8\n"
138 "\tpop %fs:0xc\n"
139 #endif
137 "\tpop %r15\n" 140 "\tpop %r15\n"
138 "\tpop %r14\n" 141 "\tpop %r14\n"
139 "\tpop %r13\n" 142 "\tpop %r13\n"
140 "\tpop %r12\n" 143 "\tpop %r12\n"
141 "\tpop %rbx\n" 144 "\tpop %rbx\n"
142 "\tpop %rbp\n" 145 "\tpop %rbp\n"
143 #if CORO_WIN_TIB
144 "\tpop %fs:0xc\n"
145 "\tpop %fs:0x8\n"
146 "\tpop %fs:0x0\n"
147 #endif
148 #elif __i386 146 #elif __i386
149 #if CORO_WIN_TIB
150 #define NUM_SAVED 4+3
151 "\tpush %fs:0x0\n"
152 "\tpush %fs:0x4\n"
153 "\tpush %fs:0x8\n"
154 #else
155 #define NUM_SAVED 4 147 #define NUM_SAVED 4
156 #endif
157 "\tpush %ebp\n" 148 "\tpush %ebp\n"
158 "\tpush %ebx\n" 149 "\tpush %ebx\n"
159 "\tpush %esi\n" 150 "\tpush %esi\n"
160 "\tpush %edi\n" 151 "\tpush %edi\n"
152 #if CORO_WIN_TIB
153 "\tpush %fs:8\n"
154 "\tpush %fs:4\n"
155 "\tpush %fs:0\n"
156 #endif
161 "\tmov %esp, (%eax)\n" 157 "\tmov %esp, (%eax)\n"
162 "\tmov (%edx), %esp\n" 158 "\tmov (%edx), %esp\n"
159 #if CORO_WIN_TIB
160 "\tpop %fs:0\n"
161 "\tpop %fs:4\n"
162 "\tpop %fs:8\n"
163 #endif
163 "\tpop %edi\n" 164 "\tpop %edi\n"
164 "\tpop %esi\n" 165 "\tpop %esi\n"
165 "\tpop %ebx\n" 166 "\tpop %ebx\n"
166 "\tpop %ebp\n" 167 "\tpop %ebp\n"
167 #if CORO_WIN_TIB
168 "\tpop %fs:0x8\n"
169 "\tpop %fs:0x4\n"
170 "\tpop %fs:0x0\n"
171 #endif
172 #else 168 #else
173 #error unsupported architecture 169 #error unsupported architecture
174 #endif 170 #endif
175 "\tret\n" 171 "\tret\n"
176 ); 172 );
301 ctx->sp = (void **)(ssize + (char *)sptr); 297 ctx->sp = (void **)(ssize + (char *)sptr);
302 *--ctx->sp = (void *)abort; /* needed for alignment only */ 298 *--ctx->sp = (void *)abort; /* needed for alignment only */
303 *--ctx->sp = (void *)coro_init; 299 *--ctx->sp = (void *)coro_init;
304 ctx->sp -= NUM_SAVED; 300 ctx->sp -= NUM_SAVED;
305 301
302 #if CORO_WIN_TIB
303 *--ctx->sp = sptr; /* StackLimit */
304 *--ctx->sp = (char *)sptr + ssize; /* StackBase */
305 *--ctx->sp = 0; /* ExceptionList */
306 #endif
307
306# elif CORO_UCONTEXT 308# elif CORO_UCONTEXT
307 309
308 getcontext (&(ctx->uc)); 310 getcontext (&(ctx->uc));
309 311
310 ctx->uc.uc_link = 0; 312 ctx->uc.uc_link = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines