diff options
Diffstat (limited to 'unix/as.linux64/zsvjmp.s.BAD')
-rw-r--r-- | unix/as.linux64/zsvjmp.s.BAD | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/unix/as.linux64/zsvjmp.s.BAD b/unix/as.linux64/zsvjmp.s.BAD new file mode 100644 index 00000000..74107830 --- /dev/null +++ b/unix/as.linux64/zsvjmp.s.BAD @@ -0,0 +1,60 @@ + .file "zsvjmp.s" + +# 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. +# +# zsvjmp (jmp_buf, status) # (returns status) +# zdojmp (jmp_buf, status) # (passes status to zsvjmp) +# +# These routines are directly comparable to the UNIX setjmp/longjmp, except +# that they are Fortran callable kernel routines, i.e., trailing underscore, +# call by reference, and no function returns. ZSVJMP requires an assembler +# jacket routine to avoid modifying the call stack, but relies upon setjmp +# to do the real work. ZDOJMP is implemented as a portable C routine in OS, +# calling longjmp to do the restore. In these routines, JMP_BUF consists +# of one longword containing the address of the STATUS variable, followed +# by the "jmp_buf" used by setjmp/longjmp. +# +# This file contains the FreeBSD (x86) version of ZSVJMP. +# Modified to remove leading underscore for ELF (Jan99). + + .globl _zsvjmp_ + + # 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 VOS or Fortran 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 are likely to cause a + # memory violation. + + .globl mem_ + mem_ = 0 + .globl _mem_ + _mem_ = 0 + +_zsvjmp_: + pushl %ebp + movl %esp, %ebp + subl $24, %esp + movl 12(%ebp), %eax + movl $0, (%eax) + movl 12(%ebp), %eax + movl (%eax), %edx + movl 8(%ebp), %eax + movl %edx, (%eax) + movl 8(%ebp), %eax + addl $4, %eax + movl %eax, (%esp) + call L_setjmp$stub + leave + ret + .section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5 +L_setjmp$stub: + .indirect_symbol _setjmp + hlt ; hlt ; hlt ; hlt ; hlt + .subsections_via_symbols |