]> git.saurik.com Git - apple/libc.git/blob - ppc/sys/_setjmp.h
8d5da57cb284df3c840d156ff1c4f26f44834442
[apple/libc.git] / ppc / sys / _setjmp.h
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
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
13 * file.
14 *
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.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 * Copyright (c) 1998, Apple Computer Inc. All rights reserved.
27 *
28 * File: _setjmp.h
29 *
30 * Defines for register offsets in the save area.
31 *
32 */
33
34 /* NOTE: jmp_bufs are only 4-byte aligned. This means we
35 * need to pad before the VR and FPR save areas, so that they
36 * can be naturally aligned in the buffer. In case a jmp_buf
37 * is bcopy'd to a different alignment between the setjmp
38 * and longjmp, we need to save the jmp_buf address in the
39 * jmp_buf at setjmp time, so we can realign before reloading.
40 *
41 * ALSO NOTE: the typedef for jmpbufs in <ppc/setjmp.h> is
42 * 192 ints (0x300 bytes) long, due to incorrectly assuming
43 * that we need to save all 32 VRs in a jmpbuf. This is
44 * fortuitous, because when it came time to add additional
45 * fields and expand GPRs for 64-bit mode, there was plenty
46 * of unused space!
47 */
48
49 /* 32-bit-mode layout */
50
51 #if defined(__ppc__)
52
53 #define JMP_r1 0x00
54 #define JMP_r2 0x04
55 #define JMP_r13 0x08
56 #define JMP_r14 0x0c
57 #define JMP_r15 0x10
58 #define JMP_r16 0x14
59 #define JMP_r17 0x18
60 #define JMP_r18 0x1c
61 #define JMP_r19 0x20
62 #define JMP_r20 0x24
63 #define JMP_r21 0x28
64 #define JMP_r22 0x2c
65 #define JMP_r23 0x30
66 #define JMP_r24 0x34
67 #define JMP_r25 0x38
68 #define JMP_r26 0x3c
69 #define JMP_r27 0x40
70 #define JMP_r28 0x44
71 #define JMP_r29 0x48
72 #define JMP_r30 0x4c
73 #define JMP_r31 0x50
74 #define JMP_lr 0x54
75 #define JMP_cr 0x58
76 #define JMP_SIGFLAG 0x5c
77 #define JMP_sig 0x60 /* reserve 8 bytes for sigmask */
78 #define JMP_fpscr 0x68 /* reserve 8 bytes for FPSCR too */
79 #define JMP_vrsave 0x70
80 #define JMP_addr_at_setjmp 0x74
81 /* 12 bytes padding here */
82 #define JMP_vr_base_addr 0x84
83 /* save room for 12 VRs (v20-v31), or 0xC0 bytes */
84 #define JMP_fp_base_addr 0x144
85 /* save room for 18 FPRs (f14-f31), or 0x90 bytes */
86 #define JMP_buf_end 0x1d4
87
88
89 /* 64-bit-mode layout */
90
91 #elif defined(__ppc64__)
92
93 #define JMP_r1 0x00
94 #define JMP_r2 0x08
95 #define JMP_r13 0x10
96 #define JMP_r14 0x18
97 #define JMP_r15 0x20
98 #define JMP_r16 0x28
99 #define JMP_r17 0x30
100 #define JMP_r18 0x38
101 #define JMP_r19 0x40
102 #define JMP_r20 0x48
103 #define JMP_r21 0x50
104 #define JMP_r22 0x58
105 #define JMP_r23 0x60
106 #define JMP_r24 0x68
107 #define JMP_r25 0x70
108 #define JMP_r26 0x78
109 #define JMP_r27 0x80
110 #define JMP_r28 0x88
111 #define JMP_r29 0x90
112 #define JMP_r30 0x98
113 #define JMP_r31 0xa0
114 #define JMP_lr 0xa8
115 #define JMP_cr 0xb0
116 #define JMP_sig 0xb8
117 #define JMP_SIGFLAG 0xc0
118 #define JMP_fpscr 0xc8
119 #define JMP_vrsave 0xd0
120 #define JMP_addr_at_setjmp 0xd8
121 /* 12 bytes padding here */
122 #define JMP_vr_base_addr 0x0ec
123 /* save room for 12 VRs (v20-v31), or 0xC0 bytes */
124 #define JMP_fp_base_addr 0x1ac
125 /* save room for 18 FPRs (f14-f31), or 0x90 bytes */
126 #define JMP_buf_end 0x23c
127
128 #else
129 #error architecture not supported
130 #endif