]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/i386/gdt.c
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@
30 * Mach Operating System
31 * Copyright (c) 1991,1990 Carnegie Mellon University
32 * All Rights Reserved.
34 * Permission to use, copy, modify and distribute this software and its
35 * documentation is hereby granted, provided that both the copyright
36 * notice and this permission notice appear in all copies of the
37 * software, derivative works or modified versions, and any portions
38 * thereof, and that both notices appear in supporting documentation.
40 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
41 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
42 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
44 * Carnegie Mellon requests users of this software to return to
46 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
47 * School of Computer Science
48 * Carnegie Mellon University
49 * Pittsburgh PA 15213-3890
51 * any improvements or extensions that they make and grant Carnegie Mellon
52 * the rights to redistribute these changes.
58 * Global descriptor table.
60 #include <i386/thread.h>
62 #include <mach/i386/vm_param.h>
63 #include <kern/thread.h>
67 extern int trap_unix_syscall(void), trap_mach25_syscall(void),
68 trap_machdep_syscall(void), syscall(void);
71 struct fake_descriptor gdt
[GDTSZ
] = {
72 /* 0x000 */ { 0, 0, 0, 0 }, /* always NULL */
73 /* 0x008 */ { LINEAR_KERNEL_ADDRESS
+ VM_MIN_ADDRESS
,
74 (VM_MAX_KERNEL_ADDRESS
-1-VM_MIN_KERNEL_ADDRESS
)>>12,
76 ACC_P
|ACC_PL_K
|ACC_CODE_R
78 /* 0x010 */ { LINEAR_KERNEL_ADDRESS
+ VM_MIN_ADDRESS
,
79 (VM_MAX_KERNEL_ADDRESS
-1-VM_MIN_KERNEL_ADDRESS
)>>12,
81 ACC_P
|ACC_PL_K
|ACC_DATA_W
83 /* 0x018 */ { LINEAR_KERNEL_ADDRESS
+ (unsigned int)ldt
,
84 LDTSZ
*sizeof(struct fake_descriptor
)-1,
86 ACC_P
|ACC_PL_K
|ACC_LDT
87 }, /* local descriptor table */
88 /* 0x020 */ { LINEAR_KERNEL_ADDRESS
+ (unsigned int)&ktss
,
89 sizeof(struct i386_tss
)-1,
91 ACC_P
|ACC_PL_K
|ACC_TSS
92 }, /* TSS for this processor */
94 /* 0x28 */ { (unsigned int) &trap_unix_syscall
,
96 0, /* no parameters */
97 ACC_P
|ACC_PL_U
|ACC_CALL_GATE
99 /* 0x30 */ { (unsigned int) &trap_mach25_syscall
,
101 0, /* no parameters */
102 ACC_P
|ACC_PL_U
|ACC_CALL_GATE
104 /* 0x38 */ { (unsigned int) &trap_machdep_syscall
,
106 0, /* no parameters */
107 ACC_P
|ACC_PL_U
|ACC_CALL_GATE
110 /* 0x028 */ { 0, 0, 0, 0 }, /* per-thread LDT */
111 /* 0x030 */ { 0, 0, 0, 0 }, /* per-thread TSS for IO bitmap */
112 /* 0x038 */ { 0, 0, 0, 0 },
114 /* 0x040 */ { 0, 0, 0, 0 },
115 /* 0x048 */ { LINEAR_KERNEL_ADDRESS
+ (unsigned int)&cpu_data
[0],
118 ACC_P
|ACC_PL_K
|ACC_DATA_W
119 }, /* per-CPU current thread address */
121 /* 0x050 */ { LINEAR_KERNEL_ADDRESS
+ (unsigned int)&dbtss
,
122 sizeof(struct i386_tss
)-1,
124 ACC_P
|ACC_PL_K
|ACC_TSS
125 } /* TSS for this processor */
126 #endif /* MACH_KDB */