aboutsummaryrefslogtreecommitdiff
path: root/unix/as.vax/zsvjmp.s.ORIG
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /unix/as.vax/zsvjmp.s.ORIG
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'unix/as.vax/zsvjmp.s.ORIG')
-rw-r--r--unix/as.vax/zsvjmp.s.ORIG55
1 files changed, 55 insertions, 0 deletions
diff --git a/unix/as.vax/zsvjmp.s.ORIG b/unix/as.vax/zsvjmp.s.ORIG
new file mode 100644
index 00000000..59911970
--- /dev/null
+++ b/unix/as.vax/zsvjmp.s.ORIG
@@ -0,0 +1,55 @@
+# ZSVJMP, ZDOJMP -- Set up a jump (non-local goto) by saving the processor
+# registers in the buffer jmpbuf. A subsequent call to ZDOJMP restores
+# the registers, effecting a call in the context of the procedure which
+# originally called ZSVJMP, but with the new status code. These are Fortran
+# callable procedures.
+
+ .globl _zsvjmp_
+ .globl _zdojmp_
+
+ # The following has nothing to do with ZSVJMP, and is included here
+ # only because this assembler module is loaded with every process.
+ # This code sets the value of the symbol MEM (the Mem common) to zero,
+ # setting the origin for IRAF pointers to zero rather than some
+ # arbitrary value, and ensuring that the MEM common is aligned for
+ # all datatypes as well as page aligned. A further advantage is that
+ # references to NULL pointers will cause a memory violation.
+
+ .globl _mem_
+ .set _mem_, 0
+
+ .set JMPBUF, 4
+ .set STATUS, 8
+
+ .align 1
+_zsvjmp_: # set up jump
+ .word 0x0
+ movl JMPBUF(ap), r0
+ movl STATUS(ap), (r0)+ # save address of status variable
+ movq r6, (r0)+
+ movq r8, (r0)+
+ movq r10, (r0)+
+ movq 8(fp), (r0)+ # ap, fp
+ movab 12(ap), (r0)+ # sp
+ movl 16(fp), (r0) # saved pc
+ clrl *STATUS(ap)
+ clrl r0
+ ret
+
+ .align 1
+_zdojmp_: # do jump (return again from zsvjmp)
+ .word 0x0
+ movl JMPBUF(ap), r1
+ movl (r1)+, r0 # get address of status variable
+ movl *STATUS(ap), (r0) # put new status there
+ movq (r1)+, r6
+ movq (r1)+, r8
+ movq (r1)+, r10
+ movq (r1)+, r12
+ movl (r1)+, sp
+ tstl (r0) # must not return status=0
+ bneq L1
+ movzbl $1, (r0)
+L1:
+ movl (r0), r0
+ jmp *(r1)