1ae115bc7Smrj/* 2ae115bc7Smrj * CDDL HEADER START 3ae115bc7Smrj * 4ae115bc7Smrj * The contents of this file are subject to the terms of the 5ae115bc7Smrj * Common Development and Distribution License (the "License"). 6ae115bc7Smrj * You may not use this file except in compliance with the License. 7ae115bc7Smrj * 8ae115bc7Smrj * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9ae115bc7Smrj * or http://www.opensolaris.org/os/licensing. 10ae115bc7Smrj * See the License for the specific language governing permissions 11ae115bc7Smrj * and limitations under the License. 12ae115bc7Smrj * 13ae115bc7Smrj * When distributing Covered Code, include this CDDL HEADER in each 14ae115bc7Smrj * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15ae115bc7Smrj * If applicable, add the following below this CDDL HEADER, with the 16ae115bc7Smrj * fields enclosed by brackets "[]" replaced with your own identifying 17ae115bc7Smrj * information: Portions Copyright [yyyy] [name of copyright owner] 18ae115bc7Smrj * 19ae115bc7Smrj * CDDL HEADER END 20ae115bc7Smrj */ 21ae115bc7Smrj 22ae115bc7Smrj/* 23*1f0f5e3eSDan Mick * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 24ae115bc7Smrj * Use is subject to license terms. 25ae115bc7Smrj */ 26ae115bc7Smrj 27ae115bc7Smrj 28ae115bc7Smrj#if defined(__lint) 290cfdb603Sjosephb#pragma pack(1) 300cfdb603Sjosephbstruct { 310cfdb603Sjosephb uint16_t limit_low; 320cfdb603Sjosephb uint16_t base_low; 330cfdb603Sjosephb uint8_t base_middle; 340cfdb603Sjosephb uint8_t attr; 350cfdb603Sjosephb uint8_t attr_and_limit; 360cfdb603Sjosephb uint8_t base_high; 370cfdb603Sjosephb} global_descriptor_table[8]; 380cfdb603Sjosephbstruct { 390cfdb603Sjosephb uint16_t limit; /* sizeof (global_descriptor_table) - 1 */ 400cfdb603Sjosephb void *base; /* &global_descriptor_table */ 410cfdb603Sjosephb} gdt_info; 420cfdb603Sjosephb#pragma pack() 43ae115bc7Smrj 44ae115bc7Smrj#else /* __lint */ 45ae115bc7Smrj 46ae115bc7Smrj .align 16 4719397407SSherry Moore .data 48ae115bc7Smrj /* 49ae115bc7Smrj * This must remain in sync with the entries in intel/sys/gdt.h; in 50ae115bc7Smrj * particular kmdb uses B64CODE_SEL or B32CODE_SEL in perpetuity for 51ae115bc7Smrj * its IDT entries (they're copied to the kernel's GDT in init_idt()). 52ae115bc7Smrj */ 53ae115bc7Smrj 54ae115bc7Smrjglobal_descriptor_table: 55ae115bc7Smrj .long 0 56ae115bc7Smrj .long 0 57ae115bc7Smrj 58ae115bc7Smrj /* GDT_B32DATA: 32 bit flat data descriptor */ 59ae115bc7Smrj .value 0xFFFF /* segment limit 0..15 */ 60ae115bc7Smrj .value 0x0000 /* segment base 0..15 */ 61ae115bc7Smrj .byte 0x0 /* segment base 16..23 */ 62ae115bc7Smrj .byte 0x92 /* P = 1, read/write data */ 63ae115bc7Smrj .byte 0xCF /* G=1, B=1, Limit (16..19)=1111 */ 64ae115bc7Smrj .byte 0x0 /* segment base 24..32 */ 65ae115bc7Smrj 66ae115bc7Smrj /* GDT_B32CODE 32 bit flat code descriptor */ 67ae115bc7Smrj .value 0xFFFF /* segment limit 0..15 */ 68ae115bc7Smrj .value 0x0000 /* segment base 0..15 */ 69ae115bc7Smrj .byte 0x0 /* segment base 16..23 */ 70*1f0f5e3eSDan Mick .byte 0x9A /* P=1, code, exec, readable */ 71ae115bc7Smrj .byte 0xCF /* G=1, D=1, Limit (16..19)=1111 */ 72ae115bc7Smrj .byte 0x0 /* segment base 24..32 */ 73ae115bc7Smrj 74ae115bc7Smrj /* 75ae115bc7Smrj * GDT_B16CODE 16 bit code descriptor for doing BIOS calls 76ae115bc7Smrj */ 77ae115bc7Smrj .value 0xFFFF /* segment limit 0..15 */ 78ae115bc7Smrj .value 0x0000 /* segment base 0..15 */ 79ae115bc7Smrj .byte 0x0 /* segment base 16..23 */ 80*1f0f5e3eSDan Mick .byte 0x9A /* P=1, code, exec, readable */ 81ae115bc7Smrj .byte 0x0F /* G=0, D=0, Limit (16..19)=1111 */ 82ae115bc7Smrj .byte 0x0 /* segment base 24..32 */ 83ae115bc7Smrj 84ae115bc7Smrj /* 85ae115bc7Smrj * GDT_B16DATA 16 bit data descriptor for doing BIOS calls 86ae115bc7Smrj */ 87ae115bc7Smrj .value 0xFFFF /* segment limit 0..15 */ 88ae115bc7Smrj .value 0x0000 /* segment base 0..15 */ 89ae115bc7Smrj .byte 0x0 /* segment base 16..23 */ 90ae115bc7Smrj .byte 0x92 /* P = 1, read/write data */ 91ae115bc7Smrj .byte 0x4F /* G=0, D=1, Limit (16..19)=1111 */ 92ae115bc7Smrj .byte 0x0 /* segment base 24..32 */ 93ae115bc7Smrj 94ae115bc7Smrj /* GDT_B64CODE: 64 bit flat code descriptor - only L bit has meaning */ 95ae115bc7Smrj .value 0xFFFF /* segment limit 0..15 */ 96ae115bc7Smrj .value 0x0000 /* segment base 0..15 */ 97ae115bc7Smrj .byte 0x0 /* segment base 16..23 */ 98*1f0f5e3eSDan Mick .byte 0x9A /* P=1, code, exec, readable */ 99ae115bc7Smrj .byte 0xAF /* G=1, D=0, L=1, Limit (16..19)=1111 */ 100ae115bc7Smrj .byte 0x0 /* segment base 24..32 */ 101ae115bc7Smrj 102ae115bc7Smrj /* 103ae115bc7Smrj * unused 104ae115bc7Smrj */ 105ae115bc7Smrj .long 0 106ae115bc7Smrj .long 0 107ae115bc7Smrj 108ae115bc7Smrj /* 109ae115bc7Smrj * GDT_BGSTMP -- an entry for kmdb to use during boot 11019397407SSherry Moore * the fast reboot code uses this entry for memory copies, too. 111ae115bc7Smrj */ 11219397407SSherry Moore .value 0x0001 /* segment limit 0..15 */ 11319397407SSherry Moore 11419397407SSherry Moore .globl fake_cpu_gdt_base_0_15 11519397407SSherry Moorefake_cpu_gdt_base_0_15: 11619397407SSherry Moore 11719397407SSherry Moore .value 0x0000 /* segment base 0..15 */ 11819397407SSherry Moore 11919397407SSherry Moore .globl fake_cpu_gdt_base_16_23 12019397407SSherry Moorefake_cpu_gdt_base_16_23: 12119397407SSherry Moore .byte 0x0 /* segment base 16..23 */ 122*1f0f5e3eSDan Mick .byte 0x9A /* P=1, code, exec, readable */ 12319397407SSherry Moore .byte 0xC0 /* G=1, D=1, Limit (16..19)=0000 */ 12419397407SSherry Moore 12519397407SSherry Moore .globl fake_cpu_gdt_base_24_31 12619397407SSherry Moorefake_cpu_gdt_base_24_31: 12719397407SSherry Moore .byte 0x0 /* segment base 24..32 */ 12819397407SSherry Moore 12919397407SSherry Moore/ .long 0 13019397407SSherry Moore/ .long 0 131ae115bc7Smrj 132ae115bc7Smrjgdt_info: 133ae115bc7Smrj .value gdt_info - global_descriptor_table - 1 134ae115bc7Smrj .long global_descriptor_table 135ae115bc7Smrj .long 0 /* needed for 64 bit */ 136ae115bc7Smrj 13719397407SSherry Moorefake_cpu: 13819397407SSherry Moore .4byte 0 13919397407SSherry Moore .4byte 0 14019397407SSherry Moore .4byte 0 14119397407SSherry Moore .globl fake_cpu_ptr 14219397407SSherry Moorefake_cpu_ptr: 14319397407SSherry Moore .4byte 0 14419397407SSherry Moore .skip 0x6c0, 0 14519397407SSherry Moore 146ae115bc7Smrj#endif /* __lint */ 147