xref: /onnv-gate/usr/src/uts/i86pc/boot/boot_gdt.s (revision 11664:0c7cd926f730)
13446Smrj/*
23446Smrj * CDDL HEADER START
33446Smrj *
43446Smrj * The contents of this file are subject to the terms of the
53446Smrj * Common Development and Distribution License (the "License").
63446Smrj * You may not use this file except in compliance with the License.
73446Smrj *
83446Smrj * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93446Smrj * or http://www.opensolaris.org/os/licensing.
103446Smrj * See the License for the specific language governing permissions
113446Smrj * and limitations under the License.
123446Smrj *
133446Smrj * When distributing Covered Code, include this CDDL HEADER in each
143446Smrj * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153446Smrj * If applicable, add the following below this CDDL HEADER, with the
163446Smrj * fields enclosed by brackets "[]" replaced with your own identifying
173446Smrj * information: Portions Copyright [yyyy] [name of copyright owner]
183446Smrj *
193446Smrj * CDDL HEADER END
203446Smrj */
213446Smrj
223446Smrj/*
23*11664SDan.Mick@Sun.COM * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
243446Smrj * Use is subject to license terms.
253446Smrj */
263446Smrj
273446Smrj
283446Smrj#if defined(__lint)
295460Sjosephb#pragma pack(1)
305460Sjosephbstruct {
315460Sjosephb	uint16_t limit_low;
325460Sjosephb	uint16_t base_low;
335460Sjosephb	uint8_t base_middle;
345460Sjosephb	uint8_t attr;
355460Sjosephb	uint8_t attr_and_limit;
365460Sjosephb	uint8_t base_high;
375460Sjosephb} global_descriptor_table[8];
385460Sjosephbstruct {
395460Sjosephb	uint16_t limit;	/* sizeof (global_descriptor_table) - 1 */
405460Sjosephb	void     *base;	/* &global_descriptor_table */
415460Sjosephb} gdt_info;
425460Sjosephb#pragma pack()
433446Smrj
443446Smrj#else	/* __lint */
453446Smrj
463446Smrj	.align 16
477656SSherry.Moore@Sun.COM	.data
483446Smrj	/*
493446Smrj	 * This must remain in sync with the entries in intel/sys/gdt.h; in
503446Smrj	 * particular kmdb uses B64CODE_SEL or B32CODE_SEL in perpetuity for
513446Smrj	 * its IDT entries (they're copied to the kernel's GDT in init_idt()).
523446Smrj	 */
533446Smrj
543446Smrjglobal_descriptor_table:
553446Smrj	.long   0
563446Smrj	.long   0
573446Smrj
583446Smrj	/* GDT_B32DATA: 32 bit flat data descriptor */
593446Smrj	.value  0xFFFF	/* segment limit 0..15 */
603446Smrj	.value  0x0000	/* segment base 0..15 */
613446Smrj	.byte   0x0	/* segment base 16..23 */
623446Smrj	.byte   0x92	/* P = 1, read/write data */
633446Smrj	.byte   0xCF	/* G=1, B=1, Limit (16..19)=1111 */
643446Smrj	.byte   0x0	/* segment base 24..32 */
653446Smrj
663446Smrj	/* GDT_B32CODE 32 bit flat code descriptor */
673446Smrj	.value  0xFFFF	/* segment limit 0..15 */
683446Smrj	.value  0x0000	/* segment base 0..15 */
693446Smrj	.byte   0x0	/* segment base 16..23 */
70*11664SDan.Mick@Sun.COM	.byte   0x9A	/* P=1, code, exec, readable */
713446Smrj	.byte   0xCF	/* G=1, D=1, Limit (16..19)=1111 */
723446Smrj	.byte   0x0	/* segment base 24..32 */
733446Smrj
743446Smrj	/*
753446Smrj	 * GDT_B16CODE 16 bit code descriptor for doing BIOS calls
763446Smrj	 */
773446Smrj	.value  0xFFFF	/* segment limit 0..15 */
783446Smrj	.value  0x0000	/* segment base 0..15 */
793446Smrj	.byte   0x0	/* segment base 16..23 */
80*11664SDan.Mick@Sun.COM	.byte   0x9A	/* P=1, code, exec, readable */
813446Smrj	.byte   0x0F	/* G=0, D=0, Limit (16..19)=1111 */
823446Smrj	.byte   0x0	/* segment base 24..32 */
833446Smrj
843446Smrj	/*
853446Smrj	 * GDT_B16DATA 16 bit data descriptor for doing BIOS calls
863446Smrj	 */
873446Smrj	.value  0xFFFF	/* segment limit 0..15 */
883446Smrj	.value  0x0000	/* segment base 0..15 */
893446Smrj	.byte   0x0	/* segment base 16..23 */
903446Smrj	.byte   0x92	/* P = 1, read/write data */
913446Smrj	.byte   0x4F	/* G=0, D=1, Limit (16..19)=1111 */
923446Smrj	.byte   0x0	/* segment base 24..32 */
933446Smrj
943446Smrj	/* GDT_B64CODE: 64 bit flat code descriptor - only L bit has meaning */
953446Smrj	.value  0xFFFF	/* segment limit 0..15 */
963446Smrj	.value  0x0000	/* segment base 0..15 */
973446Smrj	.byte   0x0	/* segment base 16..23 */
98*11664SDan.Mick@Sun.COM	.byte   0x9A	/* P=1, code, exec, readable */
993446Smrj	.byte   0xAF	/* G=1, D=0, L=1, Limit (16..19)=1111 */
1003446Smrj	.byte   0x0	/* segment base 24..32 */
1013446Smrj
1023446Smrj	/*
1033446Smrj	 * unused
1043446Smrj	 */
1053446Smrj	.long	0
1063446Smrj	.long	0
1073446Smrj
1087656SSherry.Moore@Sun.COM        /*
1097656SSherry.Moore@Sun.COM         * GDT_BGSTMP -- an entry for kmdb to use during boot
1107656SSherry.Moore@Sun.COM         * the fast reboot code uses this entry for memory copies, too.
1117656SSherry.Moore@Sun.COM         */
1127656SSherry.Moore@Sun.COM	.value  0x0001	/* segment limit 0..15 */
1137656SSherry.Moore@Sun.COM
1147656SSherry.Moore@Sun.COM	.globl fake_cpu_gdt_base_0_15
1157656SSherry.Moore@Sun.COMfake_cpu_gdt_base_0_15:
1167656SSherry.Moore@Sun.COM
1177656SSherry.Moore@Sun.COM	.value  0x0000	/* segment base 0..15 */
1187656SSherry.Moore@Sun.COM
1197656SSherry.Moore@Sun.COM	.globl fake_cpu_gdt_base_16_23
1207656SSherry.Moore@Sun.COMfake_cpu_gdt_base_16_23:
1217656SSherry.Moore@Sun.COM	.byte   0x0	/* segment base 16..23 */
122*11664SDan.Mick@Sun.COM	.byte   0x9A	/* P=1, code, exec, readable */
1237656SSherry.Moore@Sun.COM	.byte   0xC0	/* G=1, D=1, Limit (16..19)=0000 */
1247656SSherry.Moore@Sun.COM
1257656SSherry.Moore@Sun.COM	.globl fake_cpu_gdt_base_24_31
1267656SSherry.Moore@Sun.COMfake_cpu_gdt_base_24_31:
1277656SSherry.Moore@Sun.COM	.byte   0x0	/* segment base 24..32 */
1287656SSherry.Moore@Sun.COM
1297656SSherry.Moore@Sun.COM/	.long	0
1307656SSherry.Moore@Sun.COM/	.long	0
1313446Smrj
1323446Smrjgdt_info:
1333446Smrj	.value	gdt_info - global_descriptor_table - 1
1343446Smrj	.long	global_descriptor_table
1353446Smrj	.long   0		/* needed for 64 bit */
1363446Smrj
1377656SSherry.Moore@Sun.COMfake_cpu:
1387656SSherry.Moore@Sun.COM	.4byte 0
1397656SSherry.Moore@Sun.COM	.4byte 0
1407656SSherry.Moore@Sun.COM	.4byte 0
1417656SSherry.Moore@Sun.COM	.globl fake_cpu_ptr
1427656SSherry.Moore@Sun.COMfake_cpu_ptr:
1437656SSherry.Moore@Sun.COM	.4byte 0
1447656SSherry.Moore@Sun.COM	.skip 0x6c0, 0
1457656SSherry.Moore@Sun.COM
1463446Smrj#endif	/* __lint */
147