summaryrefslogtreecommitdiff
path: root/config/bsd/alpha.s
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/alpha.s
downloadicon-6ab0c0f5bf14ed9c15370407b9ee7e0b4b089ae1.tar.gz
Initial upstream version 9.4.3upstream/9.4.3
Diffstat (limited to 'config/bsd/alpha.s')
-rw-r--r--config/bsd/alpha.s46
1 files changed, 46 insertions, 0 deletions
diff --git a/config/bsd/alpha.s b/config/bsd/alpha.s
new file mode 100644
index 0000000..6c9ba72
--- /dev/null
+++ b/config/bsd/alpha.s
@@ -0,0 +1,46 @@
+/*
+ * coswitch(old_cs, new_cs, first) for DEC Alpha architecture
+ * $16 $17 $18
+ */
+ .data
+errmsg: .ascii "new_context() returned in coswitch\X00"
+
+ .text
+ .globl coswitch
+ .ent coswitch
+coswitch:
+ lda $sp, -72($sp) /* make room on stack */
+ stq $sp, 0($16) /* save stack pointer */
+ stq $9, 0($sp) /* save registers on stack */
+ stq $10, 8($sp)
+ stq $11, 16($sp)
+ stq $12, 24($sp)
+ stq $13, 32($sp)
+ stq $14, 40($sp)
+ stq $15, 48($sp)
+ stq $27, 56($sp)
+ stq $26, 64($sp) /* return address */
+ beq $18, first /* if first time */
+
+ ldq $sp, 0($17) /* load new stack pointer */
+ ldq $9, 0($sp) /* load registers from stack */
+ ldq $10, 8($sp)
+ ldq $11, 16($sp)
+ ldq $12, 24($sp)
+ ldq $13, 32($sp)
+ ldq $14, 40($sp)
+ ldq $15, 48($sp)
+ ldq $27, 56($sp)
+ ldq $26, 64($sp) /* return address */
+ lda $sp, 72($sp) /* reset sp */
+ jsr_coroutine $31, ($26), 0 /* jump into new_context */
+
+first:
+ ldq $sp, 0($17) /* load stack pointer only */
+ bis $31, $31, $16 /* r16 = 0 */
+ bis $31, $31, $17 /* r17 = 0 */
+ jsr $26, new_context /* new_context(0,0) */
+ lda $16, errmsg
+ jsr $26, syserr /* shouldn't get here */
+
+ .end coswitch