From 8b48a1df21a5b3dfd26e05c31611f77b071ae934 Mon Sep 17 00:00:00 2001 From: "Paul H. Hargrove" Date: Thu, 17 Oct 2024 00:14:19 -0700 Subject: [PATCH] Restore fastcontext support for big-endian PPC64 This commit restores support in fastcontext for the "function descriptor" of the 64-bit PowerPC ELF ABI, which is common to both AIX and Linux on big-endian PPC64. It appears to have been unintentionally removed along with AIX support in pull request #277 due to the (unfortunate) choice of `QTHREAD_PPC_ABI_AIX` to identify this ABI. Partially reverts 4f3031ce17a79be45ef5f38a7f711c972bf17cd4 Signed-off-by: Paul H. Hargrove --- src/fastcontext/context.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/fastcontext/context.c b/src/fastcontext/context.c index 7f2f2c3b2..987aba24b 100644 --- a/src/fastcontext/context.c +++ b/src/fastcontext/context.c @@ -27,7 +27,11 @@ void INTERNAL qt_makectxt(uctxt_t *ucp, void (*func)(void), int argc, ...) { tos = (unsigned long *)ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size / sizeof(unsigned long); sp = tos - 16; +#if defined __BIG_ENDIAN__ || defined _BIG_ENDIAN + ucp->mc.pc = *(long*)func; +#else ucp->mc.pc = (long)func; +#endif ucp->mc.sp = (long)sp; va_start(arg, argc); ucp->mc.r3 = va_arg(arg, long);