/*-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,%r255std %r9,40 + 0*8(%r3)56stfd %f14,40 + 23*8(%r3)57std %r10,40 + 1*8(%r3)58stfd %f15,40 + 24*8(%r3)59std %r11,40 + 2*8(%r3)60stfd %f16,40 + 25*8(%r3)61std %r12,40 + 3*8(%r3)62stfd %f17,40 + 26*8(%r3)63std %r13,40 + 4*8(%r3)64stfd %f18,40 + 27*8(%r3)65std %r14,40 + 5*8(%r3)66stfd %f19,40 + 28*8(%r3)67std %r15,40 + 6*8(%r3)68stfd %f20,40 + 29*8(%r3)69std %r16,40 + 7*8(%r3)70stfd %f21,40 + 30*8(%r3)71std %r17,40 + 8*8(%r3)72stfd %f22,40 + 31*8(%r3)73std %r18,40 + 9*8(%r3)74stfd %f23,40 + 32*8(%r3)75std %r19,40 + 10*8(%r3)76stfd %f24,40 + 33*8(%r3)77std %r20,40 + 11*8(%r3)78stfd %f25,40 + 34*8(%r3)79std %r21,40 + 12*8(%r3)80stfd %f26,40 + 35*8(%r3)81std %r22,40 + 13*8(%r3)82stfd %f27,40 + 36*8(%r3)83std %r23,40 + 14*8(%r3)84stfd %f28,40 + 37*8(%r3)85std %r24,40 + 15*8(%r3)86stfd %f29,40 + 38*8(%r3)87std %r25,40 + 16*8(%r3)88stfd %f30,40 + 39*8(%r3)89std %r26,40 + 17*8(%r3)90stfd %f31,40 + 40*8(%r3)91std %r27,40 + 18*8(%r3)92std %r28,40 + 19*8(%r3)93std %r29,40 + 20*8(%r3)94std %r30,40 + 21*8(%r3)95std %r31,40 + 22*8(%r3)96li %r3,097blr98END(_setjmp)99100ENTRY(_longjmp)101ld %r9,40 + 0*8(%r3)102lfd %f14,40 + 23*8(%r3)103ld %r10,40 + 1*8(%r3)104lfd %f15,40 + 24*8(%r3)105ld %r11,40 + 2*8(%r3)106lfd %f16,40 + 25*8(%r3)107ld %r12,40 + 3*8(%r3)108lfd %f17,40 + 26*8(%r3)109ld %r14,40 + 5*8(%r3)110lfd %f18,40 + 27*8(%r3)111ld %r15,40 + 6*8(%r3)112lfd %f19,40 + 28*8(%r3)113ld %r16,40 + 7*8(%r3)114lfd %f20,40 + 29*8(%r3)115ld %r17,40 + 8*8(%r3)116lfd %f21,40 + 30*8(%r3)117ld %r18,40 + 9*8(%r3)118lfd %f22,40 + 31*8(%r3)119ld %r19,40 + 10*8(%r3)120lfd %f23,40 + 32*8(%r3)121ld %r20,40 + 11*8(%r3)122lfd %f24,40 + 33*8(%r3)123ld %r21,40 + 12*8(%r3)124lfd %f25,40 + 34*8(%r3)125ld %r22,40 + 13*8(%r3)126lfd %f26,40 + 35*8(%r3)127ld %r23,40 + 14*8(%r3)128lfd %f27,40 + 36*8(%r3)129ld %r24,40 + 15*8(%r3)130lfd %f28,40 + 37*8(%r3)131ld %r25,40 + 16*8(%r3)132lfd %f29,40 + 38*8(%r3)133ld %r26,40 + 17*8(%r3)134lfd %f30,40 + 39*8(%r3)135ld %r27,40 + 18*8(%r3)136lfd %f31,40 + 40*8(%r3)137ld %r28,40 + 19*8(%r3)138ld %r29,40 + 20*8(%r3)139ld %r30,40 + 21*8(%r3)140ld %r31,40 + 22*8(%r3)141142mtlr %r11143mtcr %r12144mr %r2,%r9145mr %r1,%r10146or. %r3,%r4,%r4147bnelr148li %r3,1149blr150END(_longjmp)151152.section .note.GNU-stack,"",%progbits153154155