summaryrefslogtreecommitdiffstats
path: root/setjump.mar
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:23 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:23 -0800
commit5ca6e8e6a4e5c022a6fb5d28f30219c22c99eda8 (patch)
tree9b744b9dbf39e716e56daa620e2f3041968caf19 /setjump.mar
downloadscm-5ca6e8e6a4e5c022a6fb5d28f30219c22c99eda8.tar.gz
scm-5ca6e8e6a4e5c022a6fb5d28f30219c22c99eda8.zip
Import Upstream version 4e6upstream/4e6
Diffstat (limited to 'setjump.mar')
-rw-r--r--setjump.mar38
1 files changed, 38 insertions, 0 deletions
diff --git a/setjump.mar b/setjump.mar
new file mode 100644
index 0000000..2b49243
--- /dev/null
+++ b/setjump.mar
@@ -0,0 +1,38 @@
+ .title setjump and longjump
+; The VAX C runtime library uses the $unwind utility for implementing
+; longjmp. That fails if your program do 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