public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-8168] runtime: use regset indexes for PPC register values
Date: Thu, 14 Apr 2022 22:15:15 +0000 (GMT)	[thread overview]
Message-ID: <20220414221515.A3F47385803E@sourceware.org> (raw)

https://gcc.gnu.org/g:af27d545dc6132dcd67d1ee854372ea9cfd2a225

commit r12-8168-gaf27d545dc6132dcd67d1ee854372ea9cfd2a225
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Apr 13 14:37:12 2022 -0700

    runtime: use regset indexes for PPC register values
    
    Using names depended on <asm/ptrace.h>, which glibc includes somewhere
    but musl did not.  Change to just always use indexes.
    
    Based on patch by Sören Tempel.
    
    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/400214

Diff:
---
 gcc/go/gofrontend/MERGE   |  2 +-
 libgo/runtime/go-signal.c | 25 ++++++++++---------------
 2 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index f93eaf48e28..75ee2e3aaca 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-45108f37070afb696b069768700e39a269f1fecb
+323ab0e6fab89978bdbd83dca9c2ad9c5dcd690f
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c
index 9c919e1568a..2caddd068d6 100644
--- a/libgo/runtime/go-signal.c
+++ b/libgo/runtime/go-signal.c
@@ -230,15 +230,10 @@ getSiginfo(siginfo_t *info, void *context __attribute__((unused)))
 	ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gregs[REG_EIP];
 #elif defined(__alpha__) && defined(__linux__)
 	ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.sc_pc;
+#elif defined(__PPC64__) && defined(__linux__)
+	ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gp_regs[32];
 #elif defined(__PPC__) && defined(__linux__)
-	// For some reason different libc implementations use
-	// different names.
-#if defined(__PPC64__) || defined(__GLIBC__)
-	ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip;
-#else
-	// Assumed to be ppc32 musl.
 	ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gregs[32];
-#endif
 #elif defined(__PPC__) && defined(_AIX)
 	ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.jmp_context.iar;
 #elif defined(__aarch64__) && defined(__linux__)
@@ -354,15 +349,15 @@ dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((u
 		mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
 		int i;
 
-#if defined(__PPC64__) || defined(__GLIBC__)
+#if defined(__PPC64__)
 		for (i = 0; i < 32; i++)
-			runtime_printf("r%d %X\n", i, m->regs->gpr[i]);
-		runtime_printf("pc  %X\n", m->regs->nip);
-		runtime_printf("msr %X\n", m->regs->msr);
-		runtime_printf("cr  %X\n", m->regs->ccr);
-		runtime_printf("lr  %X\n", m->regs->link);
-		runtime_printf("ctr %X\n", m->regs->ctr);
-		runtime_printf("xer %X\n", m->regs->xer);
+			runtime_printf("r%d %X\n", i, m->gp_regs[i]);
+		runtime_printf("pc  %X\n", m->gp_regs[32]);
+		runtime_printf("msr %X\n", m->gp_regs[33]);
+		runtime_printf("cr  %X\n", m->gp_regs[38]);
+		runtime_printf("lr  %X\n", m->gp_regs[36]);
+		runtime_printf("ctr %X\n", m->gp_regs[35]);
+		runtime_printf("xer %X\n", m->gp_regs[37]);
 #else
 		for (i = 0; i < 32; i++)
 			runtime_printf("r%d %X\n", i, m->gregs[i]);


                 reply	other threads:[~2022-04-14 22:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220414221515.A3F47385803E@sourceware.org \
    --to=ian@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).