2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
30 * C library -- _setjmp, _longjmp
33 * will generate a "return(v)" from
36 * by restoring registers from the stack,
37 * The previous signal state is NOT restored.
39 * NOTE : MUST BE KEPT CONSISTENT WITH gdb/config/powerpc/tm-ppc-eabi.h
40 * (which needs to know where to find the destination address)
46 * setjmp : ARG0 (r3) contains the address of
47 * the structure where we are to
49 * Uses r0 as scratch register
51 * NOTE : MUST BE KEPT CONSISTENT WITH gdb/config/powerpc/tm-ppc-eabi.h
52 * (which needs to know where to find the destination address)
55 ENTRY(_setjmp,TAG_NO_FRAME_USED)
56 /* first entry is used for r1 - stack ptr */
57 stw r13, 4(ARG0) /* GPR context. We avoid multiple-word */
58 stw r14, 8(ARG0) /* instructions as they're slower (?) */
78 stw r0, 80(ARG0) /* Condition register */
81 stw r0, 84(ARG0) /* Link register */
84 stw r0, 88(ARG0) /* Fixed point exception register */
86 #if FLOATING_POINT_SUPPORT /* TODO NMGS probably not needed for kern */
88 stw r0, 92(ARG0) /* Floating point status register */
90 stfd f14, 96(ARG0) /* Floating point context - 8 byte aligned */
111 stw r1, 0(ARG0) /* finally, save the stack pointer */
112 li ARG0, 0 /* setjmp must return zero */
116 * longjmp : ARG0 (r3) contains the address of
117 * the structure from where we are to
118 * restore the context.
119 * ARG1 (r4) contains the non-zero
120 * value that we must return to
122 * Uses r0 as scratch register
124 * NOTE : MUST BE KEPT CONSISTENT WITH gdb/config/powerpc/tm-ppc-eabi.h
125 * (which needs to know where to find the destination address)
128 ENTRY(_longjmp, TAG_NO_FRAME_USED) /* TODO NMGS - need correct tag */
129 lwz r13, 4(ARG0) /* GPR context. We avoid multiple-word */
130 lwz r14, 8(ARG0) /* instructions as they're slower (?) */
149 lwz r0, 80(ARG0) /* Condition register */
150 mtcr r0 /* Use r5 as scratch register */
152 lwz r0, 84(ARG0) /* Link register */
155 lwz r0, 88(ARG0) /* Fixed point exception register */
158 #ifdef FLOATING_POINT_SUPPORT
159 lwz r0, 92(ARG0) /* Floating point status register */
162 lfd f14, 96(ARG0) /* Floating point context - 8 byte aligned */
181 #endif /* FLOATING_POINT_SUPPORT */
184 lwz r1, 0(ARG0) /* finally, restore the stack pointer */
186 mr. ARG0, ARG1 /* set the return value */
187 bnelr /* return if non-zero */
190 blr /* never return 0, return 1 instead */