add loongarch64 architecture support
Signed-off-by: Jingyun Hua <huajingyun@loongson.cn>
This commit is contained in:
parent
bd3d0a4e40
commit
5f5c26698b
65
0001-add-loongarch64-architecture-support.patch
Normal file
65
0001-add-loongarch64-architecture-support.patch
Normal file
@ -0,0 +1,65 @@
|
||||
From 5bad26bce4675cd6b590a2e990e69ff7a6c187b5 Mon Sep 17 00:00:00 2001
|
||||
From: wang--ge <wang__ge@126.com>
|
||||
Date: Sat, 7 May 2022 14:39:18 +0800
|
||||
Subject: [PATCH] add loongarch64 architecture support
|
||||
|
||||
---
|
||||
.../platform/switch_loongarch64_linux.h | 31 +++++++++++++++++++
|
||||
src/greenlet/slp_platformselect.h | 2 ++
|
||||
2 files changed, 33 insertions(+)
|
||||
create mode 100644 src/greenlet/platform/switch_loongarch64_linux.h
|
||||
|
||||
diff --git a/src/greenlet/platform/switch_loongarch64_linux.h b/src/greenlet/platform/switch_loongarch64_linux.h
|
||||
new file mode 100644
|
||||
index 0000000..4252561
|
||||
--- /dev/null
|
||||
+++ b/src/greenlet/platform/switch_loongarch64_linux.h
|
||||
@@ -0,0 +1,31 @@
|
||||
+#define STACK_REFPLUS 1
|
||||
+
|
||||
+#ifdef SLP_EVAL
|
||||
+#define STACK_MAGIC 0
|
||||
+
|
||||
+#define REGS_TO_SAVE "s0", "s1", "s2", "s3", "s4", "s5", \
|
||||
+ "s6", "s7", "s8", "fp", \
|
||||
+ "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31"
|
||||
+
|
||||
+static int
|
||||
+slp_switch(void)
|
||||
+{
|
||||
+ register int ret;
|
||||
+ register long *stackref, stsizediff;
|
||||
+ __asm__ volatile ("" : : : REGS_TO_SAVE);
|
||||
+ __asm__ volatile ("move %0, $sp" : "=r" (stackref) : );
|
||||
+ {
|
||||
+ SLP_SAVE_STATE(stackref, stsizediff);
|
||||
+ __asm__ volatile (
|
||||
+ "add.d $sp, $sp, %0\n\t"
|
||||
+ : /* no outputs */
|
||||
+ : "r" (stsizediff)
|
||||
+ );
|
||||
+ SLP_RESTORE_STATE();
|
||||
+ }
|
||||
+ __asm__ volatile ("" : : : REGS_TO_SAVE);
|
||||
+ __asm__ volatile ("move %0, $zero" : "=r" (ret) : );
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+#endif
|
||||
\ No newline at end of file
|
||||
diff --git a/src/greenlet/slp_platformselect.h b/src/greenlet/slp_platformselect.h
|
||||
index b5e8eb6..1766e16 100644
|
||||
--- a/src/greenlet/slp_platformselect.h
|
||||
+++ b/src/greenlet/slp_platformselect.h
|
||||
@@ -45,6 +45,8 @@
|
||||
#endif
|
||||
#elif defined(__GNUC__) && defined(__mips__) && defined(__linux__)
|
||||
#include "platform/switch_mips_unix.h" /* Linux/MIPS */
|
||||
+#elif defined(__GNUC__) && defined(__loongarch64) && defined(__linux__)
|
||||
+#include "platform/switch_loongarch64_linux.h" /* Linux/LoongArch64 */
|
||||
#elif defined(__GNUC__) && defined(__aarch64__)
|
||||
#include "platform/switch_aarch64_gcc.h" /* Aarch64 ABI */
|
||||
#elif defined(__GNUC__) && defined(__mc68000__)
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
Name: python-greenlet
|
||||
Version: 1.1.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: https://files.pythonhosted.org/packages/0c/10/754e21b5bea89d0e73f99d60c83754df7cc64db74f47d98ab187669ce341/greenlet-1.1.2.tar.gz
|
||||
|
||||
Patch0: 0001-add-loongarch64-architecture-support.patch
|
||||
|
||||
%description
|
||||
The greenlet package is a spin-off of Stackless, a version of CPython
|
||||
that supports micro-threads called "tasklets". Tasklets run pseudo-concurrently
|
||||
@ -38,7 +40,10 @@ This package contains libraries and headier files for developing applications
|
||||
that use python3-greenlet.
|
||||
|
||||
%prep
|
||||
%autosetup -n greenlet-%{version} -p1
|
||||
%setup -n greenlet-%{version}
|
||||
%ifarch loongarch64
|
||||
%patch0 -p1
|
||||
%endif
|
||||
|
||||
%build
|
||||
%py3_build
|
||||
@ -60,6 +65,9 @@ that use python3-greenlet.
|
||||
%{_includedir}/python%{python3_version}*/greenlet/
|
||||
|
||||
%changelog
|
||||
* Thu Nov 17 2022 huajingyun <huajingyun@loongson.cn> - 1.1.2-2
|
||||
- add loongarch64 architecture support
|
||||
|
||||
* Wed Mar 30 2022 caodongxia <caodongxia@huawei.com> - 1.1.2-1
|
||||
- update to 1.1.2
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user