Tue Mar 13 17:27:39 2018 UTC ()
Pull up following revision(s) (requested by uwe in ticket #1534):
	lib/libc/arch/powerpc/genassym.cf: 1.5 via patch
	lib/libc/arch/powerpc/gen/swapcontext.S: 1.8 via patch
PIC code clobbers %r30 so we need to update the saved oucp with
caller's %r30 manually.  Makes old context happy when it needs to do
more function calls after restore.


(snj)
diff -r1.3 -r1.3.8.1 src/lib/libc/arch/powerpc/genassym.cf
diff -r1.6 -r1.6.8.1 src/lib/libc/arch/powerpc/gen/swapcontext.S

cvs diff -r1.3 -r1.3.8.1 src/lib/libc/arch/powerpc/genassym.cf (expand / switch to context diff)
--- src/lib/libc/arch/powerpc/genassym.cf 2011/01/18 01:23:24 1.3
+++ src/lib/libc/arch/powerpc/genassym.cf 2018/03/13 17:27:39 1.3.8.1
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.3 2011/01/18 01:23:24 matt Exp $
+#	$NetBSD: genassym.cf,v 1.3.8.1 2018/03/13 17:27:39 snj Exp $
 
 #
 # Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -42,6 +42,7 @@
 
 define UC_GREGS_R1	offsetof(ucontext_t, uc_mcontext.__gregs[_REG_R1])
 define UC_GREGS_R3	offsetof(ucontext_t, uc_mcontext.__gregs[_REG_R3])
+define UC_GREGS_R30	offsetof(ucontext_t, uc_mcontext.__gregs[_REG_R30])
 define UC_GREGS_PC	offsetof(ucontext_t, uc_mcontext.__gregs[_REG_PC])
 
 define SIG_BLOCK	SIG_BLOCK

cvs diff -r1.6 -r1.6.8.1 src/lib/libc/arch/powerpc/gen/swapcontext.S (expand / switch to context diff)
--- src/lib/libc/arch/powerpc/gen/swapcontext.S 2011/01/16 02:43:10 1.6
+++ src/lib/libc/arch/powerpc/gen/swapcontext.S 2018/03/13 17:27:39 1.6.8.1
@@ -1,4 +1,4 @@
-/*	$NetBSD: swapcontext.S,v 1.6 2011/01/16 02:43:10 matt Exp $	*/
+/*	$NetBSD: swapcontext.S,v 1.6.8.1 2018/03/13 17:27:39 snj Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "SYS.h"
 #include "assym.h"
 
-__RCSID("$NetBSD: swapcontext.S,v 1.6 2011/01/16 02:43:10 matt Exp $")
+__RCSID("$NetBSD: swapcontext.S,v 1.6.8.1 2018/03/13 17:27:39 snj Exp $")
 
 #define	XCALLFRAMELEN	(((2+3)*SZREG + CALLFRAMELEN - 1) & -CALLFRAMELEN)
 #define	XCALLFRAME_R30	(XCALLFRAMELEN-1*SZREG)
@@ -57,6 +57,10 @@
 	stw	%r0,UC_GREGS_PC(%r11)		# pc <- lr
 	addi	%r0,%r1,XCALLFRAMELEN
 	stw	%r0,UC_GREGS_R1(%r11)		# adjust sp
+#ifdef PIC
+	lwz	%r0,XCALLFRAME_R30(%r1)
+	stw	%r0,UC_GREGS_R30(%r11)		# caller's r30
+#endif
 	lwz	%r3,XCALLFRAME_UCP(%r1)		# load ucp
 	bl	PIC_PLT(_C_LABEL(setcontext))	# setcontext(ucp)
 1: