52 lines
1.2 KiB
Diff
52 lines
1.2 KiB
Diff
changeset: 199:d2f49ba72d0b
|
|
tag: tip
|
|
user: "Daniel P. Berrange <berrange@redhat.com>"
|
|
date: Wed Apr 02 17:07:24 2008 -0400
|
|
summary: Fix makecontext() for 64-bit args
|
|
|
|
diff -r b28dadb1f19b -r d2f49ba72d0b src/continuation.c
|
|
--- a/src/continuation.c Wed Apr 02 15:12:25 2008 -0400
|
|
+++ b/src/continuation.c Wed Apr 02 17:07:24 2008 -0400
|
|
@@ -10,8 +10,31 @@
|
|
|
|
#include "continuation.h"
|
|
|
|
+/*
|
|
+ * va_args to makecontext() must be type 'int', so passing
|
|
+ * the pointer we need may require several int args. This
|
|
+ * union is a quick hack to let us do that
|
|
+ */
|
|
+union cc_arg {
|
|
+ void *p;
|
|
+ int i[2];
|
|
+};
|
|
+
|
|
+static void continuation_trampoline(int i0, int i1)
|
|
+{
|
|
+ union cc_arg arg;
|
|
+ struct continuation *cc;
|
|
+ arg.i[0] = i0;
|
|
+ arg.i[1] = i1;
|
|
+ cc = arg.p;
|
|
+
|
|
+ cc->entry(cc);
|
|
+}
|
|
+
|
|
int cc_init(struct continuation *cc)
|
|
{
|
|
+ union cc_arg arg;
|
|
+ arg.p = cc;
|
|
if (getcontext(&cc->uc) == -1)
|
|
return -1;
|
|
|
|
@@ -20,7 +43,7 @@ int cc_init(struct continuation *cc)
|
|
cc->uc.uc_stack.ss_size = cc->stack_size;
|
|
cc->uc.uc_stack.ss_flags = 0;
|
|
|
|
- makecontext(&cc->uc, (void *)cc->entry, 1, cc);
|
|
+ makecontext(&cc->uc, (void *)continuation_trampoline, 2, arg.i[0], arg.i[1]);
|
|
|
|
return 0;
|
|
}
|
|
|