114 Star 0 Fork 21

src-openEuler / python-greenlet

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-add-loongarch64-architecture-support.patch 2.15 KB
一键复制 编辑 原始数据 按行查看 历史
王歌 提交于 2023-06-02 10:52 . update to version 2.0.2
From ca4845920d6587c5568d3ad294d17bbd9d9aa486 Mon Sep 17 00:00:00 2001
From: wang--ge <wang__ge@126.com>
Date: Thu, 1 Jun 2023 09:47:40 +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 b6a3e70..d71db10 100644
--- a/src/greenlet/slp_platformselect.h
+++ b/src/greenlet/slp_platformselect.h
@@ -49,6 +49,8 @@ extern "C" {
#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.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/python-greenlet.git
git@gitee.com:src-openeuler/python-greenlet.git
src-openeuler
python-greenlet
python-greenlet
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891