xref: /illumos-gate/usr/src/uts/i86pc/boot/boot_gdt.s (revision ae115bc7)
1*ae115bc7Smrj/*
2*ae115bc7Smrj * CDDL HEADER START
3*ae115bc7Smrj *
4*ae115bc7Smrj * The contents of this file are subject to the terms of the
5*ae115bc7Smrj * Common Development and Distribution License (the "License").
6*ae115bc7Smrj * You may not use this file except in compliance with the License.
7*ae115bc7Smrj *
8*ae115bc7Smrj * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*ae115bc7Smrj * or http://www.opensolaris.org/os/licensing.
10*ae115bc7Smrj * See the License for the specific language governing permissions
11*ae115bc7Smrj * and limitations under the License.
12*ae115bc7Smrj *
13*ae115bc7Smrj * When distributing Covered Code, include this CDDL HEADER in each
14*ae115bc7Smrj * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*ae115bc7Smrj * If applicable, add the following below this CDDL HEADER, with the
16*ae115bc7Smrj * fields enclosed by brackets "[]" replaced with your own identifying
17*ae115bc7Smrj * information: Portions Copyright [yyyy] [name of copyright owner]
18*ae115bc7Smrj *
19*ae115bc7Smrj * CDDL HEADER END
20*ae115bc7Smrj */
21*ae115bc7Smrj
22*ae115bc7Smrj/*
23*ae115bc7Smrj * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24*ae115bc7Smrj * Use is subject to license terms.
25*ae115bc7Smrj */
26*ae115bc7Smrj
27*ae115bc7Smrj#pragma ident	"%Z%%M%	%I%	%E% SMI"
28*ae115bc7Smrj
29*ae115bc7Smrj#if defined(__lint)
30*ae115bc7Smrj
31*ae115bc7Smrjint global_descriptor_table[0x10];
32*ae115bc7Smrj
33*ae115bc7Smrj#else	/* __lint */
34*ae115bc7Smrj
35*ae115bc7Smrj	.align 16
36*ae115bc7Smrj
37*ae115bc7Smrj	/*
38*ae115bc7Smrj	 * This must remain in sync with the entries in intel/sys/gdt.h; in
39*ae115bc7Smrj	 * particular kmdb uses B64CODE_SEL or B32CODE_SEL in perpetuity for
40*ae115bc7Smrj	 * its IDT entries (they're copied to the kernel's GDT in init_idt()).
41*ae115bc7Smrj	 */
42*ae115bc7Smrj
43*ae115bc7Smrjglobal_descriptor_table:
44*ae115bc7Smrj	.long   0
45*ae115bc7Smrj	.long   0
46*ae115bc7Smrj
47*ae115bc7Smrj	/* GDT_B32DATA: 32 bit flat data descriptor */
48*ae115bc7Smrj	.value  0xFFFF	/* segment limit 0..15 */
49*ae115bc7Smrj	.value  0x0000	/* segment base 0..15 */
50*ae115bc7Smrj	.byte   0x0	/* segment base 16..23 */
51*ae115bc7Smrj	.byte   0x92	/* P = 1, read/write data */
52*ae115bc7Smrj	.byte   0xCF	/* G=1, B=1, Limit (16..19)=1111 */
53*ae115bc7Smrj	.byte   0x0	/* segment base 24..32 */
54*ae115bc7Smrj
55*ae115bc7Smrj	/* GDT_B32CODE 32 bit flat code descriptor */
56*ae115bc7Smrj	.value  0xFFFF	/* segment limit 0..15 */
57*ae115bc7Smrj	.value  0x0000	/* segment base 0..15 */
58*ae115bc7Smrj	.byte   0x0	/* segment base 16..23 */
59*ae115bc7Smrj	.byte   0x9E	/* P=1, code, exec, readable */
60*ae115bc7Smrj	.byte   0xCF	/* G=1, D=1, Limit (16..19)=1111 */
61*ae115bc7Smrj	.byte   0x0	/* segment base 24..32 */
62*ae115bc7Smrj
63*ae115bc7Smrj	/*
64*ae115bc7Smrj	 * GDT_B16CODE 16 bit code descriptor for doing BIOS calls
65*ae115bc7Smrj	 */
66*ae115bc7Smrj	.value  0xFFFF	/* segment limit 0..15 */
67*ae115bc7Smrj	.value  0x0000	/* segment base 0..15 */
68*ae115bc7Smrj	.byte   0x0	/* segment base 16..23 */
69*ae115bc7Smrj	.byte   0x9E	/* P=1, code, exec, readable */
70*ae115bc7Smrj	.byte   0x0F	/* G=0, D=0, Limit (16..19)=1111 */
71*ae115bc7Smrj	.byte   0x0	/* segment base 24..32 */
72*ae115bc7Smrj
73*ae115bc7Smrj	/*
74*ae115bc7Smrj	 * GDT_B16DATA 16 bit data descriptor for doing BIOS calls
75*ae115bc7Smrj	 */
76*ae115bc7Smrj	.value  0xFFFF	/* segment limit 0..15 */
77*ae115bc7Smrj	.value  0x0000	/* segment base 0..15 */
78*ae115bc7Smrj	.byte   0x0	/* segment base 16..23 */
79*ae115bc7Smrj	.byte   0x92	/* P = 1, read/write data */
80*ae115bc7Smrj	.byte   0x4F	/* G=0, D=1, Limit (16..19)=1111 */
81*ae115bc7Smrj	.byte   0x0	/* segment base 24..32 */
82*ae115bc7Smrj
83*ae115bc7Smrj	/* GDT_B64CODE: 64 bit flat code descriptor - only L bit has meaning */
84*ae115bc7Smrj	.value  0xFFFF	/* segment limit 0..15 */
85*ae115bc7Smrj	.value  0x0000	/* segment base 0..15 */
86*ae115bc7Smrj	.byte   0x0	/* segment base 16..23 */
87*ae115bc7Smrj	.byte   0x9E	/* P=1, code, exec, readable */
88*ae115bc7Smrj	.byte   0xAF	/* G=1, D=0, L=1, Limit (16..19)=1111 */
89*ae115bc7Smrj	.byte   0x0	/* segment base 24..32 */
90*ae115bc7Smrj
91*ae115bc7Smrj	/*
92*ae115bc7Smrj	 * unused
93*ae115bc7Smrj	 */
94*ae115bc7Smrj	.long	0
95*ae115bc7Smrj	.long	0
96*ae115bc7Smrj
97*ae115bc7Smrj	/*
98*ae115bc7Smrj	 * GDT_BGSTMP -- an entry for kmdb to use during boot
99*ae115bc7Smrj	 */
100*ae115bc7Smrj	.long	0
101*ae115bc7Smrj	.long	0
102*ae115bc7Smrj
103*ae115bc7Smrjgdt_info:
104*ae115bc7Smrj	.value	gdt_info - global_descriptor_table - 1
105*ae115bc7Smrj	.long	global_descriptor_table
106*ae115bc7Smrj	.long   0		/* needed for 64 bit */
107*ae115bc7Smrj
108*ae115bc7Smrj#endif	/* __lint */
109