]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/ppc/thread_status.h
xnu-792.21.3.tar.gz
[apple/xnu.git] / osfmk / mach / ppc / thread_status.h
1 /*
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_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 License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 /*
29 * @OSF_COPYRIGHT@
30 */
31
32 #ifndef _MACH_PPC_THREAD_STATUS_H_
33 #define _MACH_PPC_THREAD_STATUS_H_
34
35 #include <mach/ppc/_types.h>
36 #include <mach/message.h>
37
38 /*
39 * ppc_thread_state is the structure that is exported to user threads for
40 * use in status/mutate calls. This structure should never change.
41 *
42 */
43
44 #define PPC_THREAD_STATE 1
45 #define PPC_FLOAT_STATE 2
46 #define PPC_EXCEPTION_STATE 3
47 #define PPC_VECTOR_STATE 4
48 #define PPC_THREAD_STATE64 5
49 #define PPC_EXCEPTION_STATE64 6
50 #define THREAD_STATE_NONE 7
51
52 /*
53 * VALID_THREAD_STATE_FLAVOR is a platform specific macro that when passed
54 * an exception flavor will return whether that is a defined flavor for
55 * that platform.
56 * The macro must be manually updated to include all of the valid exception
57 * flavors as defined above.
58 */
59 #define VALID_THREAD_STATE_FLAVOR(x) \
60 ((x == PPC_THREAD_STATE) || \
61 (x == PPC_FLOAT_STATE) || \
62 (x == PPC_EXCEPTION_STATE) || \
63 (x == PPC_VECTOR_STATE) || \
64 (x == PPC_THREAD_STATE64) || \
65 (x == PPC_EXCEPTION_STATE64) || \
66 (x == THREAD_STATE_NONE))
67
68 #ifndef _POSIX_C_SOURCE
69 typedef struct ppc_thread_state ppc_thread_state_t;
70 #else /* _POSIX_C_SOURCE */
71 typedef struct __darwin_ppc_thread_state ppc_thread_state_t;
72 #endif /* _POSIX_C_SOURCE */
73
74 #ifndef _POSIX_C_SOURCE
75 typedef struct ppc_thread_state64 ppc_thread_state64_t;
76 #endif /* _POSIX_C_SOURCE */
77
78 #ifndef _POSIX_C_SOURCE
79 typedef struct ppc_float_state ppc_float_state_t;
80 #else /* _POSIX_C_SOURCE */
81 typedef struct __darwin_ppc_float_state ppc_float_state_t;
82 #endif /* _POSIX_C_SOURCE */
83
84 #ifndef _POSIX_C_SOURCE
85 typedef struct ppc_vector_state ppc_vector_state_t;
86 #else /* _POSIX_C_SOURCE */
87 typedef struct __darwin_ppc_vector_state ppc_vector_state_t;
88 #endif /* _POSIX_C_SOURCE */
89
90 /*
91 * saved state structure
92 *
93 * This structure corresponds to the saved state.
94 *
95 */
96
97 #ifdef MACH__POSIX_C_SOURCE_PRIVATE
98
99 #include <ppc/savearea.h>
100
101 typedef struct savearea ppc_saved_state_t;
102
103 #else /* MACH__POSIX_C_SOURCE_PRIVATE */
104
105 typedef struct ppc_thread_state ppc_saved_state_t;
106
107 #endif /* MACH__POSIX_C_SOURCE_PRIVATE */
108
109 /*
110 * ppc_exception_state
111 *
112 * This structure corresponds to some additional state of the user
113 * registers as saved in the PCB upon kernel entry. They are only
114 * available if an exception is passed out of the kernel, and even
115 * then not all are guaranteed to be updated.
116 *
117 * Some padding is included in this structure which allows space for
118 * servers to store temporary values if need be, to maintain binary
119 * compatiblity.
120 */
121
122 /* Exception state for 32-bit thread (on 32-bit processor) */
123 /* Still available on 64-bit processors, but may fall short */
124 /* of covering the full potential state (hi half available). */
125
126 #ifndef _POSIX_C_SOURCE
127 typedef struct ppc_exception_state ppc_exception_state_t;
128 typedef struct ppc_exception_state64 ppc_exception_state64_t;
129 #else /* _POSIX_C_SOURCE */
130 typedef struct __darwin_ppc_exception_state ppc_exception_state_t;
131 #endif /* _POSIX_C_SOURCE */
132
133 /*
134 * Save State Flags
135 */
136
137 #define PPC_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
138 (sizeof(ppc_thread_state_t) / sizeof(int)))
139
140 #define PPC_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \
141 (sizeof(ppc_thread_state64_t) / sizeof(int)))
142
143 #define PPC_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
144 (sizeof(ppc_exception_state_t) / sizeof(int)))
145
146 #define PPC_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \
147 (sizeof(ppc_exception_state64_t) / sizeof(int)))
148
149 #define PPC_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \
150 (sizeof(ppc_float_state_t) / sizeof(int)))
151
152 #define PPC_VECTOR_STATE_COUNT ((mach_msg_type_number_t) \
153 (sizeof(ppc_vector_state_t) / sizeof(int)))
154
155 /*
156 * Machine-independent way for servers and Mach's exception mechanism to
157 * choose the most efficient state flavor for exception RPC's:
158 */
159 #define MACHINE_THREAD_STATE PPC_THREAD_STATE
160 #define MACHINE_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
161
162 /*
163 * Largest state on this machine:
164 */
165 #define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
166
167 #endif /* _MACH_PPC_THREAD_STATUS_H_ */