Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/arch/powerpc/gen PIC code clobbers %r30 so we need ...



details:   https://anonhg.NetBSD.org/src/rev/cc3ba069060c
branches:  trunk
changeset: 830202:cc3ba069060c
user:      uwe <uwe%NetBSD.org@localhost>
date:      Wed Feb 28 20:51:58 2018 +0000

description:
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.

diffstat:

 lib/libc/arch/powerpc/gen/swapcontext.S |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r b0a9090e6ad6 -r cc3ba069060c lib/libc/arch/powerpc/gen/swapcontext.S
--- a/lib/libc/arch/powerpc/gen/swapcontext.S   Wed Feb 28 20:13:09 2018 +0000
+++ b/lib/libc/arch/powerpc/gen/swapcontext.S   Wed Feb 28 20:51:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: swapcontext.S,v 1.7 2013/09/12 15:36:15 joerg Exp $    */
+/*     $NetBSD: swapcontext.S,v 1.8 2018/02/28 20:51:58 uwe Exp $      */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "SYS.h"
 #include "assym.h"
 
-__RCSID("$NetBSD: swapcontext.S,v 1.7 2013/09/12 15:36:15 joerg Exp $")
+__RCSID("$NetBSD: swapcontext.S,v 1.8 2018/02/28 20:51:58 uwe 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:



Home | Main Index | Thread Index | Old Index