1: /*
   2:  * Copyright (c) 1987 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #if     defined(LIBC_SCCS) && !defined(lint)
   8:         <@(#)rollback.s	1.4 (2.11BSD GTE) 1/1/94\0>
   9:         .even
  10: #endif
  11: 
  12: /*
  13:  * rollback(fp::r0)
  14:  *	caddr_t	fp;
  15:  *
  16:  * Overlaid version of rollback.
  17:  *
  18:  * This routine is used in conjuction with the various versions of longjmp to
  19:  * roll back r5 to a saved stack frame and restore r2, r3, and r4 from the
  20:  * immediately nested stack frame.
  21:  *
  22:  * Note that the register restore can fail if the routine being jumped to calls
  23:  * an assembly routine that uses one or more of the registers without creating
  24:  * a stack frame to save the old values of the registers.  E.g. the assembly
  25:  * routine simply "pushes" any registers it uses then "pops" them afterwards.
  26:  * This causes rollback to fail because there's no stack frame to pull the
  27:  * original values of the registers from.
  28:  *
  29:  *	Caveat:	Don't use register variables in routines using setjmp's!
  30:  */
  31: 
  32: .globl  _longjmperror                   / just in case we roll off the end ...
  33: .globl  rollback
  34: rollback:
  35:         cmp     r5,r0                   / if (we're longjmp'ing to ourselves)
  36:         beq     3f                      /   return;
  37: 1:                                      / do {
  38:         cmp     (r5),r0                 /   if (the next frame is The Frame)
  39:         beq     2f                      /     goto 2f;
  40:         mov     (r5),r5                 / while ((r5 = r5->next_frame) != 0)
  41:         bne     1b
  42:         jsr     pc,_longjmperror        / call longjmperror
  43:         iot                             /   and die if we return
  44: 2:
  45:         mov     r5,r2                   / r2 = immediately nested frame
  46:         tst     -(r2)                   / skip past saved overlay number
  47:         mov     -(r2),r4                / restore r4,
  48:         mov     -(r2),r3                /   r3, and
  49:         mov     -(r2),r2                /   r2
  50:         mov     (r5),r5                 / r5 = desired frame
  51: 3:
  52:         rts     pc                      /   and return

Defined functions

rollback declared in line 33; defined in line 34; used 5 times
Last modified: 1994-01-02
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2222
Valid CSS Valid XHTML 1.0 Strict