/*-1* Copyright (c) 2002 Peter Grehan.2* All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12*13* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND14* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE15* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE16* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE17* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL18* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS19* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)20* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT21* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY22* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF23* SUCH DAMAGE.24*/25/* $NetBSD: _setjmp.S,v 1.1 1997/03/29 20:55:53 thorpej Exp $ */2627#include <machine/asm.h>28/*29* C library -- _setjmp, _longjmp30*31* _longjmp(a,v)32* will generate a "return(v?v:1)" from the last call to33* _setjmp(a)34* by restoring registers from the stack.35* The previous signal state is NOT restored.36*37* jmpbuf layout:38* +------------+39* | unused |40* +------------+41* | unused |42* | |43* | (4 words) |44* | |45* +------------+46* | saved regs |47* | ... |48*/4950ENTRY(_setjmp)51mflr %r1152mfcr %r1253mr %r10,%r154mr %r9,%r255stmw %r9,20(%r3)5657/* FPRs */58stfd %f14,112+0*8(%r3)59stfd %f15,112+1*8(%r3)60stfd %f16,112+2*8(%r3)61stfd %f17,112+3*8(%r3)62stfd %f18,112+4*8(%r3)63stfd %f19,112+5*8(%r3)64stfd %f20,112+6*8(%r3)65stfd %f21,112+7*8(%r3)66stfd %f22,112+8*8(%r3)67stfd %f23,112+9*8(%r3)68stfd %f24,112+10*8(%r3)69stfd %f25,112+11*8(%r3)70stfd %f26,112+12*8(%r3)71stfd %f27,112+13*8(%r3)72stfd %f28,112+14*8(%r3)73stfd %f29,112+15*8(%r3)74stfd %f30,112+16*8(%r3)75stfd %f31,112+17*8(%r3)7677li %r3,078blr79END(_setjmp)8081ENTRY(_longjmp)82lmw %r9,20(%r3)8384/* FPRs */85lfd %f14,112+0*8(%r3)86lfd %f15,112+1*8(%r3)87lfd %f16,112+2*8(%r3)88lfd %f17,112+3*8(%r3)89lfd %f18,112+4*8(%r3)90lfd %f19,112+5*8(%r3)91lfd %f20,112+6*8(%r3)92lfd %f21,112+7*8(%r3)93lfd %f22,112+8*8(%r3)94lfd %f23,112+9*8(%r3)95lfd %f24,112+10*8(%r3)96lfd %f25,112+11*8(%r3)97lfd %f26,112+12*8(%r3)98lfd %f27,112+13*8(%r3)99lfd %f28,112+14*8(%r3)100lfd %f29,112+15*8(%r3)101lfd %f30,112+16*8(%r3)102lfd %f31,112+17*8(%r3)103104mtlr %r11105mtcr %r12106mr %r1,%r10107or. %r3,%r4,%r4108bnelr109li %r3,1110blr111END(_longjmp)112113.section .note.GNU-stack,"",%progbits114115116