]> git.saurik.com Git - apple/libc.git/blame - ppc/sys/_setjmp.h
Libc-763.11.tar.gz
[apple/libc.git] / ppc / sys / _setjmp.h
CommitLineData
e9ce8d39
A
1/*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
734aad71
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
e9ce8d39
A
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
734aad71
A
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
e9ce8d39
A
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * Copyright (c) 1998, Apple Computer Inc. All rights reserved.
25 *
26 * File: _setjmp.h
27 *
28 * Defines for register offsets in the save area.
29 *
30 */
31
3b2a1fe8
A
32/* NOTE: jmp_bufs are only 4-byte aligned. This means we
33 * need to pad before the VR and FPR save areas, so that they
34 * can be naturally aligned in the buffer. In case a jmp_buf
35 * is bcopy'd to a different alignment between the setjmp
36 * and longjmp, we need to save the jmp_buf address in the
37 * jmp_buf at setjmp time, so we can realign before reloading.
59e0d9fe
A
38 *
39 * ALSO NOTE: the typedef for jmpbufs in <ppc/setjmp.h> is
40 * 192 ints (0x300 bytes) long, due to incorrectly assuming
41 * that we need to save all 32 VRs in a jmpbuf. This is
42 * fortuitous, because when it came time to add additional
43 * fields and expand GPRs for 64-bit mode, there was plenty
44 * of unused space!
3b2a1fe8
A
45 */
46
59e0d9fe
A
47 /* 32-bit-mode layout */
48
49#if defined(__ppc__)
50
e9ce8d39
A
51#define JMP_r1 0x00
52#define JMP_r2 0x04
53#define JMP_r13 0x08
54#define JMP_r14 0x0c
55#define JMP_r15 0x10
56#define JMP_r16 0x14
57#define JMP_r17 0x18
58#define JMP_r18 0x1c
59#define JMP_r19 0x20
60#define JMP_r20 0x24
61#define JMP_r21 0x28
62#define JMP_r22 0x2c
63#define JMP_r23 0x30
64#define JMP_r24 0x34
65#define JMP_r25 0x38
66#define JMP_r26 0x3c
67#define JMP_r27 0x40
68#define JMP_r28 0x44
69#define JMP_r29 0x48
70#define JMP_r30 0x4c
71#define JMP_r31 0x50
72#define JMP_lr 0x54
73#define JMP_cr 0x58
59e0d9fe
A
74#define JMP_SIGFLAG 0x5c
75#define JMP_sig 0x60 /* reserve 8 bytes for sigmask */
76#define JMP_fpscr 0x68 /* reserve 8 bytes for FPSCR too */
3b2a1fe8
A
77#define JMP_vrsave 0x70
78#define JMP_addr_at_setjmp 0x74
79/* 12 bytes padding here */
80#define JMP_vr_base_addr 0x84
81/* save room for 12 VRs (v20-v31), or 0xC0 bytes */
82#define JMP_fp_base_addr 0x144
83/* save room for 18 FPRs (f14-f31), or 0x90 bytes */
224c7076
A
84#define JMP_ss_flags 0x1d4
85#define JMP_buf_end 0x1d8
3b2a1fe8 86
59e0d9fe
A
87
88 /* 64-bit-mode layout */
89
90#elif defined(__ppc64__)
91
92#define JMP_r1 0x00
93#define JMP_r2 0x08
94#define JMP_r13 0x10
95#define JMP_r14 0x18
96#define JMP_r15 0x20
97#define JMP_r16 0x28
98#define JMP_r17 0x30
99#define JMP_r18 0x38
100#define JMP_r19 0x40
101#define JMP_r20 0x48
102#define JMP_r21 0x50
103#define JMP_r22 0x58
104#define JMP_r23 0x60
105#define JMP_r24 0x68
106#define JMP_r25 0x70
107#define JMP_r26 0x78
108#define JMP_r27 0x80
109#define JMP_r28 0x88
110#define JMP_r29 0x90
111#define JMP_r30 0x98
112#define JMP_r31 0xa0
113#define JMP_lr 0xa8
114#define JMP_cr 0xb0
115#define JMP_sig 0xb8
116#define JMP_SIGFLAG 0xc0
117#define JMP_fpscr 0xc8
118#define JMP_vrsave 0xd0
119#define JMP_addr_at_setjmp 0xd8
120/* 12 bytes padding here */
121#define JMP_vr_base_addr 0x0ec
122/* save room for 12 VRs (v20-v31), or 0xC0 bytes */
123#define JMP_fp_base_addr 0x1ac
124/* save room for 18 FPRs (f14-f31), or 0x90 bytes */
224c7076
A
125#define JMP_ss_flags 0x23c
126#define JMP_buf_end 0x240
59e0d9fe
A
127
128#else
129#error architecture not supported
130#endif