svn commit: r234003 - head/lib/libc/powerpc64/gen

Nathan Whitehorn nwhitehorn at FreeBSD.org
Sat Apr 7 22:28:50 UTC 2012


Author: nwhitehorn
Date: Sat Apr  7 22:28:50 2012
New Revision: 234003
URL: http://svn.freebsd.org/changeset/base/234003

Log:
  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

Modified:
  head/lib/libc/powerpc64/gen/makecontext.c

Modified: head/lib/libc/powerpc64/gen/makecontext.c
==============================================================================
--- head/lib/libc/powerpc64/gen/makecontext.c	Sat Apr  7 20:56:29 2012	(r234002)
+++ head/lib/libc/powerpc64/gen/makecontext.c	Sat Apr  7 22:28:50 2012	(r234003)
@@ -111,7 +111,7 @@ __makecontext(ucontext_t *ucp, void (*st
 	 * 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 */


More information about the svn-src-head mailing list