]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. | |
7 | * | |
8 | * This file contains Original Code and/or Modifications of Original Code | |
9 | * as defined in and that are subject to the Apple Public Source License | |
10 | * Version 2.0 (the 'License'). You may not use this file except in | |
11 | * compliance with the License. Please obtain a copy of the License at | |
12 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | * file. | |
14 | * | |
15 | * The Original Code and all software distributed under the License are | |
16 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
19 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
20 | * Please see the License for the specific language governing rights and | |
21 | * limitations under the License. | |
22 | * | |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | /* | |
26 | * @OSF_COPYRIGHT@ | |
27 | * | |
28 | */ | |
29 | ||
30 | #ifndef _PPC_THREAD_ACT_H_ | |
31 | #define _PPC_THREAD_ACT_H_ | |
32 | ||
33 | #include <mach_kgdb.h> | |
34 | #include <mach/boolean.h> | |
35 | #include <mach/ppc/vm_types.h> | |
36 | #include <mach/thread_status.h> | |
37 | #include <kern/lock.h> | |
38 | #include <kern/clock.h> | |
39 | #include <ppc/savearea.h> | |
40 | ||
41 | /* | |
42 | * Kernel state structure | |
43 | * | |
44 | * This holds the kernel state that is saved and restored across context | |
45 | * switches. | |
46 | */ | |
47 | ||
48 | /* | |
49 | * PPC process control block | |
50 | * | |
51 | * The PCB holds normal context. It does not contain vector or floating point | |
52 | * registers. | |
53 | * | |
54 | */ | |
55 | ||
56 | typedef struct savearea pcb; | |
57 | typedef struct savearea *pcb_t; | |
58 | ||
59 | struct facility_context { | |
60 | ||
61 | savearea_fpu *FPUsave; /* The floating point savearea */ | |
62 | savearea *FPUlevel; /* The floating point context level */ | |
63 | unsigned int FPUcpu; /* The last processor to enable floating point */ | |
64 | savearea_vec *VMXsave; /* The VMX savearea */ | |
65 | savearea *VMXlevel; /* The VMX context level */ | |
66 | unsigned int VMXcpu; /* The last processor to enable vector */ | |
67 | struct thread_activation *facAct; /* Activation associated with context */ | |
68 | }; | |
69 | ||
70 | typedef struct facility_context facility_context; | |
71 | ||
72 | /* | |
73 | * Maps state flavor to number of words in the state: | |
74 | */ | |
75 | extern unsigned int state_count[]; | |
76 | ||
77 | #define USER_REGS(ThrAct) ((ThrAct)->mact.pcb) | |
78 | ||
79 | #define user_pc(ThrAct) ((ThrAct)->mact.pcb->save_srr0) | |
80 | ||
81 | #define act_machine_state_ptr(ThrAct) (thread_state_t)USER_REGS(ThrAct) | |
82 | ||
83 | typedef struct MachineThrAct { | |
84 | /* | |
85 | * pointer to process control block control blocks. Potentially | |
86 | * one for each active facility context. They may point to the | |
87 | * same saveareas. | |
88 | */ | |
89 | savearea *pcb; /* The "normal" savearea */ | |
90 | facility_context *curctx; /* Current facility context */ | |
91 | facility_context *deferctx; /* Deferred facility context */ | |
92 | facility_context facctx; /* "Normal" facility context */ | |
93 | struct vmmCntrlEntry *vmmCEntry; /* Pointer current emulation context or 0 */ | |
94 | struct vmmCntrlTable *vmmControl; /* Pointer to virtual machine monitor control table */ | |
95 | uint64_t qactTimer; /* Time thread needs to interrupt. This is a single-shot timer. Zero is unset */ | |
96 | unsigned int ksp; /* points to TOP OF STACK or zero */ | |
97 | unsigned int bbDescAddr; /* Points to Blue Box Trap descriptor area in kernel (page aligned) */ | |
98 | unsigned int bbUserDA; /* Points to Blue Box Trap descriptor area in user (page aligned) */ | |
99 | unsigned int bbTableStart; /* Points to Blue Box Trap dispatch area in user */ | |
100 | unsigned int emPendRupts; /* Number of pending emulated interruptions */ | |
101 | unsigned int bbTaskID; /* Opaque task ID for Blue Box threads */ | |
102 | unsigned int bbTaskEnv; /* Opaque task data reference for Blue Box threads */ | |
103 | unsigned int specFlags; /* Special flags */ | |
104 | ||
105 | /* special flags bits */ | |
106 | ||
107 | #define ignoreZeroFaultbit 0 | |
108 | #define floatUsedbit 1 | |
109 | #define vectorUsedbit 2 | |
110 | #define runningVMbit 4 | |
111 | #define floatCngbit 5 | |
112 | #define vectorCngbit 6 | |
113 | #define timerPopbit 7 | |
114 | #define userProtKeybit 8 | |
115 | #define trapUnalignbit 9 | |
116 | #define notifyUnalignbit 10 | |
117 | #define FamVMenabit 11 | |
118 | #define FamVMmodebit 12 | |
119 | /* NOTE: Do not move or assign bit 31 without changing exception vector ultra fast path code */ | |
120 | #define bbThreadbit 28 | |
121 | #define bbNoMachSCbit 29 | |
122 | #define bbPreemptivebit 30 | |
123 | #define spfReserved1 31 /* See note above */ | |
124 | ||
125 | #define ignoreZeroFault (1<<(31-ignoreZeroFaultbit)) | |
126 | #define floatUsed (1<<(31-floatUsedbit)) | |
127 | #define vectorUsed (1<<(31-vectorUsedbit)) | |
128 | #define runningVM (1<<(31-runningVMbit)) | |
129 | #define floatCng (1<<(31-floatCngbit)) | |
130 | #define vectorCng (1<<(31-vectorCngbit)) | |
131 | #define timerPop (1<<(31-timerPopbit)) | |
132 | #define userProtKey (1<<(31-userProtKeybit)) | |
133 | #define trapUnalign (1<<(31-trapUnalignbit)) | |
134 | #define notifyUnalign (1<<(31-notifyUnalignbit)) | |
135 | #define FamVMena (1<<(31-FamVMenabit)) | |
136 | #define FamVMmode (1<<(31-FamVMmodebit)) | |
137 | #define bbThread (1<<(31-bbThreadbit)) | |
138 | #define bbNoMachSC (1<<(31-bbNoMachSCbit)) | |
139 | #define bbPreemptive (1<<(31-bbPreemptivebit)) | |
140 | ||
141 | #define fvChkb 0 | |
142 | #define fvChk 0x80000000 | |
143 | ||
144 | #ifdef MACH_BSD | |
145 | unsigned long cthread_self; /* for use of cthread package */ | |
146 | #endif | |
147 | ||
148 | } MachineThrAct, *MachineThrAct_t; | |
149 | ||
150 | extern struct savearea *find_user_regs(thread_act_t act); | |
151 | extern struct savearea *get_user_regs(thread_act_t); | |
152 | extern struct savearea_fpu *find_user_fpu(thread_act_t act); | |
153 | extern struct savearea_vec *find_user_vec(thread_act_t act); | |
154 | extern int thread_enable_fpe(thread_act_t act, int onoff); | |
155 | ||
156 | extern void *act_thread_csave(void); | |
157 | extern void act_thread_catt(void *ctx); | |
158 | extern void act_thread_cfree(void *ctx); | |
159 | ||
160 | #define current_act_fast() current_act() | |
161 | ||
162 | #endif /* _PPC_THREAD_ACT_H_ */ |