summaryrefslogtreecommitdiff
path: root/config/bsd/m68k.c
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2013-01-27 23:51:56 +0000
committerIgor Pashev <pashev.igor@gmail.com>2013-01-27 23:51:56 +0000
commit6ab0c0f5bf14ed9c15370407b9ee7e0b4b089ae1 (patch)
tree926065cf45450116098db664e3c61dced9e1f21a /config/bsd/m68k.c
downloadicon-upstream/9.4.3.tar.gz
Initial upstream version 9.4.3upstream/9.4.3
Diffstat (limited to 'config/bsd/m68k.c')
-rw-r--r--config/bsd/m68k.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/config/bsd/m68k.c b/config/bsd/m68k.c
new file mode 100644
index 0000000..077922b
--- /dev/null
+++ b/config/bsd/m68k.c
@@ -0,0 +1,25 @@
+/*
+ * coswitch for the m68k architecture
+ */
+
+int
+coswitch (int *old_cs, int *new_cs, int first)
+{
+ asm ("movl %a6@(8),%a0"); /* a0 = old */
+ asm ("movl %a6@(12),%a1"); /* a1 = new */
+ asm ("movl %a7,%a0@"); /* save sp in cstate[0] */
+ asm ("movl %a6,%a0@(4)"); /* save a6 (fp) in cstate[0] */
+ asm ("moveml #0x3cfc,%a0@(8)"); /* store d2-d7, a2-a6 in old->cstate */
+
+ if (first == 0) { /* this is first activation */
+ asm ("movl %a1@,%a7");
+ asm ("movl #0,%a6");
+ new_context (0, 0);
+ syserr ("new_context() returned in coswitch");
+ }
+ else {
+ asm ("movl %a1@,%a7"); /* restore sp */
+ asm ("movl %a1@(4),%a6"); /* restore fp */
+ asm ("moveml %a1@(8),#0x3cfc"); /* restore d2-d7, a2-a6 */
+ }
+}