python-greenlet/3001-add-sw_64-support.patch
panchenbo 229223f5c2 add loongarch64 and sw_64 support
(cherry picked from commit 011c35325e6b406896d452c209d34a4b66b25c2d)
2023-09-21 16:24:23 +08:00

63 lines
2.5 KiB
Diff

diff -Naur greenlet-1.0.0.org/src/greenlet/platform/switch_sw_64_unix.h greenlet-1.0.0.sw/src/greenlet/platform/switch_sw_64_unix.h
--- greenlet-1.0.0.org/src/greenlet/platform/switch_sw_64_unix.h 1970-01-01 00:00:00.000000000 +0000
+++ greenlet-1.0.0.sw/src/greenlet/platform/switch_sw_64_unix.h 2021-11-30 11:03:50.760000000 +0000
@@ -0,0 +1,30 @@
+#define STACK_REFPLUS 1
+
+#ifdef SLP_EVAL
+#define STACK_MAGIC 0
+
+#define REGS_TO_SAVE "$9", "$10", "$11", "$12", "$13", "$14", "$15", \
+ "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", "$f8", "$f9"
+
+static int
+slp_switch(void)
+{
+ register int ret;
+ register long *stackref, stsizediff;
+ __asm__ volatile ("" : : : REGS_TO_SAVE);
+ __asm__ volatile ("mov $30, %0" : "=r" (stackref) : );
+ {
+ SLP_SAVE_STATE(stackref, stsizediff);
+ __asm__ volatile (
+ "addl $30, %0, $30\n\t"
+ : /* no outputs */
+ : "r" (stsizediff)
+ );
+ SLP_RESTORE_STATE();
+ }
+ __asm__ volatile ("" : : : REGS_TO_SAVE);
+ __asm__ volatile ("mov $31, %0" : "=r" (ret) : );
+ return ret;
+}
+
+#endif
diff -Naur greenlet-1.0.0.org/src/greenlet/slp_platformselect.h greenlet-1.0.0.sw/src/greenlet/slp_platformselect.h
--- greenlet-1.0.0.org/src/greenlet/slp_platformselect.h 2021-11-30 10:44:51.030000000 +0000
+++ greenlet-1.0.0.sw/src/greenlet/slp_platformselect.h 2021-11-30 10:45:39.990000000 +0000
@@ -55,4 +55,6 @@
#include "platform/switch_riscv_unix.h" /* gcc on RISC-V */
#elif defined(__GNUC__) && defined(__alpha__)
#include "platform/switch_alpha_unix.h" /* gcc on DEC Alpha */
+#elif defined(__GNUC__) && defined(__sw_64__)
+#include "platform/switch_sw_64_unix.h" /* gcc on DEC Sw_64 */
#endif
diff -Naur greenlet-1.0.0.org/src/greenlet.egg-info/SOURCES.txt greenlet-1.0.0.sw/src/greenlet.egg-info/SOURCES.txt
--- greenlet-1.0.0.org/src/greenlet.egg-info/SOURCES.txt 2021-11-30 10:44:51.030000000 +0000
+++ greenlet-1.0.0.sw/src/greenlet.egg-info/SOURCES.txt 2021-11-30 10:46:37.890000000 +0000
@@ -47,6 +47,7 @@
src/greenlet/platform/setup_switch_x64_masm.cmd
src/greenlet/platform/switch_aarch64_gcc.h
src/greenlet/platform/switch_alpha_unix.h
+src/greenlet/platform/switch_sw_64_unix.h
src/greenlet/platform/switch_amd64_unix.h
src/greenlet/platform/switch_arm32_gcc.h
src/greenlet/platform/switch_arm32_ios.h
@@ -83,4 +84,4 @@
src/greenlet/tests/test_throw.py
src/greenlet/tests/test_tracing.py
src/greenlet/tests/test_version.py
-src/greenlet/tests/test_weakref.py
\ No newline at end of file
+src/greenlet/tests/test_weakref.py