2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
27 * Mach Operating System
28 * Copyright (c) 1991,1990 Carnegie Mellon University
29 * All Rights Reserved.
31 * Permission to use, copy, modify and distribute this software and its
32 * documentation is hereby granted, provided that both the copyright
33 * notice and this permission notice appear in all copies of the
34 * software, derivative works or modified versions, and any portions
35 * thereof, and that both notices appear in supporting documentation.
37 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
38 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
39 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
41 * Carnegie Mellon requests users of this software to return to
43 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
44 * School of Computer Science
45 * Carnegie Mellon University
46 * Pittsburgh PA 15213-3890
48 * any improvements or extensions that they make and grant Carnegie Mellon
49 * the rights to redistribute these changes.
55 * Global descriptor table.
57 #include <mach/machine.h>
58 #include <mach/i386/vm_param.h>
59 #include <kern/thread.h>
60 #include <i386/cpu_data.h>
61 #include <i386/mp_desc.h>
63 struct fake_descriptor master_gdt
[GDTSZ
] __attribute__ ((aligned (4096))) = {
64 [SEL_TO_INDEX(KERNEL_CS
)] { /* kernel code */
68 ACC_P
|ACC_PL_K
|ACC_CODE_R
,
70 [SEL_TO_INDEX(KERNEL_DS
)] { /* kernel data */
74 ACC_P
|ACC_PL_K
|ACC_DATA_W
76 [SEL_TO_INDEX(KERNEL_LDT
)] { /* local descriptor table */
77 (uint32_t) &master_ldt
,
78 LDTSZ_MIN
*sizeof(struct fake_descriptor
)-1,
80 ACC_P
|ACC_PL_K
|ACC_LDT
81 }, /* The slot KERNEL_LDT_2 is reserved. */
82 [SEL_TO_INDEX(KERNEL_TSS
)] { /* TSS for this processor */
83 (uint32_t) &master_ktss
,
84 sizeof(struct i386_tss
)-1,
86 ACC_P
|ACC_PL_K
|ACC_TSS
87 }, /* The slot KERNEL_TSS_2 is reserved. */
88 [SEL_TO_INDEX(CPU_DATA_GS
)] { /* per-CPU current thread address */
89 (uint32_t) &cpu_data_master
,
92 ACC_P
|ACC_PL_K
|ACC_DATA_W
94 [SEL_TO_INDEX(USER_LDT
)] { /* user local descriptor table */
95 (uint32_t) &master_ldt
,
96 LDTSZ_MIN
*sizeof(struct fake_descriptor
)-1,
98 ACC_P
|ACC_PL_K
|ACC_LDT
100 [SEL_TO_INDEX(KERNEL64_CS
)] { /* kernel 64-bit code */
104 ACC_P
|ACC_PL_K
|ACC_CODE_R
106 [SEL_TO_INDEX(KERNEL64_SS
)] { /* kernel 64-bit syscall stack */
110 ACC_P
|ACC_PL_K
|ACC_DATA_W
113 [SEL_TO_INDEX(DEBUG_TSS
)] { /* TSS for this processor */
114 (uint32_t)&master_dbtss
,
115 sizeof(struct i386_tss
)-1,
117 ACC_P
|ACC_PL_K
|ACC_TSS
119 #endif /* MACH_KDB */