diff --git a/100-python-greenlet-uos-add-sw_64-support.patch b/100-python-greenlet-uos-add-sw_64-support.patch new file mode 100644 index 0000000000000000000000000000000000000000..5af4039fdb82600fe88d14e195025ab741f57868 --- /dev/null +++ b/100-python-greenlet-uos-add-sw_64-support.patch @@ -0,0 +1,63 @@ +From 2131e6487a4ee5b55142230f1a7bc19023054862 Mon Sep 17 00:00:00 2001 +From: root +Date: Thu, 12 Dec 2024 14:04:45 +0800 +Subject: [PATCH] add sw_64 support + +--- + src/greenlet/platform/switch_sw_64_unix.h | 30 +++++++++++++++++++++++ + src/greenlet/slp_platformselect.h | 2 ++ + 2 files changed, 32 insertions(+) + create mode 100644 src/greenlet/platform/switch_sw_64_unix.h + +diff --git a/src/greenlet/platform/switch_sw_64_unix.h b/src/greenlet/platform/switch_sw_64_unix.h +new file mode 100644 +index 0000000..688747c +--- /dev/null ++++ b/src/greenlet/platform/switch_sw_64_unix.h +@@ -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 --git a/src/greenlet/slp_platformselect.h b/src/greenlet/slp_platformselect.h +index b6a3e70..7bc6ab9 100644 +--- a/src/greenlet/slp_platformselect.h ++++ b/src/greenlet/slp_platformselect.h +@@ -59,6 +59,8 @@ extern "C" { + #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 + #ifdef __cplusplus + }; +-- +2.33.0 + diff --git a/python-greenlet.spec b/python-greenlet.spec index 564de1c627923a825ee95a81980a10fb7b924a88..edb07e4c0d4ba7f9fbee191cbce17281a09322bd 100644 --- a/python-greenlet.spec +++ b/python-greenlet.spec @@ -1,12 +1,13 @@ Name: python-greenlet Version: 2.0.2 -Release: 1 +Release: 2 Summary: lightweight coroutines for in-process concurrent programming License: Python-2.0 and MIT URL: https://github.com/python-greenlet/greenlet Source0: %{pypi_source greenlet} Patch0: 0001-add-loongarch64-architecture-support.patch +Patch100: 100-python-greenlet-uos-add-sw_64-support.patch %description The greenlet package is a spin-off of Stackless, a version of CPython @@ -44,6 +45,9 @@ that use python3-greenlet. %ifarch loongarch64 %patch0 -p1 %endif +%ifarch sw_64 +%patch100 -p1 +%endif %build %py3_build @@ -65,6 +69,9 @@ that use python3-greenlet. %{_includedir}/python%{python3_version}*/greenlet/ %changelog +* Thu Feb 27 2025 zhangshaoning - 2.0.2-2 +- Add sw_64 support + * Thu Jun 01 2023 Ge Wang - 2.0.2-1 - update to 2.0.2