1 1.3 skrll /* $NetBSD: setjmp.S,v 1.3 2023/10/11 09:12:20 skrll Exp $ */ 2 1.1 martin 3 1.1 martin /* 4 1.1 martin * Copyright (c) 1994, 1995 Carnegie-Mellon University. 5 1.1 martin * All rights reserved. 6 1.1 martin * 7 1.1 martin * Author: Chris G. Demetriou 8 1.2 skrll * 9 1.1 martin * Permission to use, copy, modify and distribute this software and 10 1.1 martin * its documentation is hereby granted, provided that both the copyright 11 1.1 martin * notice and this permission notice appear in all copies of the 12 1.1 martin * software, derivative works or modified versions, and any portions 13 1.1 martin * thereof, and that both notices appear in supporting documentation. 14 1.2 skrll * 15 1.2 skrll * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 16 1.2 skrll * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 17 1.1 martin * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 18 1.2 skrll * 19 1.1 martin * Carnegie Mellon requests users of this software to return to 20 1.1 martin * 21 1.1 martin * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU 22 1.1 martin * School of Computer Science 23 1.1 martin * Carnegie Mellon University 24 1.1 martin * Pittsburgh PA 15213-3890 25 1.1 martin * 26 1.1 martin * any improvements or extensions that they make and grant Carnegie the 27 1.1 martin * rights to redistribute these changes. 28 1.1 martin */ 29 1.1 martin 30 1.1 martin #define _LOCORE 31 1.1 martin #include <machine/asm.h> 32 1.1 martin 33 1.3 skrll RCSID("$NetBSD: setjmp.S,v 1.3 2023/10/11 09:12:20 skrll Exp $") 34 1.1 martin 35 1.1 martin #include <machine/setjmp.h> 36 1.1 martin 37 1.1 martin /* 38 1.1 martin * C library -- setjmp, longjmp 39 1.1 martin * 40 1.1 martin * longjmp(a,v) 41 1.1 martin * will generate a "return(v)" from 42 1.1 martin * the last call to 43 1.1 martin * setjmp(a) 44 1.1 martin * by restoring registers from the stack, 45 1.1 martin * and the previous signal state. 46 1.1 martin */ 47 1.1 martin 48 1.1 martin ENTRY(__setjmp14, 1) 49 1.1 martin alloc loc0=ar.pfs,1,2,3,0 50 1.1 martin mov loc1=rp 51 1.1 martin ;; 52 1.3 skrll mov out0=0 // how is ignored 53 1.1 martin mov out1=0 // set = NULL 54 1.1 martin add out2=J_SIGSET,in0 // oset = &jb[J_SIGSET] 55 1.1 martin br.call.sptk.few rp=_sys___sigprocmask14 56 1.1 martin ;; 57 1.1 martin mov rp=loc1 58 1.1 martin mov r14=loc0 59 1.1 martin ;; 60 1.1 martin alloc r15=ar.pfs,1,0,0,0 // drop register frame 61 1.1 martin ;; 62 1.1 martin mov ar.pfs=r14 // restore ar.pfs 63 1.1 martin br.sptk.many _setjmp // finish saving state 64 1.1 martin END(__setjmp14) 65 1.1 martin 66 1.1 martin ENTRY(__longjmp14, 2) 67 1.1 martin alloc loc0=ar.pfs,2,2,3,0 68 1.1 martin mov loc1=rp 69 1.2 skrll ;; 70 1.1 martin mov out0=3 // how = SIG_SETMASK 71 1.1 martin add out1=J_SIGSET,in0 // set = &jb[J_SIGSET] 72 1.1 martin mov out2=0 // oset = NULL 73 1.1 martin br.call.sptk.few rp=_sys___sigprocmask14 74 1.1 martin ;; 75 1.1 martin mov rp=loc1 76 1.1 martin mov r14=loc0 77 1.1 martin ;; 78 1.1 martin alloc r15=ar.pfs,2,0,0,0 // drop register frame 79 1.1 martin ;; 80 1.1 martin mov ar.pfs=r14 // restore ar.pfs 81 1.1 martin br.sptk.many _longjmp // finish restoring state 82 1.1 martin END(__longjmp14) 83