1: #include "../h/config.h"
   2: /*
   3:  * fail returns from a C function with failure.  The boundary points
   4:  *  to the frame of the C function initially called so the stack
   5:  *  is cleared back to there.  Then, that frame itself is popped
   6:  *  (being sure to restore registers), and efail does the actual
   7:  *  failure.
   8:  */
   9: 
  10: Global(_efail)          /* Handle failure of expression */
  11: Global(_boundary)       /* Icon/C boundary address */
  12: Global(_fail)
  13: 
  14: #ifdef VAX
  15: _fail:
  16:         Mask    0               # Don't need to save anything because
  17:                                 #  the frame is about to be thrown away.
  18:         movl    _boundary,fp    # Pop the stack back to the frame pointed
  19:                                 #  at by the boundary.
  20:         clrl    _boundary       # The net result of this routine is to
  21:                                 #  get back into an Icon environment, so
  22:                                 #  the boundary is cleared.
  23:                                 #
  24:                                 # The registers in the procedure frame now
  25:                                 #  on the top of the stack need to be
  26:                                 #  restored.  A mask is made in r0 and the
  27:                                 #  appropriate registers are restored using
  28:                                 #  a popr.
  29:         ashl    $-16,4(fp),r0   # Shift mask field of psw stack word into
  30:                                 #  the low order 16 bits of r0.
  31:         bicl2   $0xf000,r0      # Only bits 0:11 are good, turn off the
  32:                                 #  others.
  33:         movab   20(fp),sp       # 20(fp) is the start of the saved registers,
  34:                                 #  point the sp at the first one.
  35:         popr    r0              # Pop the registers indicated by r0
  36:         movl    8(fp),ap        # Get old ap
  37:         movl    12(fp),fp       #  and fp from procedure frame.  This
  38:                                 #  removes all traces of the C routine
  39:                                 #  from the stack.
  40:         jmp     _efail          # From here, it's just like expression
  41:                                 #  failure, so let efail do it.
  42: 
  43: #endif VAX
  44: 
  45: #ifdef PORT
  46: DummyFcn(_fail)
  47: #endif PORT
  48: 
  49: #ifdef PDP11
  50: 
  51: / fail - return from a (C) function with failure.
  52: / Exit to the current boundary, and branch to efail.
  53: 
  54: Global(cret)            / return from C calling sequence
  55: _fail:
  56:         mov     _boundary,r5    / pop all procedure frames to Icon/C boundary
  57:         clr     _boundary
  58:         mov     r5,r2           / then exit that procedure frame
  59:         mov     -(r2),r4
  60:         mov     -(r2),r3
  61:         mov     -(r2),r2
  62:         mov     r5,sp
  63:         mov     (sp)+,r5
  64:         jmp     _efail
  65: #endif PDP11

Defined functions

_fail defined in line 55; used 2 times
Last modified: 1984-11-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 717
Valid CSS Valid XHTML 1.0 Strict