1/* 2 * Copyright (c) 1988 Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Computer Consoles Inc. 7 * 8 * Redistribution and use in source and binary forms are permitted 9 * provided that this notice is preserved and that due credit is given 10 * to the University of California at Berkeley. The name of the University 11 * may not be used to endorse or promote products derived from this 12 * software without specific prior written permission. This software 13 * is provided ``as is'' without express or implied warranty. 14 */ 15 16#if defined(LIBC_SCCS) && !defined(lint) 17_sccsid:.asciz "@(#)_setjmp.s 1.2 (Berkeley) 05/23/88" 18#endif /* LIBC_SCCS and not lint */ 19 20/* 21 * C library -- _setjmp, _longjmp 22 * 23 * _longjmp(a,v) 24 * will generate a "return(v)" from 25 * the last call to 26 * _setjmp(a) 27 * by restoring registers from the stack, 28 * The previous signal state is NOT restored. 29 */ 30 31#include "DEFS.h" 32 33ENTRY(_setjmp, 0) 34 movl 4(fp),r0 35 movl (fp),(r0) # save frame pointer of caller 36 movl -8(fp),4(r0) # save pc of caller 37 clrl r0 38 ret 39 40ENTRY(_longjmp, 0) 41 movl 8(fp),r0 # return(v) 42 movl 4(fp),r1 # fetch buffer 43 tstl (r1) 44 beql botch 45loop: 46 cmpl (r1),(fp) 47 beql done 48 blssu botch 49 movl $loop,-8(fp) 50 ret # pop another frame 51 52done: 53 cmpb *-8(fp),reiins # returning to an "rei"? 54 bneq 1f 55 movab 3f,-8(fp) # do return w/ psl-pc pop 56 brw 2f 571: 58 movab 4f,-8(fp) # do standard return 592: 60 ret # unwind stack before signals enabled 613: 62 addl2 $8,sp # compensate for PSL-PC push 634: 64 jmp *4(r1) # done, return.... 65 66botch: 67 callf $4,_longjmperror 68 halt 69 70 .data 71reiins: rei 72