]>
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 * 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 <i386/thread.h>
59 #include <mach/i386/vm_param.h>
60 #include <kern/thread.h>
64 extern int trap_unix_syscall(void), trap_mach25_syscall(void),
65 trap_machdep_syscall(void), syscall(void);
68 struct fake_descriptor gdt
[GDTSZ
] = {
69 /* 0x000 */ { 0, 0, 0, 0 }, /* always NULL */
70 /* 0x008 */ { LINEAR_KERNEL_ADDRESS
+ VM_MIN_ADDRESS
,
71 (VM_MAX_KERNEL_ADDRESS
-1-VM_MIN_KERNEL_ADDRESS
)>>12,
73 ACC_P
|ACC_PL_K
|ACC_CODE_R
75 /* 0x010 */ { LINEAR_KERNEL_ADDRESS
+ VM_MIN_ADDRESS
,
76 (VM_MAX_KERNEL_ADDRESS
-1-VM_MIN_KERNEL_ADDRESS
)>>12,
78 ACC_P
|ACC_PL_K
|ACC_DATA_W
80 /* 0x018 */ { LINEAR_KERNEL_ADDRESS
+ (unsigned int)ldt
,
81 LDTSZ
*sizeof(struct fake_descriptor
)-1,
83 ACC_P
|ACC_PL_K
|ACC_LDT
84 }, /* local descriptor table */
85 /* 0x020 */ { LINEAR_KERNEL_ADDRESS
+ (unsigned int)&ktss
,
86 sizeof(struct i386_tss
)-1,
88 ACC_P
|ACC_PL_K
|ACC_TSS
89 }, /* TSS for this processor */
91 /* 0x28 */ { (unsigned int) &trap_unix_syscall
,
93 0, /* no parameters */
94 ACC_P
|ACC_PL_U
|ACC_CALL_GATE
96 /* 0x30 */ { (unsigned int) &trap_mach25_syscall
,
98 0, /* no parameters */
99 ACC_P
|ACC_PL_U
|ACC_CALL_GATE
101 /* 0x38 */ { (unsigned int) &trap_machdep_syscall
,
103 0, /* no parameters */
104 ACC_P
|ACC_PL_U
|ACC_CALL_GATE
107 /* 0x028 */ { 0, 0, 0, 0 }, /* per-thread LDT */
108 /* 0x030 */ { 0, 0, 0, 0 }, /* per-thread TSS for IO bitmap */
109 /* 0x038 */ { 0, 0, 0, 0 },
111 /* 0x040 */ { 0, 0, 0, 0 },
112 /* 0x048 */ { LINEAR_KERNEL_ADDRESS
+ (unsigned int)&cpu_data
[0],
115 ACC_P
|ACC_PL_K
|ACC_DATA_W
116 }, /* per-CPU current thread address */
118 /* 0x050 */ { LINEAR_KERNEL_ADDRESS
+ (unsigned int)&dbtss
,
119 sizeof(struct i386_tss
)-1,
121 ACC_P
|ACC_PL_K
|ACC_TSS
122 } /* TSS for this processor */
123 #endif /* MACH_KDB */