]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/ppc/thread_status.h
6dd8ba95d76bb39264e7d386343616c7d9f7418c
2 * Copyright (c) 2000 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_
30 * ppc_thread_state is the structure that is exported to user threads for
31 * use in status/mutate calls. This structure should never change.
35 #define PPC_THREAD_STATE 1
36 #define PPC_FLOAT_STATE 2
37 #define PPC_EXCEPTION_STATE 3
38 #define PPC_VECTOR_STATE 4
39 #define THREAD_STATE_NONE 7
42 * VALID_THREAD_STATE_FLAVOR is a platform specific macro that when passed
43 * an exception flavor will return whether that is a defined flavor for
45 * The macro must be manually updated to include all of the valid exception
46 * flavors as defined above.
48 #define VALID_THREAD_STATE_FLAVOR(x) \
49 ((x == PPC_THREAD_STATE) || \
50 (x == PPC_FLOAT_STATE) || \
51 (x == PPC_EXCEPTION_STATE) || \
52 (x == PPC_VECTOR_STATE) || \
53 (x == THREAD_STATE_NONE))
55 typedef struct ppc_thread_state
{
56 unsigned int srr0
; /* Instruction address register (PC) */
57 unsigned int srr1
; /* Machine state register (supervisor) */
91 unsigned int cr
; /* Condition register */
92 unsigned int xer
; /* User's integer exception register */
93 unsigned int lr
; /* Link register */
94 unsigned int ctr
; /* Count register */
95 unsigned int mq
; /* MQ register (601 only) */
97 unsigned int vrsave
; /* Vector Save Register */
100 /* This structure should be double-word aligned for performance */
102 typedef struct ppc_float_state
{
105 unsigned int fpscr_pad
; /* fpscr is 64 bits, 32 bits of rubbish */
106 unsigned int fpscr
; /* floating point status register */
109 typedef struct ppc_vector_state
{
110 unsigned long save_vr
[32][4];
111 unsigned long save_vscr
[4];
112 unsigned int save_pad5
[4];
113 unsigned int save_vrvalid
; /* VRs that have been saved */
114 unsigned int save_pad6
[7];
115 } ppc_vector_state_t
;
118 * saved state structure
120 * This structure corresponds to the state of the user registers as saved
121 * on the stack upon kernel entry (saved in pcb). On interrupts and exceptions
122 * we save all registers. On system calls we only save the registers not
123 * saved by the caller.
127 typedef struct ppc_saved_state
{
128 unsigned int srr0
; /* Instruction address register (PC) */
129 unsigned int srr1
; /* Machine state register (supervisor) */
163 unsigned int cr
; /* Condition register */
164 unsigned int xer
; /* User's integer exception register */
165 unsigned int lr
; /* Link register */
166 unsigned int ctr
; /* Count register */
167 unsigned int mq
; /* MQ register (601 only) */
168 unsigned int vrsave
; /* Vector Register Save */
170 /* These are extra. Remove them from the count */
172 unsigned int sr_copyin
; /* SR_COPYIN is used for remapping */
173 unsigned int pad2
[7]; /* struct alignment */
177 * ppc_exception_state
179 * This structure corresponds to some additional state of the user
180 * registers as saved in the PCB upon kernel entry. They are only
181 * available if an exception is passed out of the kernel, and even
182 * then not all are guaranteed to be updated.
184 * Some padding is included in this structure which allows space for
185 * servers to store temporary values if need be, to maintain binary
189 typedef struct ppc_exception_state
{
190 unsigned long dar
; /* Fault registers for coredump */
192 unsigned long exception
;/* number of powerpc exception taken */
193 unsigned long pad0
; /* align to 16 bytes */
195 unsigned long pad1
[4]; /* space in PCB "just in case" */
196 } ppc_exception_state_t
;
202 #define PPC_THREAD_STATE_COUNT \
203 (sizeof(struct ppc_thread_state) / sizeof(int))
205 #define PPC_EXCEPTION_STATE_COUNT \
206 (sizeof(struct ppc_exception_state) / sizeof(int))
208 #define PPC_FLOAT_STATE_COUNT \
209 (sizeof(struct ppc_float_state) / sizeof(int))
211 #define PPC_VECTOR_STATE_COUNT \
212 (sizeof(struct ppc_vector_state) / sizeof(int))
215 * Machine-independent way for servers and Mach's exception mechanism to
216 * choose the most efficient state flavor for exception RPC's:
218 #define MACHINE_THREAD_STATE PPC_THREAD_STATE
219 #define MACHINE_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
222 * Largest state on this machine:
224 #define THREAD_MACHINE_STATE_MAX PPC_VECTOR_STATE_COUNT
226 #endif /* _MACH_PPC_THREAD_STATUS_H_ */