|
|
1.1 root 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: /*
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.
32: *
33: */
34:
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
40:
41: typedef struct ppc_thread_state {
42: unsigned int srr0; /* Instruction address register (PC) */
43: unsigned int srr1; /* Machine state register (supervisor) */
44: unsigned int r0;
45: unsigned int r1;
46: unsigned int r2;
47: unsigned int r3;
48: unsigned int r4;
49: unsigned int r5;
50: unsigned int r6;
51: unsigned int r7;
52: unsigned int r8;
53: unsigned int r9;
54: unsigned int r10;
55: unsigned int r11;
56: unsigned int r12;
57: unsigned int r13;
58: unsigned int r14;
59: unsigned int r15;
60: unsigned int r16;
61: unsigned int r17;
62: unsigned int r18;
63: unsigned int r19;
64: unsigned int r20;
65: unsigned int r21;
66: unsigned int r22;
67: unsigned int r23;
68: unsigned int r24;
69: unsigned int r25;
70: unsigned int r26;
71: unsigned int r27;
72: unsigned int r28;
73: unsigned int r29;
74: unsigned int r30;
75: unsigned int r31;
76:
77: unsigned int cr; /* Condition register */
78: unsigned int xer; /* User's integer exception register */
79: unsigned int lr; /* Link register */
80: unsigned int ctr; /* Count register */
81: unsigned int mq; /* MQ register (601 only) */
82:
83: unsigned int vrsave; /* Vector Save Register */
84: } ppc_thread_state_t;
85:
86: /* This structure should be double-word aligned for performance */
87:
88: typedef struct ppc_float_state {
89: double fpregs[32];
90:
91: unsigned int fpscr_pad; /* fpscr is 64 bits, 32 bits of rubbish */
92: unsigned int fpscr; /* floating point status register */
93: } ppc_float_state_t;
94:
95: typedef struct ppc_vector_state {
96: unsigned long save_vr[32][4];
97: unsigned long save_vscr[4];
98: unsigned int save_pad5[4];
99: unsigned int save_vrvalid; /* VRs that have been saved */
100: unsigned int save_pad6[7];
101: } ppc_vector_state_t;
102:
103: /*
104: * saved state structure
105: *
106: * This structure corresponds to the state of the user registers as saved
107: * on the stack upon kernel entry (saved in pcb). On interrupts and exceptions
108: * we save all registers. On system calls we only save the registers not
109: * saved by the caller.
110: *
111: */
112:
113: typedef struct ppc_saved_state {
114: unsigned int srr0; /* Instruction address register (PC) */
115: unsigned int srr1; /* Machine state register (supervisor) */
116: unsigned int r0;
117: unsigned int r1;
118: unsigned int r2;
119: unsigned int r3;
120: unsigned int r4;
121: unsigned int r5;
122: unsigned int r6;
123: unsigned int r7;
124: unsigned int r8;
125: unsigned int r9;
126: unsigned int r10;
127: unsigned int r11;
128: unsigned int r12;
129: unsigned int r13;
130: unsigned int r14;
131: unsigned int r15;
132: unsigned int r16;
133: unsigned int r17;
134: unsigned int r18;
135: unsigned int r19;
136: unsigned int r20;
137: unsigned int r21;
138: unsigned int r22;
139: unsigned int r23;
140: unsigned int r24;
141: unsigned int r25;
142: unsigned int r26;
143: unsigned int r27;
144: unsigned int r28;
145: unsigned int r29;
146: unsigned int r30;
147: unsigned int r31;
148:
149: unsigned int cr; /* Condition register */
150: unsigned int xer; /* User's integer exception register */
151: unsigned int lr; /* Link register */
152: unsigned int ctr; /* Count register */
153: unsigned int mq; /* MQ register (601 only) */
154: unsigned int vrsave; /* Vector Register Save */
155:
156: /* These are extra. Remove them from the count */
157:
158: unsigned int sr_copyin; /* SR_COPYIN is used for remapping */
159: unsigned int pad2[7]; /* struct alignment */
160: } ppc_saved_state_t;
161:
162: /*
163: * ppc_exception_state
164: *
165: * This structure corresponds to some additional state of the user
166: * registers as saved in the PCB upon kernel entry. They are only
167: * available if an exception is passed out of the kernel, and even
168: * then not all are guaranteed to be updated.
169: *
170: * Some padding is included in this structure which allows space for
171: * servers to store temporary values if need be, to maintain binary
172: * compatiblity.
173: */
174:
175: typedef struct ppc_exception_state {
176: unsigned long dar; /* Fault registers for coredump */
177: unsigned long dsisr;
178: unsigned long exception;/* number of powerpc exception taken */
179: unsigned long pad0; /* align to 16 bytes */
180:
181: unsigned long pad1[4]; /* space in PCB "just in case" */
182: } ppc_exception_state_t;
183:
184: /*
185: * Save State Flags
186: */
187:
188: #define PPC_THREAD_STATE_COUNT \
189: (sizeof(struct ppc_thread_state) / sizeof(int))
190:
191: #define PPC_EXCEPTION_STATE_COUNT \
192: (sizeof(struct ppc_exception_state) / sizeof(int))
193:
194: #define PPC_FLOAT_STATE_COUNT \
195: (sizeof(struct ppc_float_state) / sizeof(int))
196:
197: #define PPC_VECTOR_STATE_COUNT \
198: (sizeof(struct ppc_vector_state) / sizeof(int))
199:
200: /*
201: * Machine-independent way for servers and Mach's exception mechanism to
202: * choose the most efficient state flavor for exception RPC's:
203: */
204: #define MACHINE_THREAD_STATE PPC_THREAD_STATE
205: #define MACHINE_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
206:
207: /*
208: * Largest state on this machine:
209: */
210: #define THREAD_MACHINE_STATE_MAX PPC_VECTOR_STATE_COUNT
211:
212: #endif /* _MACH_PPC_THREAD_STATUS_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.