summaryrefslogtreecommitdiff
path: root/SCM/setjump.mar
diff options
context:
space:
mode:
authorMatthias Benkard <mulk@minimulk.mst-plus>2008-09-20 12:11:00 +0200
committerMatthias Benkard <mulk@minimulk.mst-plus>2008-09-20 12:11:00 +0200
commit784ddf7a6378e2bde5729c37993af65cb58deef2 (patch)
treef4e06a00422cde7abffbc6be44b50ccf28a89e0f /SCM/setjump.mar
parent0e6969f0a7b7343f02f2be0c35e36f6477505514 (diff)
Add continuation support files from SCM 5e5.
Diffstat (limited to 'SCM/setjump.mar')
-rw-r--r--SCM/setjump.mar39
1 files changed, 39 insertions, 0 deletions
diff --git a/SCM/setjump.mar b/SCM/setjump.mar
new file mode 100644
index 0000000..3fc223c
--- /dev/null
+++ b/SCM/setjump.mar
@@ -0,0 +1,39 @@
+ .title setjump and longjump
+
+; The VAX C runtime library uses the $unwind utility for
+; implementing longjmp. That fails if your program does not
+; follow normal stack decipline. This is a dirty implementation
+; of setjmp and longjmp that does not have that problem. The
+; names longjmp and setjmp are avoided so that the code can be
+; linked with the vax c runtime library without name clashes.
+
+; This code was contributed by an anonymous reviewer from
+; comp.sources.reviewed.
+
+ .entry setjump,^M<IV>
+ movl 4(ap),r0
+ movq r2,(r0)+
+ movq r4,(r0)+
+ movq r6,(r0)+
+ movq r8,(r0)+
+ movq r10,(r0)+
+ movl fp,(r0)+
+ movo 4(fp),(r0)+
+ movq 20(fp),(r0)
+ clrl r0
+ ret
+
+ .entry longjump,^M<IV>
+ movl 4(ap),r0
+ movq (r0)+,r2
+ movq (r0)+,r4
+ movq (r0)+,r6
+ movq (r0)+,r8
+ movq (r0)+,r10
+ movl (r0)+,r1
+ movo (r0)+,4(r1)
+ movq (r0),20(r1)
+ movl 8(ap),r0
+ movl r1,fp
+ ret
+ .end