1*6170f597Suwe/* $NetBSD: _setjmp.S,v 1.7 2006/01/05 02:04:41 uwe Exp $ */ 297f4a15fSuwe 397f4a15fSuwe/*- 497f4a15fSuwe * Copyright (c) 1990 The Regents of the University of California. 597f4a15fSuwe * All rights reserved. 697f4a15fSuwe * 797f4a15fSuwe * This code is derived from software contributed to Berkeley by 897f4a15fSuwe * William Jolitz. 997f4a15fSuwe * 1097f4a15fSuwe * Redistribution and use in source and binary forms, with or without 1197f4a15fSuwe * modification, are permitted provided that the following conditions 1297f4a15fSuwe * are met: 1397f4a15fSuwe * 1. Redistributions of source code must retain the above copyright 1497f4a15fSuwe * notice, this list of conditions and the following disclaimer. 1597f4a15fSuwe * 2. Redistributions in binary form must reproduce the above copyright 1697f4a15fSuwe * notice, this list of conditions and the following disclaimer in the 1797f4a15fSuwe * documentation and/or other materials provided with the distribution. 1897f4a15fSuwe * 3. Neither the name of the University nor the names of its contributors 1997f4a15fSuwe * may be used to endorse or promote products derived from this software 2097f4a15fSuwe * without specific prior written permission. 2197f4a15fSuwe * 2297f4a15fSuwe * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2397f4a15fSuwe * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2497f4a15fSuwe * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2597f4a15fSuwe * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2697f4a15fSuwe * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2797f4a15fSuwe * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2897f4a15fSuwe * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2997f4a15fSuwe * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3097f4a15fSuwe * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3197f4a15fSuwe * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3297f4a15fSuwe * SUCH DAMAGE. 3397f4a15fSuwe * 3497f4a15fSuwe * from: @(#)_setjmp.s 5.1 (Berkeley) 4/23/90 3597f4a15fSuwe */ 3697f4a15fSuwe 3797f4a15fSuwe#include <machine/asm.h> 38932cacd2Suwe#include <machine/setjmp.h> 39932cacd2Suwe 4097f4a15fSuwe#if defined(LIBC_SCCS) 41*6170f597Suwe RCSID("$NetBSD: _setjmp.S,v 1.7 2006/01/05 02:04:41 uwe Exp $") 4297f4a15fSuwe#endif 4397f4a15fSuwe 4497f4a15fSuwe/* 4597f4a15fSuwe * C library -- _setjmp, _longjmp 4697f4a15fSuwe * 4797f4a15fSuwe * _longjmp(a,v) 4897f4a15fSuwe * will generate a "return(v)" from the last call to 4997f4a15fSuwe * _setjmp(a) 5097f4a15fSuwe * by restoring registers from the stack. 5197f4a15fSuwe * The previous signal state is NOT restored. 5297f4a15fSuwe */ 5397f4a15fSuwe 5497f4a15fSuweENTRY(_setjmp) 55932cacd2Suwe add #((_JB_HAS_MASK + 1) * 4), r4 5697f4a15fSuwe mov #0, r0 57932cacd2Suwe mov.l r0, @-r4 /* no saved signal mask */ 5897f4a15fSuwe mov.l r15, @-r4 5997f4a15fSuwe mov.l r14, @-r4 6097f4a15fSuwe mov.l r13, @-r4 6197f4a15fSuwe mov.l r12, @-r4 6297f4a15fSuwe mov.l r11, @-r4 6397f4a15fSuwe mov.l r10, @-r4 6497f4a15fSuwe mov.l r9, @-r4 6597f4a15fSuwe mov.l r8, @-r4 6697f4a15fSuwe sts.l pr, @-r4 6797f4a15fSuwe rts 6897f4a15fSuwe xor r0, r0 69*6170f597Suwe SET_ENTRY_SIZE(_setjmp) 7097f4a15fSuwe 7197f4a15fSuweENTRY(_longjmp) 7297f4a15fSuwe lds.l @r4+, pr 7397f4a15fSuwe mov.l @r4+, r8 7497f4a15fSuwe mov.l @r4+, r9 7597f4a15fSuwe mov.l @r4+, r10 7697f4a15fSuwe mov.l @r4+, r11 7797f4a15fSuwe mov.l @r4+, r12 7897f4a15fSuwe mov.l @r4+, r13 7997f4a15fSuwe mov.l @r4+, r14 8097f4a15fSuwe mov.l @r4+, r15 8197f4a15fSuwe 8297f4a15fSuwe mov r5, r0 8397f4a15fSuwe tst r0, r0 8497f4a15fSuwe bf .L0 8597f4a15fSuwe add #1, r0 8697f4a15fSuwe.L0: 8797f4a15fSuwe rts 8897f4a15fSuwe nop 89*6170f597Suwe SET_ENTRY_SIZE(_longjmp) 90