]> git.saurik.com Git - apple/xnu.git/blame_incremental - osfmk/mach/ppc/thread_status.h
xnu-344.23.tar.gz
[apple/xnu.git] / osfmk / mach / ppc / thread_status.h
... / ...
CommitLineData
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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.
11 *
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
18 * under the License.
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
29#include <sys/appleapiopts.h>
30
31#ifdef MACH_KERNEL_PRIVATE
32#include <ppc/savearea.h>
33#endif
34/*
35 * ppc_thread_state is the structure that is exported to user threads for
36 * use in status/mutate calls. This structure should never change.
37 *
38 */
39
40#define PPC_THREAD_STATE 1
41#define PPC_FLOAT_STATE 2
42#define PPC_EXCEPTION_STATE 3
43#define PPC_VECTOR_STATE 4
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) || \
56 (x == PPC_EXCEPTION_STATE) || \
57 (x == PPC_VECTOR_STATE) || \
58 (x == THREAD_STATE_NONE))
59
60typedef struct ppc_thread_state {
61 unsigned int srr0; /* Instruction address register (PC) */
62 unsigned int srr1; /* Machine state register (supervisor) */
63 unsigned int r0;
64 unsigned int r1;
65 unsigned int r2;
66 unsigned int r3;
67 unsigned int r4;
68 unsigned int r5;
69 unsigned int r6;
70 unsigned int r7;
71 unsigned int r8;
72 unsigned int r9;
73 unsigned int r10;
74 unsigned int r11;
75 unsigned int r12;
76 unsigned int r13;
77 unsigned int r14;
78 unsigned int r15;
79 unsigned int r16;
80 unsigned int r17;
81 unsigned int r18;
82 unsigned int r19;
83 unsigned int r20;
84 unsigned int r21;
85 unsigned int r22;
86 unsigned int r23;
87 unsigned int r24;
88 unsigned int r25;
89 unsigned int r26;
90 unsigned int r27;
91 unsigned int r28;
92 unsigned int r29;
93 unsigned int r30;
94 unsigned int r31;
95
96 unsigned int cr; /* Condition register */
97 unsigned int xer; /* User's integer exception register */
98 unsigned int lr; /* Link register */
99 unsigned int ctr; /* Count register */
100 unsigned int mq; /* MQ register (601 only) */
101
102 unsigned int vrsave; /* Vector Save Register */
103} ppc_thread_state_t;
104
105/* This structure should be double-word aligned for performance */
106
107typedef struct ppc_float_state {
108 double fpregs[32];
109
110 unsigned int fpscr_pad; /* fpscr is 64 bits, 32 bits of rubbish */
111 unsigned int fpscr; /* floating point status register */
112} ppc_float_state_t;
113
114typedef struct ppc_vector_state {
115 unsigned long save_vr[32][4];
116 unsigned long save_vscr[4];
117 unsigned int save_pad5[4];
118 unsigned int save_vrvalid; /* VRs that have been saved */
119 unsigned int save_pad6[7];
120} ppc_vector_state_t;
121
122/*
123 * saved state structure
124 *
125 * This structure corresponds to the saved state.
126 *
127 */
128
129#if defined(__APPLE_API_PRIVATE) && defined(MACH_KERNEL_PRIVATE)
130typedef struct savearea ppc_saved_state_t;
131#else
132typedef struct ppc_thread_state ppc_saved_state_t;
133#endif /* __APPLE_API_PRIVATE && MACH_KERNEL_PRIVATE */
134
135/*
136 * ppc_exception_state
137 *
138 * This structure corresponds to some additional state of the user
139 * registers as saved in the PCB upon kernel entry. They are only
140 * available if an exception is passed out of the kernel, and even
141 * then not all are guaranteed to be updated.
142 *
143 * Some padding is included in this structure which allows space for
144 * servers to store temporary values if need be, to maintain binary
145 * compatiblity.
146 */
147
148typedef struct ppc_exception_state {
149 unsigned long dar; /* Fault registers for coredump */
150 unsigned long dsisr;
151 unsigned long exception;/* number of powerpc exception taken */
152 unsigned long pad0; /* align to 16 bytes */
153
154 unsigned long pad1[4]; /* space in PCB "just in case" */
155} ppc_exception_state_t;
156
157/*
158 * Save State Flags
159 */
160
161#define PPC_THREAD_STATE_COUNT \
162 (sizeof(struct ppc_thread_state) / sizeof(int))
163
164#define PPC_EXCEPTION_STATE_COUNT \
165 (sizeof(struct ppc_exception_state) / sizeof(int))
166
167#define PPC_FLOAT_STATE_COUNT \
168 (sizeof(struct ppc_float_state) / sizeof(int))
169
170#define PPC_VECTOR_STATE_COUNT \
171 (sizeof(struct ppc_vector_state) / sizeof(int))
172
173/*
174 * Machine-independent way for servers and Mach's exception mechanism to
175 * choose the most efficient state flavor for exception RPC's:
176 */
177#define MACHINE_THREAD_STATE PPC_THREAD_STATE
178#define MACHINE_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
179
180/*
181 * Largest state on this machine:
182 */
183#define THREAD_MACHINE_STATE_MAX PPC_VECTOR_STATE_COUNT
184
185#endif /* _MACH_PPC_THREAD_STATUS_H_ */