]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
43866e37 | 6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. |
1c79356b | 7 | * |
43866e37 A |
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 | |
1c79356b A |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
43866e37 A |
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. | |
1c79356b A |
22 | * |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | /* | |
26 | * @OSF_COPYRIGHT@ | |
27 | */ | |
28 | /* | |
29 | * Mach Operating System | |
30 | * Copyright (c) 1991,1990,1989 Carnegie Mellon University | |
31 | * All Rights Reserved. | |
32 | * | |
33 | * Permission to use, copy, modify and distribute this software and its | |
34 | * documentation is hereby granted, provided that both the copyright | |
35 | * notice and this permission notice appear in all copies of the | |
36 | * software, derivative works or modified versions, and any portions | |
37 | * thereof, and that both notices appear in supporting documentation. | |
38 | * | |
39 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
40 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | |
41 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
42 | * | |
43 | * Carnegie Mellon requests users of this software to return to | |
44 | * | |
45 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
46 | * School of Computer Science | |
47 | * Carnegie Mellon University | |
48 | * Pittsburgh PA 15213-3890 | |
49 | * | |
50 | * any improvements or extensions that they make and grant Carnegie Mellon | |
51 | * the rights to redistribute these changes. | |
52 | */ | |
53 | /* | |
54 | */ | |
55 | ||
56 | /* | |
57 | * File: machine/thread.h | |
58 | * | |
59 | * This file contains the structure definitions for the thread | |
60 | * state as applied to I386 processors. | |
61 | */ | |
62 | ||
63 | #ifndef _I386_THREAD_H_ | |
64 | #define _I386_THREAD_H_ | |
65 | ||
66 | #include <mach/boolean.h> | |
67 | #include <mach/i386/vm_types.h> | |
68 | #include <mach/i386/fp_reg.h> | |
69 | ||
70 | #include <kern/lock.h> | |
71 | ||
72 | #include <i386/iopb.h> | |
73 | #include <i386/seg.h> | |
74 | #include <i386/tss.h> | |
75 | #include <i386/eflags.h> | |
76 | #include <i386/thread_act.h> | |
77 | ||
78 | /* | |
79 | * i386_exception_link: | |
80 | * | |
81 | * This structure lives at the high end of the kernel stack. | |
82 | * It points to the current thread`s user registers. | |
83 | */ | |
84 | struct i386_exception_link { | |
85 | struct i386_saved_state *saved_state; | |
86 | }; | |
87 | ||
88 | ||
89 | /* | |
90 | * On the kernel stack is: | |
91 | * stack: ... | |
92 | * struct i386_exception_link | |
93 | * struct i386_kernel_state | |
94 | * stack+KERNEL_STACK_SIZE | |
95 | */ | |
96 | ||
97 | #define STACK_IKS(stack) \ | |
98 | ((struct i386_kernel_state *)((stack) + KERNEL_STACK_SIZE) - 1) | |
99 | #define STACK_IEL(stack) \ | |
100 | ((struct i386_exception_link *)STACK_IKS(stack) - 1) | |
101 | ||
102 | #if NCPUS > 1 | |
103 | #include <i386/mp_desc.h> | |
104 | #endif | |
105 | ||
106 | /* | |
107 | * Boot-time data for master (or only) CPU | |
108 | */ | |
109 | extern struct fake_descriptor idt[IDTSZ]; | |
110 | extern struct fake_descriptor gdt[GDTSZ]; | |
111 | extern struct fake_descriptor ldt[LDTSZ]; | |
112 | extern struct i386_tss ktss; | |
113 | #if MACH_KDB | |
114 | extern char db_stack_store[]; | |
115 | extern char db_task_stack_store[]; | |
116 | extern struct i386_tss dbtss; | |
117 | extern void db_task_start(void); | |
118 | #endif /* MACH_KDB */ | |
119 | #if NCPUS > 1 | |
120 | #define curr_gdt(mycpu) (mp_gdt[mycpu]) | |
121 | #define curr_ktss(mycpu) (mp_ktss[mycpu]) | |
122 | #else | |
123 | #define curr_gdt(mycpu) (gdt) | |
124 | #define curr_ktss(mycpu) (&ktss) | |
125 | #endif | |
126 | ||
127 | #define gdt_desc_p(mycpu,sel) \ | |
128 | ((struct real_descriptor *)&curr_gdt(mycpu)[sel_idx(sel)]) | |
129 | ||
130 | /* | |
131 | * Return address of the function that called current function, given | |
132 | * address of the first parameter of current function. | |
133 | */ | |
134 | #define GET_RETURN_PC(addr) (*((vm_offset_t *)addr - 1)) | |
135 | ||
136 | /* | |
137 | * Defining this indicates that MD code will supply an exception() | |
138 | * routine, conformant with kern/exception.c (dependency alert!) | |
139 | * but which does wonderfully fast, machine-dependent magic. | |
140 | */ | |
141 | #define MACHINE_FAST_EXCEPTION 1 | |
142 | ||
1c79356b | 143 | #endif /* _I386_THREAD_H_ */ |