-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for SuperH #398
Conversation
Tested on my SH7785LCR board. While it compiles without any problems, the testsuite actually segfaults:
Note, I applied the patch against version 3.0.1. I did not test on master. |
SLP_SAVE_STATE(stackref, stsizediff); | ||
__asm__ volatile( | ||
"add r15, %0\n" | ||
"add r14, %0\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are mixing up source and target here.
It should be:
"add %0, r15\n"
"add %0, r14\n"
int *stackref, stsizediff; | ||
__asm__ volatile("" : : : REGS_TO_SAVE); | ||
__asm__ volatile("mov.l r14, %0" : "=m"(fp) : :); | ||
__asm__("mov %0, r15" : "=r"(stackref)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mixing up source and target.
This should be:
__asm__("mov r15, %0" : "=r"(stackref));
With the suggested changes above, all but the following tests pass.
However, I'm seeing those failures on SPARC as well, so I assume these are unrelated. |
Also, I would prefer making the code sub-architecture-agnostic, i.e. available for all SuperH CPUs: diff --git a/src/greenlet/slp_platformselect.h b/src/greenlet/slp_platformselect.h
index 0099efc..6096cb5 100644
--- a/src/greenlet/slp_platformselect.h
+++ b/src/greenlet/slp_platformselect.h
@@ -64,8 +64,8 @@ extern "C" {
# include "platform/switch_aarch64_gcc.h" /* LLVM Aarch64 ABI for Windows */
#elif defined(__GNUC__) && defined(__loongarch64) && defined(__linux__)
# include "platform/switch_loongarch64_linux.h" /* LoongArch64 */
-#elif defined(__GNUC__) && defined(__SH4__)
-# include "platform/switch_sh4_gcc.h" /* SH4 */
+#elif defined(__GNUC__) && defined(__sh__)
+# include "platform/switch_sh_gcc.h" /* SH */
#endif
#ifdef __cplusplus and rename the header accordingly:
and change the architecture name in the commit message from "SH4" to "SH". |
I have incorporated all changes here now: glaubitz@e73592d Let me know if you want me to open a PR. You are still being credited as the author, of course. |
I have fixed your patch and resubmitted as #401 while keeping you as the author. |
Thanks. I didn't see you had opened a PR so I updated my branch with your suggestions. |
Can you change your commit message to:
I think the additional "CPUs" is not needed and the fixes tag is useful as it will automatically close the issue. |
Thank you, this has been merged through a different branch. |
Based on the SH4 Software Manual and on the SH-4 generic and C specific application binary interface.
Untested because i currently don't have access to a SH4 board running Linux and I can't install python in a Debian qemu chroot.
Fixes #166.