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