FreeBSD/Linux Kernel Cross Reference
sys/i386/gdt.c
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990 Carnegie Mellon University
4 * Copyright (c) 1991 IBM Corporation
5 * All Rights Reserved.
6 *
7 * Permission to use, copy, modify and distribute this software and its
8 * documentation is hereby granted, provided that both the copyright
9 * notice and this permission notice appear in all copies of the
10 * software, derivative works or modified versions, and any portions
11 * thereof, and that both notices appear in supporting documentation,
12 * and that the name IBM not be used in advertising or publicity
13 * pertaining to distribution of the software without specific, written
14 * prior permission.
15 *
16 * CARNEGIE MELLON AND IBM ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17 * CONDITION. CARNEGIE MELLON AND IBM DISCLAIM ANY LIABILITY OF ANY KIND FOR
18 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19 *
20 * Carnegie Mellon requests users of this software to return to
21 *
22 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
23 * School of Computer Science
24 * Carnegie Mellon University
25 * Pittsburgh PA 15213-3890
26 *
27 * any improvements or extensions that they make and grant Carnegie Mellon
28 * the rights to redistribute these changes.
29 */
30
31
32 /*
33 * HISTORY
34 * $Log: gdt.c,v $
35 * Revision 2.8 93/02/04 07:56:04 danner
36 * Merge in PS2 support.
37 * [92/02/22 dbg@ibm]
38 *
39 * Revision 2.7 92/01/03 20:05:58 dbg
40 * Add entries for user LDT, floating-point register
41 * access from emulator, and floating-point emulator code.
42 * [91/10/18 dbg]
43 *
44 * Revision 2.6 91/05/14 16:08:04 mrt
45 * Correcting copyright
46 *
47 * Revision 2.5 91/05/08 12:31:41 dbg
48 * Collapsed GDT again.
49 * [91/04/26 14:34:34 dbg]
50 *
51 * Revision 2.4 91/02/05 17:11:52 mrt
52 * Changed to new Mach copyright
53 * [91/02/01 17:34:15 mrt]
54 *
55 * Revision 2.3 90/08/27 21:56:36 dbg
56 * Collapsed GDT. Use new segmentation definitions.
57 * [90/07/25 dbg]
58 *
59 * Revision 2.2 90/05/03 15:27:29 dbg
60 * Created.
61 * [90/02/15 dbg]
62 *
63 */
64
65 /*
66 * Global descriptor table.
67 */
68 #include <platforms.h>
69
70 #include <i386/seg.h>
71 #include <i386/tss.h>
72 #include <mach/i386/vm_types.h>
73 #include <mach/i386/vm_param.h>
74
75 extern struct fake_descriptor ldt[];
76 extern struct i386_tss ktss;
77
78 #if PS2
79 extern unsigned long abios_int_return;
80 extern unsigned long abios_th_return;
81 extern char intstack[];
82 #endif /* PS2 */
83
84 struct fake_descriptor gdt[GDTSZ] = {
85 /* 0x000 */ { 0, 0, 0, 0 }, /* always NULL */
86 /* 0x008 */ { VM_MIN_ADDRESS,
87 (VM_MAX_KERNEL_ADDRESS-1-VM_MIN_ADDRESS)>>12,
88 SZ_32|SZ_G,
89 ACC_P|ACC_PL_K|ACC_CODE_R
90 }, /* kernel code */
91 /* 0x010 */ { VM_MIN_ADDRESS,
92 (VM_MAX_KERNEL_ADDRESS-1-VM_MIN_ADDRESS)>>12,
93 SZ_32|SZ_G,
94 ACC_P|ACC_PL_K|ACC_DATA_W
95 }, /* kernel data */
96 /* 0x018 */ { (unsigned int)ldt,
97 LDTSZ*sizeof(struct fake_descriptor)-1,
98 0,
99 ACC_P|ACC_PL_K|ACC_LDT
100 }, /* local descriptor table */
101 /* 0x020 */ { (unsigned int)&ktss,
102 sizeof(struct i386_tss),
103 0,
104 ACC_P|ACC_PL_K|ACC_TSS
105 }, /* TSS for this processor */
106 /* 0x028 */ { 0, 0, 0, 0 }, /* per-thread LDT */
107 /* 0x030 */ { 0, 0, 0, 0 }, /* per-thread TSS for IO bitmap */
108 /* 0x038 */ { 0, 0, 0, 0 }, /* FP emulator code segment */
109 /* 0x040 */ { 0, 0, 0, 0 }, /* FP emulator data (FP registers) */
110
111 #ifdef PS2
112 /* 0x048 */ { (unsigned int)&abios_int_return,
113 15,
114 SZ_32|SZ_G,
115 ACC_P|ACC_PL_K|ACC_CODE_R
116 }, /* return from ABIOS - thread stack */
117 /* 0x050 */ { (unsigned int)&abios_th_return,
118 15,
119 SZ_32|SZ_G,
120 ACC_P|ACC_PL_K|ACC_CODE_R
121 }, /* return from ABIOS - int stack */
122 /* 0x058 */ { (unsigned int) &intstack,
123 INTSTACK_SIZE-1,
124 0, /* 16 bit, byte granularity */
125 ACC_P|ACC_PL_K|ACC_DATA_W
126 }, /* ABIOS interrupt stack */
127 /* 0x060 */ { 0, /* will be filled in later */
128 KERNEL_STACK_SIZE-1,
129 0, /* 16 bit, byte granularity */
130 ACC_P|ACC_PL_K|ACC_DATA_W
131 }, /* ABIOS kernel stack */
132 /* 0x068 */ { 0, 0, 0, 0 }, /* first avail for allocate_gdt */
133 #endif /* PS2 */
134 };
135
136
Cache object: 36a795ac55897b1fd3ffca236a5d25a5
|