]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/i386/thread.h
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
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
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.
23 * @APPLE_LICENSE_HEADER_END@
29 * Mach Operating System
30 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
31 * All Rights Reserved.
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.
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.
43 * Carnegie Mellon requests users of this software to return to
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
57 * File: machine/thread.h
59 * This file contains the structure definitions for the thread
60 * state as applied to I386 processors.
63 #ifndef _I386_THREAD_H_
64 #define _I386_THREAD_H_
66 #include <mach/boolean.h>
67 #include <mach/i386/vm_types.h>
68 #include <mach/i386/fp_reg.h>
70 #include <kern/lock.h>
72 #include <i386/iopb.h>
75 #include <i386/eflags.h>
76 #include <i386/thread_act.h>
79 * i386_exception_link:
81 * This structure lives at the high end of the kernel stack.
82 * It points to the current thread`s user registers.
84 struct i386_exception_link
{
85 struct i386_saved_state
*saved_state
;
90 * On the kernel stack is:
92 * struct i386_exception_link
93 * struct i386_kernel_state
94 * stack+KERNEL_STACK_SIZE
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)
103 #include <i386/mp_desc.h>
107 * Boot-time data for master (or only) CPU
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
;
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 */
120 #define curr_gdt(mycpu) (mp_gdt[mycpu])
121 #define curr_ktss(mycpu) (mp_ktss[mycpu])
123 #define curr_gdt(mycpu) (gdt)
124 #define curr_ktss(mycpu) (&ktss)
127 #define gdt_desc_p(mycpu,sel) \
128 ((struct real_descriptor *)&curr_gdt(mycpu)[sel_idx(sel)])
131 * Return address of the function that called current function, given
132 * address of the first parameter of current function.
134 #define GET_RETURN_PC(addr) (*((vm_offset_t *)addr - 1))
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.
141 #define MACHINE_FAST_EXCEPTION 1
143 #endif /* _I386_THREAD_H_ */