2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
26 #ifndef _MACH_PPC_THREAD_STATUS_H_
27 #define _MACH_PPC_THREAD_STATUS_H_
29 #include <mach/ppc/_types.h>
30 #include <mach/message.h>
33 * ppc_thread_state is the structure that is exported to user threads for
34 * use in status/mutate calls. This structure should never change.
38 #define PPC_THREAD_STATE 1
39 #define PPC_FLOAT_STATE 2
40 #define PPC_EXCEPTION_STATE 3
41 #define PPC_VECTOR_STATE 4
42 #define PPC_THREAD_STATE64 5
43 #define PPC_EXCEPTION_STATE64 6
44 #define THREAD_STATE_NONE 7
47 * VALID_THREAD_STATE_FLAVOR is a platform specific macro that when passed
48 * an exception flavor will return whether that is a defined flavor for
50 * The macro must be manually updated to include all of the valid exception
51 * flavors as defined above.
53 #define VALID_THREAD_STATE_FLAVOR(x) \
54 ((x == PPC_THREAD_STATE) || \
55 (x == PPC_FLOAT_STATE) || \
56 (x == PPC_EXCEPTION_STATE) || \
57 (x == PPC_VECTOR_STATE) || \
58 (x == PPC_THREAD_STATE64) || \
59 (x == PPC_EXCEPTION_STATE64) || \
60 (x == THREAD_STATE_NONE))
62 #ifndef _POSIX_C_SOURCE
63 typedef struct ppc_thread_state ppc_thread_state_t
;
64 #else /* _POSIX_C_SOURCE */
65 typedef struct __darwin_ppc_thread_state ppc_thread_state_t
;
66 #endif /* _POSIX_C_SOURCE */
68 #ifndef _POSIX_C_SOURCE
69 typedef struct ppc_thread_state64 ppc_thread_state64_t
;
70 #endif /* _POSIX_C_SOURCE */
72 #ifndef _POSIX_C_SOURCE
73 typedef struct ppc_float_state ppc_float_state_t
;
74 #else /* _POSIX_C_SOURCE */
75 typedef struct __darwin_ppc_float_state ppc_float_state_t
;
76 #endif /* _POSIX_C_SOURCE */
78 #ifndef _POSIX_C_SOURCE
79 typedef struct ppc_vector_state ppc_vector_state_t
;
80 #else /* _POSIX_C_SOURCE */
81 typedef struct __darwin_ppc_vector_state ppc_vector_state_t
;
82 #endif /* _POSIX_C_SOURCE */
85 * saved state structure
87 * This structure corresponds to the saved state.
91 #ifdef MACH__POSIX_C_SOURCE_PRIVATE
93 #include <ppc/savearea.h>
95 typedef struct savearea ppc_saved_state_t
;
97 #else /* MACH__POSIX_C_SOURCE_PRIVATE */
99 typedef struct ppc_thread_state ppc_saved_state_t
;
101 #endif /* MACH__POSIX_C_SOURCE_PRIVATE */
104 * ppc_exception_state
106 * This structure corresponds to some additional state of the user
107 * registers as saved in the PCB upon kernel entry. They are only
108 * available if an exception is passed out of the kernel, and even
109 * then not all are guaranteed to be updated.
111 * Some padding is included in this structure which allows space for
112 * servers to store temporary values if need be, to maintain binary
116 /* Exception state for 32-bit thread (on 32-bit processor) */
117 /* Still available on 64-bit processors, but may fall short */
118 /* of covering the full potential state (hi half available). */
120 #ifndef _POSIX_C_SOURCE
121 typedef struct ppc_exception_state ppc_exception_state_t
;
122 typedef struct ppc_exception_state64 ppc_exception_state64_t
;
123 #else /* _POSIX_C_SOURCE */
124 typedef struct __darwin_ppc_exception_state ppc_exception_state_t
;
125 #endif /* _POSIX_C_SOURCE */
131 #define PPC_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
132 (sizeof(ppc_thread_state_t) / sizeof(int)))
134 #define PPC_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \
135 (sizeof(ppc_thread_state64_t) / sizeof(int)))
137 #define PPC_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
138 (sizeof(ppc_exception_state_t) / sizeof(int)))
140 #define PPC_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \
141 (sizeof(ppc_exception_state64_t) / sizeof(int)))
143 #define PPC_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \
144 (sizeof(ppc_float_state_t) / sizeof(int)))
146 #define PPC_VECTOR_STATE_COUNT ((mach_msg_type_number_t) \
147 (sizeof(ppc_vector_state_t) / sizeof(int)))
150 * Machine-independent way for servers and Mach's exception mechanism to
151 * choose the most efficient state flavor for exception RPC's:
153 #define MACHINE_THREAD_STATE PPC_THREAD_STATE
154 #define MACHINE_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
157 * Largest state on this machine:
159 #define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
161 #endif /* _MACH_PPC_THREAD_STATUS_H_ */