summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root>2008-11-07 16:39:35 +0000
committerroot <root>2008-11-07 16:39:35 +0000
commit2acf5e290a218cd52e9d97247eadcb08889e55e6 (patch)
treec94043d56e9316f31f1aa279b0507934f67eee05
parenta042ff836732d4714dbe4a84ef1fbc060ba870f2 (diff)
*** empty log message ***
-rw-r--r--coro.c12
-rw-r--r--coro.h1
2 files changed, 7 insertions, 6 deletions
diff --git a/coro.c b/coro.c
index 3d47768..bc382d3 100644
--- a/coro.c
+++ b/coro.c
@@ -128,8 +128,8 @@ asm (
".type coro_transfer, @function\n"
"coro_transfer:\n"
#if __amd64
-# define NUM_ALIGN 1
-# define NUM_SAVED 5
+# define NUM_SAVED 6
+ "\tpush %rbp\n"
"\tpush %rbx\n"
"\tpush %r12\n"
"\tpush %r13\n"
@@ -142,19 +142,19 @@ asm (
"\tpop %r13\n"
"\tpop %r12\n"
"\tpop %rbx\n"
+ "\tpop %rbp\n"
#elif __i386
-# define NUM_ALIGN 1
# define NUM_SAVED 4
+ "\tpush %ebp\n"
"\tpush %ebx\n"
"\tpush %esi\n"
"\tpush %edi\n"
- "\tpush %ebp\n"
"\tmov %esp, (%eax)\n"
"\tmov (%edx), %esp\n"
- "\tpop %ebp\n"
"\tpop %edi\n"
"\tpop %esi\n"
"\tpop %ebx\n"
+ "\tpop %ebp\n"
#else
# error unsupported architecture
#endif
@@ -329,7 +329,7 @@ void coro_create (coro_context *ctx,
# elif CORO_ASM
ctx->sp = (volatile void **)(ssize + (char *)sptr);
- ctx->sp -= NUM_ALIGN;
+ *--ctx->sp = (void *)abort; /* needed for alignment only */
*--ctx->sp = (void *)coro_init;
ctx->sp -= NUM_SAVED;
diff --git a/coro.h b/coro.h
index 19dc3a0..3fdd555 100644
--- a/coro.h
+++ b/coro.h
@@ -58,6 +58,7 @@
* 2008-10-30 Support assembly method on x86 with and without frame pointer.
* 2008-11-03 Use a global asm statement for CORO_ASM, idea by pippijn.
* 2008-11-05 Hopefully fix misaligned stacks with CORO_ASM/SETJMP.
+ * 2008-11-07 rbp wasn't saved in CORO_ASM on x86_64.
*/
#ifndef CORO_H