Properly resolve the _ctx_start function descriptor (the symbol _ctx_start

is a descriptor, not a code address), which prevents crashes when starting
a context. This fixes QEMU on powerpc64.

MFC after:	3 days
This commit is contained in:
Nathan Whitehorn 2012-04-07 22:28:50 +00:00
parent 9295c62814
commit 351f30528e

View File

@ -111,7 +111,7 @@ __makecontext(ucontext_t *ucp, void (*start)(void), int argc, ...)
* Use caller-saved regs 14/15 to hold params that _ctx_start
* will use to invoke the user-supplied func
*/
mc->mc_srr0 = (uintptr_t) _ctx_start;
mc->mc_srr0 = *(uintptr_t *)_ctx_start;
mc->mc_gpr[1] = (uintptr_t) sp; /* new stack pointer */
mc->mc_gpr[14] = (uintptr_t) start; /* r14 <- start */
mc->mc_gpr[15] = (uintptr_t) ucp; /* r15 <- ucp */