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/* 231f0f5e3eSDan Mick * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 24ae115bc7Smrj * Use is subject to license terms. 25*9b0bb795SJohn Levon * 26*9b0bb795SJohn Levon * Copyright 2020 Joyent, Inc. 27ae115bc7Smrj */ 28ae115bc7Smrj 29ae115bc7Smrj 30*9b0bb795SJohn Levon/* 31*9b0bb795SJohn Levon * The boot GDT must remain in sync with the entries in intel/sys/segments.h; in 32*9b0bb795SJohn Levon * particular kmdb uses B64CODE_SEL or B32CODE_SEL in perpetuity for its IDT 33*9b0bb795SJohn Levon * entries (they're copied to the kernel's GDT in init_idt()). 34*9b0bb795SJohn Levon * 35*9b0bb795SJohn Levon * The GDT is effectively an array of user_desc_t entries. 36*9b0bb795SJohn Levon */ 37ae115bc7Smrj 38ae115bc7Smrj .align 16 3919397407SSherry Moore .data 40ae115bc7Smrj 41ae115bc7Smrjglobal_descriptor_table: 42ae115bc7Smrj .long 0 43ae115bc7Smrj .long 0 44ae115bc7Smrj 45ae115bc7Smrj /* GDT_B32DATA: 32 bit flat data descriptor */ 46ae115bc7Smrj .value 0xFFFF /* segment limit 0..15 */ 47ae115bc7Smrj .value 0x0000 /* segment base 0..15 */ 48ae115bc7Smrj .byte 0x0 /* segment base 16..23 */ 49ae115bc7Smrj .byte 0x92 /* P = 1, read/write data */ 50ae115bc7Smrj .byte 0xCF /* G=1, B=1, Limit (16..19)=1111 */ 51ae115bc7Smrj .byte 0x0 /* segment base 24..32 */ 52ae115bc7Smrj 53ae115bc7Smrj /* GDT_B32CODE 32 bit flat code descriptor */ 54ae115bc7Smrj .value 0xFFFF /* segment limit 0..15 */ 55ae115bc7Smrj .value 0x0000 /* segment base 0..15 */ 56ae115bc7Smrj .byte 0x0 /* segment base 16..23 */ 571f0f5e3eSDan Mick .byte 0x9A /* P=1, code, exec, readable */ 58ae115bc7Smrj .byte 0xCF /* G=1, D=1, Limit (16..19)=1111 */ 59ae115bc7Smrj .byte 0x0 /* segment base 24..32 */ 60ae115bc7Smrj 61ae115bc7Smrj /* 62ae115bc7Smrj * GDT_B16CODE 16 bit code descriptor for doing BIOS calls 63ae115bc7Smrj */ 64ae115bc7Smrj .value 0xFFFF /* segment limit 0..15 */ 65ae115bc7Smrj .value 0x0000 /* segment base 0..15 */ 66ae115bc7Smrj .byte 0x0 /* segment base 16..23 */ 671f0f5e3eSDan Mick .byte 0x9A /* P=1, code, exec, readable */ 68ae115bc7Smrj .byte 0x0F /* G=0, D=0, Limit (16..19)=1111 */ 69ae115bc7Smrj .byte 0x0 /* segment base 24..32 */ 70ae115bc7Smrj 71ae115bc7Smrj /* 72ae115bc7Smrj * GDT_B16DATA 16 bit data descriptor for doing BIOS calls 73ae115bc7Smrj */ 74ae115bc7Smrj .value 0xFFFF /* segment limit 0..15 */ 75ae115bc7Smrj .value 0x0000 /* segment base 0..15 */ 76ae115bc7Smrj .byte 0x0 /* segment base 16..23 */ 77ae115bc7Smrj .byte 0x92 /* P = 1, read/write data */ 78ae115bc7Smrj .byte 0x4F /* G=0, D=1, Limit (16..19)=1111 */ 79ae115bc7Smrj .byte 0x0 /* segment base 24..32 */ 80ae115bc7Smrj 81ae115bc7Smrj /* GDT_B64CODE: 64 bit flat code descriptor - only L bit has meaning */ 82ae115bc7Smrj .value 0xFFFF /* segment limit 0..15 */ 83ae115bc7Smrj .value 0x0000 /* segment base 0..15 */ 84ae115bc7Smrj .byte 0x0 /* segment base 16..23 */ 851f0f5e3eSDan Mick .byte 0x9A /* P=1, code, exec, readable */ 86ae115bc7Smrj .byte 0xAF /* G=1, D=0, L=1, Limit (16..19)=1111 */ 87ae115bc7Smrj .byte 0x0 /* segment base 24..32 */ 88ae115bc7Smrj 89ae115bc7Smrj /* 90ae115bc7Smrj * unused 91ae115bc7Smrj */ 92ae115bc7Smrj .long 0 93ae115bc7Smrj .long 0 94ae115bc7Smrj 9519397407SSherry Moore /* 9619397407SSherry Moore * GDT_BGSTMP -- an entry for kmdb to use during boot 9719397407SSherry Moore * the fast reboot code uses this entry for memory copies, too. 9819397407SSherry Moore */ 9919397407SSherry Moore .value 0x0001 /* segment limit 0..15 */ 10019397407SSherry Moore 10119397407SSherry Moore .globl fake_cpu_gdt_base_0_15 10219397407SSherry Moorefake_cpu_gdt_base_0_15: 10319397407SSherry Moore 10419397407SSherry Moore .value 0x0000 /* segment base 0..15 */ 10519397407SSherry Moore 10619397407SSherry Moore .globl fake_cpu_gdt_base_16_23 10719397407SSherry Moorefake_cpu_gdt_base_16_23: 10819397407SSherry Moore .byte 0x0 /* segment base 16..23 */ 1091f0f5e3eSDan Mick .byte 0x9A /* P=1, code, exec, readable */ 11019397407SSherry Moore .byte 0xC0 /* G=1, D=1, Limit (16..19)=0000 */ 11119397407SSherry Moore 11219397407SSherry Moore .globl fake_cpu_gdt_base_24_31 11319397407SSherry Moorefake_cpu_gdt_base_24_31: 11419397407SSherry Moore .byte 0x0 /* segment base 24..32 */ 11519397407SSherry Moore 11619397407SSherry Moore/ .long 0 11719397407SSherry Moore/ .long 0 118ae115bc7Smrj 119*9b0bb795SJohn Levon 120*9b0bb795SJohn Levon/* 121*9b0bb795SJohn Levon * This is a desctbr_t. 122*9b0bb795SJohn Levon */ 123ae115bc7Smrjgdt_info: 124ae115bc7Smrj .value gdt_info - global_descriptor_table - 1 125ae115bc7Smrj .long global_descriptor_table 126ae115bc7Smrj .long 0 /* needed for 64 bit */ 127ae115bc7Smrj 12819397407SSherry Moorefake_cpu: 12919397407SSherry Moore .4byte 0 13019397407SSherry Moore .4byte 0 13119397407SSherry Moore .4byte 0 13219397407SSherry Moore .globl fake_cpu_ptr 13319397407SSherry Moorefake_cpu_ptr: 13419397407SSherry Moore .4byte 0 13519397407SSherry Moore .skip 0x6c0, 0 13619397407SSherry Moore 137