]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/ppc/thread_status.h
xnu-792.13.8.tar.gz
[apple/xnu.git] / osfmk / mach / ppc / thread_status.h
CommitLineData
1c79356b 1/*
91447636 2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
1c79356b 3 *
8ad349bb 4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
1c79356b 5 *
8ad349bb
A
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@
1c79356b
A
29 */
30/*
31 * @OSF_COPYRIGHT@
32 */
33
34#ifndef _MACH_PPC_THREAD_STATUS_H_
35#define _MACH_PPC_THREAD_STATUS_H_
36
91447636
A
37#include <mach/ppc/_types.h>
38#include <mach/message.h>
9bccf70c 39
1c79356b
A
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
55e303ae
A
50#define PPC_THREAD_STATE64 5
51#define PPC_EXCEPTION_STATE64 6
1c79356b
A
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) || \
55e303ae 64 (x == PPC_EXCEPTION_STATE) || \
1c79356b 65 (x == PPC_VECTOR_STATE) || \
55e303ae
A
66 (x == PPC_THREAD_STATE64) || \
67 (x == PPC_EXCEPTION_STATE64) || \
1c79356b
A
68 (x == THREAD_STATE_NONE))
69
91447636
A
70#ifndef _POSIX_C_SOURCE
71typedef struct ppc_thread_state ppc_thread_state_t;
72#else /* _POSIX_C_SOURCE */
73typedef struct __darwin_ppc_thread_state ppc_thread_state_t;
74#endif /* _POSIX_C_SOURCE */
75
76#ifndef _POSIX_C_SOURCE
77typedef struct ppc_thread_state64 ppc_thread_state64_t;
78#endif /* _POSIX_C_SOURCE */
79
80#ifndef _POSIX_C_SOURCE
81typedef struct ppc_float_state ppc_float_state_t;
82#else /* _POSIX_C_SOURCE */
83typedef struct __darwin_ppc_float_state ppc_float_state_t;
84#endif /* _POSIX_C_SOURCE */
85
86#ifndef _POSIX_C_SOURCE
87typedef struct ppc_vector_state ppc_vector_state_t;
88#else /* _POSIX_C_SOURCE */
89typedef struct __darwin_ppc_vector_state ppc_vector_state_t;
90#endif /* _POSIX_C_SOURCE */
1c79356b
A
91
92/*
93 * saved state structure
94 *
9bccf70c 95 * This structure corresponds to the saved state.
1c79356b
A
96 *
97 */
98
91447636
A
99#ifdef MACH__POSIX_C_SOURCE_PRIVATE
100
101#include <ppc/savearea.h>
102
103typedef struct savearea ppc_saved_state_t;
104
105#else /* MACH__POSIX_C_SOURCE_PRIVATE */
106
107typedef struct ppc_thread_state ppc_saved_state_t;
108
109#endif /* MACH__POSIX_C_SOURCE_PRIVATE */
1c79356b
A
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
91447636
A
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). */
55e303ae 127
91447636
A
128#ifndef _POSIX_C_SOURCE
129typedef struct ppc_exception_state ppc_exception_state_t;
130typedef struct ppc_exception_state64 ppc_exception_state64_t;
131#else /* _POSIX_C_SOURCE */
132typedef struct __darwin_ppc_exception_state ppc_exception_state_t;
133#endif /* _POSIX_C_SOURCE */
55e303ae 134
1c79356b
A
135/*
136 * Save State Flags
137 */
138
91447636
A
139#define PPC_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
140 (sizeof(ppc_thread_state_t) / sizeof(int)))
1c79356b 141
91447636
A
142#define PPC_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \
143 (sizeof(ppc_thread_state64_t) / sizeof(int)))
55e303ae 144
91447636
A
145#define PPC_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
146 (sizeof(ppc_exception_state_t) / sizeof(int)))
1c79356b 147
91447636
A
148#define PPC_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \
149 (sizeof(ppc_exception_state64_t) / sizeof(int)))
55e303ae 150
91447636
A
151#define PPC_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \
152 (sizeof(ppc_float_state_t) / sizeof(int)))
1c79356b 153
91447636
A
154#define PPC_VECTOR_STATE_COUNT ((mach_msg_type_number_t) \
155 (sizeof(ppc_vector_state_t) / sizeof(int)))
1c79356b
A
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 */
55e303ae 167#define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
1c79356b
A
168
169#endif /* _MACH_PPC_THREAD_STATUS_H_ */