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>
71 struct fake_descriptor master_gdt
[GDTSZ
] __attribute__ ((aligned (4096))) = {
72 [SEL_TO_INDEX(KERNEL_CS
)] { /* kernel code */
76 ACC_P
|ACC_PL_K
|ACC_CODE_R
,
78 [SEL_TO_INDEX(KERNEL_DS
)] { /* kernel data */
82 ACC_P
|ACC_PL_K
|ACC_DATA_W
84 [SEL_TO_INDEX(KERNEL_LDT
)] { /* local descriptor table */
85 (uint32_t) &master_ldt
,
86 LDTSZ_MIN
*sizeof(struct fake_descriptor
)-1,
88 ACC_P
|ACC_PL_K
|ACC_LDT
89 }, /* The slot KERNEL_LDT_2 is reserved. */
90 [SEL_TO_INDEX(KERNEL_TSS
)] { /* TSS for this processor */
91 (uint32_t) &master_ktss
,
92 sizeof(struct i386_tss
)-1,
94 ACC_P
|ACC_PL_K
|ACC_TSS
95 }, /* The slot KERNEL_TSS_2 is reserved. */
96 [SEL_TO_INDEX(CPU_DATA_GS
)] { /* per-CPU current thread address */
97 (uint32_t) &cpu_data_master
,
100 ACC_P
|ACC_PL_K
|ACC_DATA_W
102 [SEL_TO_INDEX(USER_LDT
)] { /* user local descriptor table */
103 (uint32_t) &master_ldt
,
104 LDTSZ_MIN
*sizeof(struct fake_descriptor
)-1,
106 ACC_P
|ACC_PL_K
|ACC_LDT
108 [SEL_TO_INDEX(KERNEL64_CS
)] { /* kernel 64-bit code */
112 ACC_P
|ACC_PL_K
|ACC_CODE_R
114 [SEL_TO_INDEX(KERNEL64_SS
)] { /* kernel 64-bit syscall stack */
118 ACC_P
|ACC_PL_K
|ACC_DATA_W
121 [SEL_TO_INDEX(DEBUG_TSS
)] { /* TSS for this processor */
122 (uint32_t)&master_dbtss
,
123 sizeof(struct i386_tss
)-1,
125 ACC_P
|ACC_PL_K
|ACC_TSS
127 #endif /* MACH_KDB */