2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_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 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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
32 #ifndef _MACH_PPC_THREAD_STATUS_H_
33 #define _MACH_PPC_THREAD_STATUS_H_
35 #include <mach/ppc/_types.h>
36 #include <mach/message.h>
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.
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
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
56 * The macro must be manually updated to include all of the valid exception
57 * flavors as defined above.
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))
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 */
74 #ifndef _POSIX_C_SOURCE
75 typedef struct ppc_thread_state64 ppc_thread_state64_t
;
76 #endif /* _POSIX_C_SOURCE */
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 */
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 */
91 * saved state structure
93 * This structure corresponds to the saved state.
97 #ifdef MACH__POSIX_C_SOURCE_PRIVATE
99 #include <ppc/savearea.h>
101 typedef struct savearea ppc_saved_state_t
;
103 #else /* MACH__POSIX_C_SOURCE_PRIVATE */
105 typedef struct ppc_thread_state ppc_saved_state_t
;
107 #endif /* MACH__POSIX_C_SOURCE_PRIVATE */
110 * ppc_exception_state
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.
117 * Some padding is included in this structure which allows space for
118 * servers to store temporary values if need be, to maintain binary
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). */
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 */
137 #define PPC_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
138 (sizeof(ppc_thread_state_t) / sizeof(int)))
140 #define PPC_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \
141 (sizeof(ppc_thread_state64_t) / sizeof(int)))
143 #define PPC_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
144 (sizeof(ppc_exception_state_t) / sizeof(int)))
146 #define PPC_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \
147 (sizeof(ppc_exception_state64_t) / sizeof(int)))
149 #define PPC_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \
150 (sizeof(ppc_float_state_t) / sizeof(int)))
152 #define PPC_VECTOR_STATE_COUNT ((mach_msg_type_number_t) \
153 (sizeof(ppc_vector_state_t) / sizeof(int)))
156 * Machine-independent way for servers and Mach's exception mechanism to
157 * choose the most efficient state flavor for exception RPC's:
159 #define MACHINE_THREAD_STATE PPC_THREAD_STATE
160 #define MACHINE_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
163 * Largest state on this machine:
165 #define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
167 #endif /* _MACH_PPC_THREAD_STATUS_H_ */