]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/ppc/thread_status.h
xnu-1504.7.4.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 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
1c79356b 5 *
2d21ac55
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 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.
8f6c56a5 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
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
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
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.
8f6c56a5 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31
32#ifndef _MACH_PPC_THREAD_STATUS_H_
33#define _MACH_PPC_THREAD_STATUS_H_
34
2d21ac55 35#include <mach/ppc/_structs.h>
91447636 36#include <mach/message.h>
9bccf70c 37
1c79356b
A
38/*
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.
41 *
42 */
43
44#define PPC_THREAD_STATE 1
45#define PPC_FLOAT_STATE 2
46#define PPC_EXCEPTION_STATE 3
47#define PPC_VECTOR_STATE 4
55e303ae
A
48#define PPC_THREAD_STATE64 5
49#define PPC_EXCEPTION_STATE64 6
1c79356b
A
50#define THREAD_STATE_NONE 7
51
52/*
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
55 * that platform.
56 * The macro must be manually updated to include all of the valid exception
57 * flavors as defined above.
58 */
59#define VALID_THREAD_STATE_FLAVOR(x) \
60 ((x == PPC_THREAD_STATE) || \
61 (x == PPC_FLOAT_STATE) || \
55e303ae 62 (x == PPC_EXCEPTION_STATE) || \
1c79356b 63 (x == PPC_VECTOR_STATE) || \
55e303ae
A
64 (x == PPC_THREAD_STATE64) || \
65 (x == PPC_EXCEPTION_STATE64) || \
1c79356b
A
66 (x == THREAD_STATE_NONE))
67
2d21ac55
A
68typedef _STRUCT_PPC_THREAD_STATE ppc_thread_state_t;
69#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
70typedef _STRUCT_PPC_THREAD_STATE64 ppc_thread_state64_t;
71#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
72typedef _STRUCT_PPC_FLOAT_STATE ppc_float_state_t;
73typedef _STRUCT_PPC_VECTOR_STATE ppc_vector_state_t;
1c79356b
A
74
75/*
76 * saved state structure
77 *
9bccf70c 78 * This structure corresponds to the saved state.
1c79356b
A
79 *
80 */
81
91447636
A
82#ifdef MACH__POSIX_C_SOURCE_PRIVATE
83
84#include <ppc/savearea.h>
85
86typedef struct savearea ppc_saved_state_t;
87
88#else /* MACH__POSIX_C_SOURCE_PRIVATE */
89
90typedef struct ppc_thread_state ppc_saved_state_t;
91
92#endif /* MACH__POSIX_C_SOURCE_PRIVATE */
1c79356b
A
93
94/*
95 * ppc_exception_state
96 *
97 * This structure corresponds to some additional state of the user
98 * registers as saved in the PCB upon kernel entry. They are only
99 * available if an exception is passed out of the kernel, and even
100 * then not all are guaranteed to be updated.
101 *
102 * Some padding is included in this structure which allows space for
103 * servers to store temporary values if need be, to maintain binary
104 * compatiblity.
105 */
106
91447636
A
107/* Exception state for 32-bit thread (on 32-bit processor) */
108/* Still available on 64-bit processors, but may fall short */
109/* of covering the full potential state (hi half available). */
55e303ae 110
2d21ac55
A
111typedef _STRUCT_PPC_EXCEPTION_STATE ppc_exception_state_t;
112#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
113typedef _STRUCT_PPC_EXCEPTION_STATE64 ppc_exception_state64_t;
114#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
55e303ae 115
1c79356b
A
116/*
117 * Save State Flags
118 */
119
91447636
A
120#define PPC_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
121 (sizeof(ppc_thread_state_t) / sizeof(int)))
1c79356b 122
91447636
A
123#define PPC_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \
124 (sizeof(ppc_thread_state64_t) / sizeof(int)))
55e303ae 125
91447636
A
126#define PPC_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
127 (sizeof(ppc_exception_state_t) / sizeof(int)))
1c79356b 128
91447636
A
129#define PPC_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \
130 (sizeof(ppc_exception_state64_t) / sizeof(int)))
55e303ae 131
91447636
A
132#define PPC_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \
133 (sizeof(ppc_float_state_t) / sizeof(int)))
1c79356b 134
91447636
A
135#define PPC_VECTOR_STATE_COUNT ((mach_msg_type_number_t) \
136 (sizeof(ppc_vector_state_t) / sizeof(int)))
1c79356b
A
137
138/*
139 * Machine-independent way for servers and Mach's exception mechanism to
140 * choose the most efficient state flavor for exception RPC's:
141 */
142#define MACHINE_THREAD_STATE PPC_THREAD_STATE
143#define MACHINE_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
144
145/*
146 * Largest state on this machine:
147 */
55e303ae 148#define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
1c79356b
A
149
150#endif /* _MACH_PPC_THREAD_STATUS_H_ */