summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2014-01-06 23:22:00 +0100
committerAndreas Schwab <schwab@linux-m68k.org>2014-01-06 23:25:45 +0100
commiteb7e8c7165a8291c32fe655d184aa8ef25be8a2e (patch)
treed800dec86b64fe23dd31288be3b5be0dfb042ebd
parenta0f86233d7284e71945cb4683da58c1bec9d23ea (diff)
downloadgreenlet-eb7e8c7165a8291c32fe655d184aa8ef25be8a2e.tar.gz
Add support for m68k
-rw-r--r--platform/switch_m68k_gcc.h36
-rw-r--r--slp_platformselect.h2
2 files changed, 38 insertions, 0 deletions
diff --git a/platform/switch_m68k_gcc.h b/platform/switch_m68k_gcc.h
new file mode 100644
index 0000000..0f6df5a
--- /dev/null
+++ b/platform/switch_m68k_gcc.h
@@ -0,0 +1,36 @@
+/*
+ * this is the internal transfer function.
+ *
+ * HISTORY
+ * 2014-01-06 Andreas Schwab <schwab@linux-m68k.org>
+ * File created.
+ */
+
+#ifdef SLP_EVAL
+
+#define STACK_MAGIC 0
+
+#define REGS_TO_SAVE "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
+ "%a2", "%a3", "%a4"
+
+static int
+slp_switch(void)
+{
+ int *stackref, stsizediff;
+ void *fp, *a5;
+ __asm__ volatile ("" : : : REGS_TO_SAVE);
+ __asm__ volatile ("move.l %%fp, %0" : "=m"(fp));
+ __asm__ volatile ("move.l %%a5, %0" : "=m"(a5));
+ __asm__ ("move.l %%sp, %0" : "=r"(stackref));
+ {
+ SLP_SAVE_STATE(stackref, stsizediff);
+ __asm__ volatile ("add.l %0, %%sp; add.l %0, %%fp" : : "r"(stsizediff));
+ SLP_RESTORE_STATE();
+ }
+ __asm__ volatile ("move.l %0, %%a5" : : "m"(a5));
+ __asm__ volatile ("move.l %0, %%fp" : : "m"(fp));
+ __asm__ volatile ("" : : : REGS_TO_SAVE);
+ return 0;
+}
+
+#endif
diff --git a/slp_platformselect.h b/slp_platformselect.h
index 5d6e3a0..58fad3e 100644
--- a/slp_platformselect.h
+++ b/slp_platformselect.h
@@ -36,4 +36,6 @@
#include "platform/switch_mips_unix.h" /* Linux/MIPS */
#elif defined(__GNUC__) && defined(__aarch64__)
#include "platform/switch_aarch64_gcc.h" /* Aarch64 ABI */
+#elif defined(__GNUC__) && defined(__mc68000__)
+#include "platform/switch_m68k_gcc.h" /* gcc on m68k */
#endif