1*0a6a1f1dSLionel Sambuc/* $NetBSD: sigsetjmp.S,v 1.1 2015/04/17 12:51:05 martin Exp $ */ 2*0a6a1f1dSLionel Sambuc 3*0a6a1f1dSLionel Sambuc/* 4*0a6a1f1dSLionel Sambuc * Copyright (c) 1994, 1995 Carnegie-Mellon University. 5*0a6a1f1dSLionel Sambuc * All rights reserved. 6*0a6a1f1dSLionel Sambuc * 7*0a6a1f1dSLionel Sambuc * Author: Chris G. Demetriou 8*0a6a1f1dSLionel Sambuc * 9*0a6a1f1dSLionel Sambuc * Permission to use, copy, modify and distribute this software and 10*0a6a1f1dSLionel Sambuc * its documentation is hereby granted, provided that both the copyright 11*0a6a1f1dSLionel Sambuc * notice and this permission notice appear in all copies of the 12*0a6a1f1dSLionel Sambuc * software, derivative works or modified versions, and any portions 13*0a6a1f1dSLionel Sambuc * thereof, and that both notices appear in supporting documentation. 14*0a6a1f1dSLionel Sambuc * 15*0a6a1f1dSLionel Sambuc * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 16*0a6a1f1dSLionel Sambuc * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 17*0a6a1f1dSLionel Sambuc * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 18*0a6a1f1dSLionel Sambuc * 19*0a6a1f1dSLionel Sambuc * Carnegie Mellon requests users of this software to return to 20*0a6a1f1dSLionel Sambuc * 21*0a6a1f1dSLionel Sambuc * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 22*0a6a1f1dSLionel Sambuc * School of Computer Science 23*0a6a1f1dSLionel Sambuc * Carnegie Mellon University 24*0a6a1f1dSLionel Sambuc * Pittsburgh PA 15213-3890 25*0a6a1f1dSLionel Sambuc * 26*0a6a1f1dSLionel Sambuc * any improvements or extensions that they make and grant Carnegie the 27*0a6a1f1dSLionel Sambuc * rights to redistribute these changes. 28*0a6a1f1dSLionel Sambuc */ 29*0a6a1f1dSLionel Sambuc 30*0a6a1f1dSLionel Sambuc#include <machine/asm.h> 31*0a6a1f1dSLionel SambucRCSID("$NetBSD: sigsetjmp.S,v 1.1 2015/04/17 12:51:05 martin Exp $"); 32*0a6a1f1dSLionel Sambuc 33*0a6a1f1dSLionel Sambuc#include <machine/setjmp.h> 34*0a6a1f1dSLionel Sambuc 35*0a6a1f1dSLionel Sambuc/* 36*0a6a1f1dSLionel Sambuc * C library -- sigsetjmp, siglongjmp 37*0a6a1f1dSLionel Sambuc * 38*0a6a1f1dSLionel Sambuc * siglongjmp(a,v) 39*0a6a1f1dSLionel Sambuc * will generate a "return(v)" from 40*0a6a1f1dSLionel Sambuc * the last call to 41*0a6a1f1dSLionel Sambuc * sigsetjmp(a, mask) 42*0a6a1f1dSLionel Sambuc * by restoring registers from the stack. 43*0a6a1f1dSLionel Sambuc * If `mask' is non-zero, the previous signal 44*0a6a1f1dSLionel Sambuc * state will be restored. 45*0a6a1f1dSLionel Sambuc */ 46*0a6a1f1dSLionel Sambuc 47*0a6a1f1dSLionel SambucENTRY(__sigsetjmp14, 2) 48*0a6a1f1dSLionel Sambuc add r14=J_SIGMASK,in0 // place to save mask 49*0a6a1f1dSLionel Sambuc cmp.ne p6,p7=0,in1 // save signal state? 50*0a6a1f1dSLionel Sambuc ;; 51*0a6a1f1dSLionel Sambuc st8 [r14]=in1 // save mask value 52*0a6a1f1dSLionel Sambuc(p6) br.cond.dptk.many __setjmp14 53*0a6a1f1dSLionel Sambuc(p7) br.cond.dpnt.many _setjmp 54*0a6a1f1dSLionel SambucEND(__sigsetjmp14) 55*0a6a1f1dSLionel Sambuc 56*0a6a1f1dSLionel SambucENTRY(__siglongjmp14, 2) 57*0a6a1f1dSLionel Sambuc add r14=J_SIGMASK,in0 // address of mask value 58*0a6a1f1dSLionel Sambuc ;; 59*0a6a1f1dSLionel Sambuc ld8 r14=[r14] 60*0a6a1f1dSLionel Sambuc ;; 61*0a6a1f1dSLionel Sambuc cmp.ne p6,p7=0,r14 // did we save signals? 62*0a6a1f1dSLionel Sambuc(p6) br.cond.dptk.many __longjmp14 63*0a6a1f1dSLionel Sambuc(p7) br.cond.dpnt.many _longjmp 64*0a6a1f1dSLionel SambucEND(__siglongjmp14) 65