aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2022-04-13 14:37:12 -0700
committerIan Lance Taylor <iant@golang.org>2022-04-14 15:14:57 -0700
commitaf27d545dc6132dcd67d1ee854372ea9cfd2a225 (patch)
tree34f5a8d6237e26070a1a11ac96ca1a13555ec515 /libgo/runtime
parentc5de3444c4798758cdd800eca144480b4a8ef299 (diff)
downloadgcc-af27d545dc6132dcd67d1ee854372ea9cfd2a225.zip
gcc-af27d545dc6132dcd67d1ee854372ea9cfd2a225.tar.gz
gcc-af27d545dc6132dcd67d1ee854372ea9cfd2a225.tar.bz2
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
Diffstat (limited to 'libgo/runtime')
-rw-r--r--libgo/runtime/go-signal.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c
index 9c919e1..2caddd0 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]);