Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion greenlet.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ static int (*g_initialstub)(void*);
#undef slp_switch

#ifndef STACK_MAGIC
#error "greenlet needs to be ported to this platform, or teached how to detect your compiler properly."
#error "greenlet needs to be ported to this platform, or taught how to detect your compiler properly."
#endif /* !STACK_MAGIC */

#ifdef EXTERNAL_ASM
Expand Down
30 changes: 30 additions & 0 deletions platform/switch_alpha_unix.h
Original file line number Diff line number Diff line change
@@ -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 (
"addq $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
2 changes: 2 additions & 0 deletions slp_platformselect.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,6 @@
#include "platform/switch_csky_gcc.h" /* gcc on csky */
#elif defined(__GNUC__) && defined(__riscv)
#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 */
#endif