]>
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_OSREFERENCE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
35 * Mach Operating System
36 * Copyright (c) 1991,1990 Carnegie Mellon University
37 * All Rights Reserved.
39 * Permission to use, copy, modify and distribute this software and its
40 * documentation is hereby granted, provided that both the copyright
41 * notice and this permission notice appear in all copies of the
42 * software, derivative works or modified versions, and any portions
43 * thereof, and that both notices appear in supporting documentation.
45 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
46 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
47 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
49 * Carnegie Mellon requests users of this software to return to
51 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
52 * School of Computer Science
53 * Carnegie Mellon University
54 * Pittsburgh PA 15213-3890
56 * any improvements or extensions that they make and grant Carnegie Mellon
57 * the rights to redistribute these changes.
63 * Global descriptor table.
65 #include <mach/machine.h>
66 #include <mach/i386/vm_param.h>
67 #include <kern/thread.h>
68 #include <i386/cpu_data.h>
69 #include <i386/mp_desc.h>
72 extern int trap_unix_syscall(void), trap_mach25_syscall(void),
73 trap_machdep_syscall(void), syscall(void);
76 struct fake_descriptor gdt
[GDTSZ
] = {
77 /* 0x000 */ { 0, 0, 0, 0 }, /* always NULL */
81 ACC_P
|ACC_PL_K
|ACC_CODE_R
86 ACC_P
|ACC_PL_K
|ACC_DATA_W
88 /* 0x018 */ { (unsigned int)ldt
,
89 LDTSZ
*sizeof(struct fake_descriptor
)-1,
91 ACC_P
|ACC_PL_K
|ACC_LDT
92 }, /* local descriptor table */
93 /* 0x020 */ { (unsigned int)&ktss
,
94 sizeof(struct i386_tss
)-1,
96 ACC_P
|ACC_PL_K
|ACC_TSS
97 }, /* TSS for this processor */
99 /* 0x28 */ { (unsigned int) &trap_unix_syscall
,
101 0, /* no parameters */
102 ACC_P
|ACC_PL_U
|ACC_CALL_GATE
104 /* 0x30 */ { (unsigned int) &trap_mach25_syscall
,
106 0, /* no parameters */
107 ACC_P
|ACC_PL_U
|ACC_CALL_GATE
109 /* 0x38 */ { (unsigned int) &trap_machdep_syscall
,
111 0, /* no parameters */
112 ACC_P
|ACC_PL_U
|ACC_CALL_GATE
115 /* 0x028 */ { 0, 0, 0, 0 }, /* per-thread LDT */
116 /* 0x030 */ { 0, 0, 0, 0 }, /* per-thread TSS for IO bitmap */
117 /* 0x038 */ { 0, 0, 0, 0 },
119 /* 0x040 */ { 0, 0, 0, 0 },
120 /* 0x048 */ { (unsigned int)&cpu_data_master
,
121 sizeof(cpu_data_t
)-1,
123 ACC_P
|ACC_PL_K
|ACC_DATA_W
124 }, /* per-CPU current thread address */
126 /* 0x050 */ { (unsigned int)&dbtss
,
127 sizeof(struct i386_tss
)-1,
129 ACC_P
|ACC_PL_K
|ACC_TSS
130 } /* TSS for this processor */
131 #endif /* MACH_KDB */