]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
91447636 | 2 | * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. |
1c79356b A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
e5568f75 A |
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. | |
1c79356b | 11 | * |
e5568f75 A |
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 | |
1c79356b A |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
e5568f75 A |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
1c79356b A |
19 | * |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* Copyright (c) 1998 Apple Computer, Inc. All rights reserved. | |
23 | * | |
24 | * File: ppc/setjmp.h | |
25 | * | |
26 | * Declaration of setjmp routines and data structures. | |
27 | */ | |
28 | #ifndef _BSD_PPC_SETJMP_H_ | |
29 | #define _BSD_PPC_SETJMP_H_ | |
30 | ||
31 | #include <sys/cdefs.h> | |
32 | #include <machine/signal.h> | |
33 | ||
34 | struct _jmp_buf { | |
35 | struct sigcontext sigcontext; /* kernel state preserved by set/longjmp */ | |
91447636 A |
36 | unsigned int vmask __attribute__((aligned(8))); /* vector mask register */ |
37 | unsigned int vreg[32 * 4] __attribute__((aligned(16))); | |
1c79356b A |
38 | /* 32 128-bit vector registers */ |
39 | }; | |
40 | ||
41 | /* | |
42 | * _JBLEN is number of ints required to save the following: | |
91447636 A |
43 | * r1, r2, r13-r31, lr, cr, ctr, xer, sig == 26 register_t sized |
44 | * fr14 - fr31 = 18 doubles | |
1c79356b A |
45 | * vmask, 32 vector registers = 129 ints |
46 | * 2 ints to get all the elements aligned | |
91447636 A |
47 | * |
48 | * register_t is 2 ints for ppc64 threads | |
1c79356b | 49 | */ |
91447636 A |
50 | #define _JBLEN64 (26*2 + 18*2 + 129 + 1) |
51 | #define _JBLEN32 (26 + 18*2 + 129 + 1) | |
52 | #define _JBLEN_MAX _JBLEN64 | |
1c79356b | 53 | |
91447636 A |
54 | /* |
55 | * Locally scoped sizes | |
56 | */ | |
57 | #if defined(__ppc64__) | |
58 | #define _JBLEN _JBLEN64 | |
59 | #else | |
60 | #define _JBLEN _JBLEN32 | |
61 | #endif | |
1c79356b A |
62 | |
63 | #if defined(KERNEL) | |
91447636 A |
64 | typedef struct sigcontext32 jmp_buf32[1]; |
65 | typedef struct __sigjmp_buf32 { | |
66 | int __storage[_JBLEN32 + 1] __attribute__((aligned(8))); | |
67 | } sigjmp_buf32[1]; | |
68 | ||
69 | typedef struct sigcontext64 jmp_buf64[1]; | |
70 | typedef struct __sigjmp_buf64 { | |
71 | int __storage[_JBLEN64 + 1] __attribute__((aligned(8))); | |
72 | } sigjmp_buf64[1]; | |
73 | ||
74 | /* | |
75 | * JMM - have to decide how the kernel will deal with this. | |
76 | * For now, hard-code the 32-bit types. | |
77 | */ | |
78 | typedef struct sigcontext32 jmp_buf[1]; | |
79 | typedef struct __sigjmp_buf32 sigjmp_buf[1]; | |
80 | ||
1c79356b A |
81 | #else |
82 | typedef int jmp_buf[_JBLEN]; | |
83 | typedef int sigjmp_buf[_JBLEN + 1]; | |
84 | #endif | |
85 | ||
86 | __BEGIN_DECLS | |
91447636 A |
87 | extern int setjmp(jmp_buf env); |
88 | extern void longjmp(jmp_buf env, int val); | |
1c79356b A |
89 | |
90 | #ifndef _ANSI_SOURCE | |
91447636 A |
91 | int _setjmp(jmp_buf env); |
92 | void _longjmp(jmp_buf, int val); | |
93 | int sigsetjmp(sigjmp_buf env, int val); | |
94 | void siglongjmp(sigjmp_buf env, int val); | |
1c79356b A |
95 | #endif /* _ANSI_SOURCE */ |
96 | ||
91447636 A |
97 | #if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) |
98 | void longjmperror(void); | |
1c79356b A |
99 | #endif /* neither ANSI nor POSIX */ |
100 | __END_DECLS | |
101 | ||
102 | #endif /* !_BSD_PPC_SETJMP_H_ */ |