Module Name: src
Committed By: snj
Date: Tue Mar 13 17:27:39 UTC 2018
Modified Files:
src/lib/libc/arch/powerpc [netbsd-6]: genassym.cf
src/lib/libc/arch/powerpc/gen [netbsd-6]: swapcontext.S
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.8.1 src/lib/libc/arch/powerpc/genassym.cf
cvs rdiff -u -r1.6 -r1.6.8.1 src/lib/libc/arch/powerpc/gen/swapcontext.S
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/arch/powerpc/genassym.cf
diff -u src/lib/libc/arch/powerpc/genassym.cf:1.3 src/lib/libc/arch/powerpc/genassym.cf:1.3.8.1
--- src/lib/libc/arch/powerpc/genassym.cf:1.3 Tue Jan 18 01:23:24 2011
+++ src/lib/libc/arch/powerpc/genassym.cf Tue Mar 13 17:27:39 2018
@@ -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 CALLFRAME_R31 offsetof(struct cal
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
Index: src/lib/libc/arch/powerpc/gen/swapcontext.S
diff -u src/lib/libc/arch/powerpc/gen/swapcontext.S:1.6 src/lib/libc/arch/powerpc/gen/swapcontext.S:1.6.8.1
--- src/lib/libc/arch/powerpc/gen/swapcontext.S:1.6 Sun Jan 16 02:43:10 2011
+++ src/lib/libc/arch/powerpc/gen/swapcontext.S Tue Mar 13 17:27:39 2018
@@ -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 @@ ENTRY(swapcontext)
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: