From d586c39377999491b1a0442ecee717e420d3fe67 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Wed, 28 Aug 2024 23:18:42 +0800 Subject: [PATCH 1/3] switch_ppc_macosx.h: fix wrong assembler Fixes: https://github.com/python-greenlet/greenlet/issues/418 --- src/greenlet/platform/switch_ppc_macosx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/greenlet/platform/switch_ppc_macosx.h b/src/greenlet/platform/switch_ppc_macosx.h index d6e5a03c..bd414c68 100644 --- a/src/greenlet/platform/switch_ppc_macosx.h +++ b/src/greenlet/platform/switch_ppc_macosx.h @@ -49,7 +49,7 @@ slp_switch(void) int err; int *stackref, stsizediff; __asm__ volatile ("" : : : REGS_TO_SAVE); - __asm__ ("; asm block 2\n\tmr %0, r1" : "=g" (stackref) : ); + __asm__ ("; asm block 2\n\tmr %0, r1" : "=r" (stackref) : ); { SLP_SAVE_STATE(stackref, stsizediff); __asm__ volatile ( @@ -58,7 +58,7 @@ slp_switch(void) "\tadd r1, r1, r11\n" "\tadd r30, r30, r11\n" : /* no outputs */ - : "g" (stsizediff) + : "r" (stsizediff) : "r11" ); SLP_RESTORE_STATE(); From e26ca658a12a0e57021665025dd701b8fd03857d Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Wed, 28 Aug 2024 23:26:30 +0800 Subject: [PATCH 2/3] switch_ppc_unix.h: fix the same bug --- src/greenlet/platform/switch_ppc_unix.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/greenlet/platform/switch_ppc_unix.h b/src/greenlet/platform/switch_ppc_unix.h index ca590a59..bb188080 100644 --- a/src/greenlet/platform/switch_ppc_unix.h +++ b/src/greenlet/platform/switch_ppc_unix.h @@ -50,7 +50,7 @@ slp_switch(void) int err; int *stackref, stsizediff; __asm__ volatile ("" : : : REGS_TO_SAVE); - __asm__ ("mr %0, 1" : "=g" (stackref) : ); + __asm__ ("mr %0, 1" : "=r" (stackref) : ); { SLP_SAVE_STATE(stackref, stsizediff); __asm__ volatile ( @@ -58,7 +58,7 @@ slp_switch(void) "add 1, 1, 11\n" "add 30, 30, 11\n" : /* no outputs */ - : "g" (stsizediff) + : "r" (stsizediff) : "11" ); SLP_RESTORE_STATE(); From 473ff40f3f7e732f7d434c7c51d8a1da8508ba10 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Wed, 28 Aug 2024 23:29:10 +0800 Subject: [PATCH 3/3] slp_platformselect.h: fix PowerPC macro for Apple --- src/greenlet/slp_platformselect.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/greenlet/slp_platformselect.h b/src/greenlet/slp_platformselect.h index 9ed96703..87898a43 100644 --- a/src/greenlet/slp_platformselect.h +++ b/src/greenlet/slp_platformselect.h @@ -21,7 +21,7 @@ extern "C" { # include "platform/switch_ppc64_linux.h" /* gcc on PowerPC 64-bit */ #elif defined(__GNUC__) && defined(__PPC__) && (defined(__linux__) || defined(__FreeBSD__)) # include "platform/switch_ppc_linux.h" /* gcc on PowerPC */ -#elif defined(__GNUC__) && defined(__ppc__) && defined(__APPLE__) +#elif defined(__GNUC__) && defined(__POWERPC__) && defined(__APPLE__) # include "platform/switch_ppc_macosx.h" /* Apple MacOS X on PowerPC */ #elif defined(__GNUC__) && defined(__powerpc64__) && defined(_AIX) # include "platform/switch_ppc64_aix.h" /* gcc on AIX/PowerPC 64-bit */