]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/ppc/thread_status.h
xnu-792.10.96.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
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
37839358
A
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.
1c79356b 11 *
37839358
A
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
1c79356b
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
37839358
A
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
1c79356b
A
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*
23 * @OSF_COPYRIGHT@
24 */
25
26#ifndef _MACH_PPC_THREAD_STATUS_H_
27#define _MACH_PPC_THREAD_STATUS_H_
28
91447636
A
29#include <mach/ppc/_types.h>
30#include <mach/message.h>
9bccf70c 31
1c79356b
A
32/*
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.
35 *
36 */
37
38#define PPC_THREAD_STATE 1
39#define PPC_FLOAT_STATE 2
40#define PPC_EXCEPTION_STATE 3
41#define PPC_VECTOR_STATE 4
55e303ae
A
42#define PPC_THREAD_STATE64 5
43#define PPC_EXCEPTION_STATE64 6
1c79356b
A
44#define THREAD_STATE_NONE 7
45
46/*
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
49 * that platform.
50 * The macro must be manually updated to include all of the valid exception
51 * flavors as defined above.
52 */
53#define VALID_THREAD_STATE_FLAVOR(x) \
54 ((x == PPC_THREAD_STATE) || \
55 (x == PPC_FLOAT_STATE) || \
55e303ae 56 (x == PPC_EXCEPTION_STATE) || \
1c79356b 57 (x == PPC_VECTOR_STATE) || \
55e303ae
A
58 (x == PPC_THREAD_STATE64) || \
59 (x == PPC_EXCEPTION_STATE64) || \
1c79356b
A
60 (x == THREAD_STATE_NONE))
61
91447636
A
62#ifndef _POSIX_C_SOURCE
63typedef struct ppc_thread_state ppc_thread_state_t;
64#else /* _POSIX_C_SOURCE */
65typedef struct __darwin_ppc_thread_state ppc_thread_state_t;
66#endif /* _POSIX_C_SOURCE */
67
68#ifndef _POSIX_C_SOURCE
69typedef struct ppc_thread_state64 ppc_thread_state64_t;
70#endif /* _POSIX_C_SOURCE */
71
72#ifndef _POSIX_C_SOURCE
73typedef struct ppc_float_state ppc_float_state_t;
74#else /* _POSIX_C_SOURCE */
75typedef struct __darwin_ppc_float_state ppc_float_state_t;
76#endif /* _POSIX_C_SOURCE */
77
78#ifndef _POSIX_C_SOURCE
79typedef struct ppc_vector_state ppc_vector_state_t;
80#else /* _POSIX_C_SOURCE */
81typedef struct __darwin_ppc_vector_state ppc_vector_state_t;
82#endif /* _POSIX_C_SOURCE */
1c79356b
A
83
84/*
85 * saved state structure
86 *
9bccf70c 87 * This structure corresponds to the saved state.
1c79356b
A
88 *
89 */
90
91447636
A
91#ifdef MACH__POSIX_C_SOURCE_PRIVATE
92
93#include <ppc/savearea.h>
94
95typedef struct savearea ppc_saved_state_t;
96
97#else /* MACH__POSIX_C_SOURCE_PRIVATE */
98
99typedef struct ppc_thread_state ppc_saved_state_t;
100
101#endif /* MACH__POSIX_C_SOURCE_PRIVATE */
1c79356b
A
102
103/*
104 * ppc_exception_state
105 *
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.
110 *
111 * Some padding is included in this structure which allows space for
112 * servers to store temporary values if need be, to maintain binary
113 * compatiblity.
114 */
115
91447636
A
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). */
55e303ae 119
91447636
A
120#ifndef _POSIX_C_SOURCE
121typedef struct ppc_exception_state ppc_exception_state_t;
122typedef struct ppc_exception_state64 ppc_exception_state64_t;
123#else /* _POSIX_C_SOURCE */
124typedef struct __darwin_ppc_exception_state ppc_exception_state_t;
125#endif /* _POSIX_C_SOURCE */
55e303ae 126
1c79356b
A
127/*
128 * Save State Flags
129 */
130
91447636
A
131#define PPC_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
132 (sizeof(ppc_thread_state_t) / sizeof(int)))
1c79356b 133
91447636
A
134#define PPC_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \
135 (sizeof(ppc_thread_state64_t) / sizeof(int)))
55e303ae 136
91447636
A
137#define PPC_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
138 (sizeof(ppc_exception_state_t) / sizeof(int)))
1c79356b 139
91447636
A
140#define PPC_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \
141 (sizeof(ppc_exception_state64_t) / sizeof(int)))
55e303ae 142
91447636
A
143#define PPC_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \
144 (sizeof(ppc_float_state_t) / sizeof(int)))
1c79356b 145
91447636
A
146#define PPC_VECTOR_STATE_COUNT ((mach_msg_type_number_t) \
147 (sizeof(ppc_vector_state_t) / sizeof(int)))
1c79356b
A
148
149/*
150 * Machine-independent way for servers and Mach's exception mechanism to
151 * choose the most efficient state flavor for exception RPC's:
152 */
153#define MACHINE_THREAD_STATE PPC_THREAD_STATE
154#define MACHINE_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
155
156/*
157 * Largest state on this machine:
158 */
55e303ae 159#define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
1c79356b
A
160
161#endif /* _MACH_PPC_THREAD_STATUS_H_ */