2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
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
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
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.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
34 #ifndef _MACH_PPC_THREAD_STATUS_H_
35 #define _MACH_PPC_THREAD_STATUS_H_
37 #include <mach/ppc/_types.h>
38 #include <mach/message.h>
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.
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
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
58 * The macro must be manually updated to include all of the valid exception
59 * flavors as defined above.
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))
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 */
76 #ifndef _POSIX_C_SOURCE
77 typedef struct ppc_thread_state64 ppc_thread_state64_t
;
78 #endif /* _POSIX_C_SOURCE */
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 */
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 */
93 * saved state structure
95 * This structure corresponds to the saved state.
99 #ifdef MACH__POSIX_C_SOURCE_PRIVATE
101 #include <ppc/savearea.h>
103 typedef struct savearea ppc_saved_state_t
;
105 #else /* MACH__POSIX_C_SOURCE_PRIVATE */
107 typedef struct ppc_thread_state ppc_saved_state_t
;
109 #endif /* MACH__POSIX_C_SOURCE_PRIVATE */
112 * ppc_exception_state
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.
119 * Some padding is included in this structure which allows space for
120 * servers to store temporary values if need be, to maintain binary
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). */
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 */
139 #define PPC_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
140 (sizeof(ppc_thread_state_t) / sizeof(int)))
142 #define PPC_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \
143 (sizeof(ppc_thread_state64_t) / sizeof(int)))
145 #define PPC_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
146 (sizeof(ppc_exception_state_t) / sizeof(int)))
148 #define PPC_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \
149 (sizeof(ppc_exception_state64_t) / sizeof(int)))
151 #define PPC_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \
152 (sizeof(ppc_float_state_t) / sizeof(int)))
154 #define PPC_VECTOR_STATE_COUNT ((mach_msg_type_number_t) \
155 (sizeof(ppc_vector_state_t) / sizeof(int)))
158 * Machine-independent way for servers and Mach's exception mechanism to
159 * choose the most efficient state flavor for exception RPC's:
161 #define MACHINE_THREAD_STATE PPC_THREAD_STATE
162 #define MACHINE_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
165 * Largest state on this machine:
167 #define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
169 #endif /* _MACH_PPC_THREAD_STATUS_H_ */