|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1980 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution and use in source and binary forms are permitted ! 6: * provided that: (1) source distributions retain this entire copyright ! 7: * notice and comment, and (2) distributions including binaries display ! 8: * the following acknowledgement: ``This product includes software ! 9: * developed by the University of California, Berkeley and its contributors'' ! 10: * in the documentation or other materials provided with the distribution ! 11: * and in all advertising materials mentioning features or use of this ! 12: * software. Neither the name of the University nor the names of its ! 13: * contributors may be used to endorse or promote products derived ! 14: * from this software without specific prior written permission. ! 15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR ! 16: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED ! 17: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 18: */ ! 19: ! 20: #if defined(LIBC_SCCS) && !defined(lint) ! 21: .asciz "@(#)_setjmp.s 5.8 (Berkeley) 6/1/90" ! 22: #endif /* LIBC_SCCS and not lint */ ! 23: ! 24: /* ! 25: * C library -- _setjmp, _longjmp ! 26: * ! 27: * _longjmp(a,v) ! 28: * will generate a "return(v)" from ! 29: * the last call to ! 30: * _setjmp(a) ! 31: * by restoring registers from the stack, ! 32: * The previous signal state is NOT restored. ! 33: */ ! 34: ! 35: #include "DEFS.h" ! 36: ! 37: ENTRY(_setjmp, 0) ! 38: movl 4(ap),r0 ! 39: movl 12(fp),(r0) # save frame pointer of caller ! 40: movl 16(fp),4(r0) # save pc of caller ! 41: clrl r0 ! 42: ret ! 43: ! 44: ENTRY(_longjmp, 0) ! 45: movl 8(ap),r0 # return(v) ! 46: movl 4(ap),r1 # fetch buffer ! 47: tstl (r1) ! 48: beql botch ! 49: loop: ! 50: bitw $1,6(fp) # r0 saved? ! 51: beql 1f ! 52: movl r0,20(fp) ! 53: bitw $2,6(fp) # was r1 saved? ! 54: beql 2f ! 55: movl r1,24(fp) ! 56: brb 2f ! 57: 1: ! 58: bitw $2,6(fp) # was r1 saved? ! 59: beql 2f ! 60: movl r1,20(fp) ! 61: 2: ! 62: cmpl (r1),12(fp) ! 63: beql done ! 64: blssu botch ! 65: movl $loop,16(fp) ! 66: ret # pop another frame ! 67: ! 68: done: ! 69: cmpb *16(fp),reiins # returning to an "rei"? ! 70: bneq 1f ! 71: movab 3f,16(fp) # do return w/ psl-pc pop ! 72: brw 2f ! 73: 1: ! 74: movab 4f,16(fp) # do standard return ! 75: 2: ! 76: ret # unwind stack before signals enabled ! 77: 3: ! 78: addl2 $8,sp # compensate for PSL-PC push ! 79: 4: ! 80: jmp *4(r1) # done, return.... ! 81: ! 82: botch: ! 83: calls $0,_longjmperror ! 84: halt ! 85: ! 86: .data ! 87: reiins: rei
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.