]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/ppc/thread_status.h
fda17a7d8e5a57fed3995d92dff7b916384b992d
[apple/xnu.git] / osfmk / mach / ppc / thread_status.h
1 /*
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
5 *
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@
29 */
30 /*
31 * @OSF_COPYRIGHT@
32 */
33
34 #ifndef _MACH_PPC_THREAD_STATUS_H_
35 #define _MACH_PPC_THREAD_STATUS_H_
36
37 #include <mach/ppc/_types.h>
38 #include <mach/message.h>
39
40 /*
41 * ppc_thread_state is the structure that is exported to user threads for
42 * use in status/mutate calls. This structure should never change.
43 *
44 */
45
46 #define PPC_THREAD_STATE 1
47 #define PPC_FLOAT_STATE 2
48 #define PPC_EXCEPTION_STATE 3
49 #define PPC_VECTOR_STATE 4
50 #define PPC_THREAD_STATE64 5
51 #define PPC_EXCEPTION_STATE64 6
52 #define THREAD_STATE_NONE 7
53
54 /*
55 * VALID_THREAD_STATE_FLAVOR is a platform specific macro that when passed
56 * an exception flavor will return whether that is a defined flavor for
57 * that platform.
58 * The macro must be manually updated to include all of the valid exception
59 * flavors as defined above.
60 */
61 #define VALID_THREAD_STATE_FLAVOR(x) \
62 ((x == PPC_THREAD_STATE) || \
63 (x == PPC_FLOAT_STATE) || \
64 (x == PPC_EXCEPTION_STATE) || \
65 (x == PPC_VECTOR_STATE) || \
66 (x == PPC_THREAD_STATE64) || \
67 (x == PPC_EXCEPTION_STATE64) || \
68 (x == THREAD_STATE_NONE))
69
70 #ifndef _POSIX_C_SOURCE
71 typedef struct ppc_thread_state ppc_thread_state_t;
72 #else /* _POSIX_C_SOURCE */
73 typedef struct __darwin_ppc_thread_state ppc_thread_state_t;
74 #endif /* _POSIX_C_SOURCE */
75
76 #ifndef _POSIX_C_SOURCE
77 typedef struct ppc_thread_state64 ppc_thread_state64_t;
78 #endif /* _POSIX_C_SOURCE */
79
80 #ifndef _POSIX_C_SOURCE
81 typedef struct ppc_float_state ppc_float_state_t;
82 #else /* _POSIX_C_SOURCE */
83 typedef struct __darwin_ppc_float_state ppc_float_state_t;
84 #endif /* _POSIX_C_SOURCE */
85
86 #ifndef _POSIX_C_SOURCE
87 typedef struct ppc_vector_state ppc_vector_state_t;
88 #else /* _POSIX_C_SOURCE */
89 typedef struct __darwin_ppc_vector_state ppc_vector_state_t;
90 #endif /* _POSIX_C_SOURCE */
91
92 /*
93 * saved state structure
94 *
95 * This structure corresponds to the saved state.
96 *
97 */
98
99 #ifdef MACH__POSIX_C_SOURCE_PRIVATE
100
101 #include <ppc/savearea.h>
102
103 typedef struct savearea ppc_saved_state_t;
104
105 #else /* MACH__POSIX_C_SOURCE_PRIVATE */
106
107 typedef struct ppc_thread_state ppc_saved_state_t;
108
109 #endif /* MACH__POSIX_C_SOURCE_PRIVATE */
110
111 /*
112 * ppc_exception_state
113 *
114 * This structure corresponds to some additional state of the user
115 * registers as saved in the PCB upon kernel entry. They are only
116 * available if an exception is passed out of the kernel, and even
117 * then not all are guaranteed to be updated.
118 *
119 * Some padding is included in this structure which allows space for
120 * servers to store temporary values if need be, to maintain binary
121 * compatiblity.
122 */
123
124 /* Exception state for 32-bit thread (on 32-bit processor) */
125 /* Still available on 64-bit processors, but may fall short */
126 /* of covering the full potential state (hi half available). */
127
128 #ifndef _POSIX_C_SOURCE
129 typedef struct ppc_exception_state ppc_exception_state_t;
130 typedef struct ppc_exception_state64 ppc_exception_state64_t;
131 #else /* _POSIX_C_SOURCE */
132 typedef struct __darwin_ppc_exception_state ppc_exception_state_t;
133 #endif /* _POSIX_C_SOURCE */
134
135 /*
136 * Save State Flags
137 */
138
139 #define PPC_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
140 (sizeof(ppc_thread_state_t) / sizeof(int)))
141
142 #define PPC_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \
143 (sizeof(ppc_thread_state64_t) / sizeof(int)))
144
145 #define PPC_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
146 (sizeof(ppc_exception_state_t) / sizeof(int)))
147
148 #define PPC_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \
149 (sizeof(ppc_exception_state64_t) / sizeof(int)))
150
151 #define PPC_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \
152 (sizeof(ppc_float_state_t) / sizeof(int)))
153
154 #define PPC_VECTOR_STATE_COUNT ((mach_msg_type_number_t) \
155 (sizeof(ppc_vector_state_t) / sizeof(int)))
156
157 /*
158 * Machine-independent way for servers and Mach's exception mechanism to
159 * choose the most efficient state flavor for exception RPC's:
160 */
161 #define MACHINE_THREAD_STATE PPC_THREAD_STATE
162 #define MACHINE_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
163
164 /*
165 * Largest state on this machine:
166 */
167 #define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
168
169 #endif /* _MACH_PPC_THREAD_STATUS_H_ */