]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
5d5c5d0d A |
2 | * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. |
3 | * | |
8ad349bb | 4 | * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ |
1c79356b | 5 | * |
8ad349bb 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. The rights granted to you under the | |
10 | * License may not be used to create, or enable the creation or | |
11 | * redistribution of, unlawful or unlicensed copies of an Apple operating | |
12 | * system, or to circumvent, violate, or enable the circumvention or | |
13 | * violation of, any terms of an Apple operating system software license | |
14 | * agreement. | |
15 | * | |
16 | * Please obtain a copy of the License at | |
17 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
18 | * file. | |
19 | * | |
20 | * The Original Code and all software distributed under the License are | |
21 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
22 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
23 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
24 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
25 | * Please see the License for the specific language governing rights and | |
26 | * limitations under the License. | |
27 | * | |
28 | * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ | |
1c79356b A |
29 | */ |
30 | /* Copyright (c) 1998 Apple Computer, Inc. All rights reserved. | |
31 | * | |
32 | * File: ppc/setjmp.h | |
33 | * | |
34 | * Declaration of setjmp routines and data structures. | |
35 | */ | |
36 | #ifndef _BSD_PPC_SETJMP_H_ | |
37 | #define _BSD_PPC_SETJMP_H_ | |
38 | ||
39 | #include <sys/cdefs.h> | |
40 | #include <machine/signal.h> | |
41 | ||
42 | struct _jmp_buf { | |
43 | struct sigcontext sigcontext; /* kernel state preserved by set/longjmp */ | |
91447636 A |
44 | unsigned int vmask __attribute__((aligned(8))); /* vector mask register */ |
45 | unsigned int vreg[32 * 4] __attribute__((aligned(16))); | |
1c79356b A |
46 | /* 32 128-bit vector registers */ |
47 | }; | |
48 | ||
49 | /* | |
50 | * _JBLEN is number of ints required to save the following: | |
91447636 A |
51 | * r1, r2, r13-r31, lr, cr, ctr, xer, sig == 26 register_t sized |
52 | * fr14 - fr31 = 18 doubles | |
1c79356b A |
53 | * vmask, 32 vector registers = 129 ints |
54 | * 2 ints to get all the elements aligned | |
91447636 A |
55 | * |
56 | * register_t is 2 ints for ppc64 threads | |
1c79356b | 57 | */ |
91447636 A |
58 | #define _JBLEN64 (26*2 + 18*2 + 129 + 1) |
59 | #define _JBLEN32 (26 + 18*2 + 129 + 1) | |
60 | #define _JBLEN_MAX _JBLEN64 | |
1c79356b | 61 | |
91447636 A |
62 | /* |
63 | * Locally scoped sizes | |
64 | */ | |
65 | #if defined(__ppc64__) | |
66 | #define _JBLEN _JBLEN64 | |
67 | #else | |
68 | #define _JBLEN _JBLEN32 | |
69 | #endif | |
1c79356b A |
70 | |
71 | #if defined(KERNEL) | |
91447636 A |
72 | typedef struct sigcontext32 jmp_buf32[1]; |
73 | typedef struct __sigjmp_buf32 { | |
74 | int __storage[_JBLEN32 + 1] __attribute__((aligned(8))); | |
75 | } sigjmp_buf32[1]; | |
76 | ||
77 | typedef struct sigcontext64 jmp_buf64[1]; | |
78 | typedef struct __sigjmp_buf64 { | |
79 | int __storage[_JBLEN64 + 1] __attribute__((aligned(8))); | |
80 | } sigjmp_buf64[1]; | |
81 | ||
82 | /* | |
83 | * JMM - have to decide how the kernel will deal with this. | |
84 | * For now, hard-code the 32-bit types. | |
85 | */ | |
86 | typedef struct sigcontext32 jmp_buf[1]; | |
87 | typedef struct __sigjmp_buf32 sigjmp_buf[1]; | |
88 | ||
1c79356b A |
89 | #else |
90 | typedef int jmp_buf[_JBLEN]; | |
91 | typedef int sigjmp_buf[_JBLEN + 1]; | |
92 | #endif | |
93 | ||
94 | __BEGIN_DECLS | |
91447636 A |
95 | extern int setjmp(jmp_buf env); |
96 | extern void longjmp(jmp_buf env, int val); | |
1c79356b A |
97 | |
98 | #ifndef _ANSI_SOURCE | |
91447636 A |
99 | int _setjmp(jmp_buf env); |
100 | void _longjmp(jmp_buf, int val); | |
101 | int sigsetjmp(sigjmp_buf env, int val); | |
102 | void siglongjmp(sigjmp_buf env, int val); | |
1c79356b A |
103 | #endif /* _ANSI_SOURCE */ |
104 | ||
91447636 A |
105 | #if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) |
106 | void longjmperror(void); | |
1c79356b A |
107 | #endif /* neither ANSI nor POSIX */ |
108 | __END_DECLS | |
109 | ||
110 | #endif /* !_BSD_PPC_SETJMP_H_ */ |