2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
27 * C library -- _setjmp, _longjmp
30 * will generate a "return(v)" from
33 * by restoring registers from the stack,
34 * The previous signal state is NOT restored.
36 * NOTE : MUST BE KEPT CONSISTENT WITH gdb/config/powerpc/tm-ppc-eabi.h
37 * (which needs to know where to find the destination address)
43 * setjmp : ARG0 (r3) contains the address of
44 * the structure where we are to
46 * Uses r0 as scratch register
48 * NOTE : MUST BE KEPT CONSISTENT WITH gdb/config/powerpc/tm-ppc-eabi.h
49 * (which needs to know where to find the destination address)
52 ENTRY(_setjmp,TAG_NO_FRAME_USED)
53 /* first entry is used for r1 - stack ptr */
54 stw r13, 4(ARG0) /* GPR context. We avoid multiple-word */
55 stw r14, 8(ARG0) /* instructions as they're slower (?) */
75 stw r0, 80(ARG0) /* Condition register */
78 stw r0, 84(ARG0) /* Link register */
81 stw r0, 88(ARG0) /* Fixed point exception register */
83 #if FLOATING_POINT_SUPPORT /* TODO NMGS probably not needed for kern */
85 stw r0, 92(ARG0) /* Floating point status register */
87 stfd f14, 96(ARG0) /* Floating point context - 8 byte aligned */
108 stw r1, 0(ARG0) /* finally, save the stack pointer */
109 li ARG0, 0 /* setjmp must return zero */
113 * longjmp : ARG0 (r3) contains the address of
114 * the structure from where we are to
115 * restore the context.
116 * ARG1 (r4) contains the non-zero
117 * value that we must return to
119 * Uses r0 as scratch register
121 * NOTE : MUST BE KEPT CONSISTENT WITH gdb/config/powerpc/tm-ppc-eabi.h
122 * (which needs to know where to find the destination address)
125 ENTRY(_longjmp, TAG_NO_FRAME_USED) /* TODO NMGS - need correct tag */
126 lwz r13, 4(ARG0) /* GPR context. We avoid multiple-word */
127 lwz r14, 8(ARG0) /* instructions as they're slower (?) */
146 lwz r0, 80(ARG0) /* Condition register */
147 mtcr r0 /* Use r5 as scratch register */
149 lwz r0, 84(ARG0) /* Link register */
152 lwz r0, 88(ARG0) /* Fixed point exception register */
155 #ifdef FLOATING_POINT_SUPPORT
156 lwz r0, 92(ARG0) /* Floating point status register */
159 lfd f14, 96(ARG0) /* Floating point context - 8 byte aligned */
178 #endif /* FLOATING_POINT_SUPPORT */
181 lwz r1, 0(ARG0) /* finally, restore the stack pointer */
183 mr. ARG0, ARG1 /* set the return value */
184 bnelr /* return if non-zero */
187 blr /* never return 0, return 1 instead */