17c478bd9Sstevel@tonic-gate /* 20baeff3dSrab * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 37c478bd9Sstevel@tonic-gate * Use is subject to license terms. 47c478bd9Sstevel@tonic-gate */ 57c478bd9Sstevel@tonic-gate 67c478bd9Sstevel@tonic-gate #ifndef _SYS_SEGMENTS_H 77c478bd9Sstevel@tonic-gate #define _SYS_SEGMENTS_H 87c478bd9Sstevel@tonic-gate 97c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 107c478bd9Sstevel@tonic-gate 117c478bd9Sstevel@tonic-gate #ifdef __cplusplus 127c478bd9Sstevel@tonic-gate extern "C" { 137c478bd9Sstevel@tonic-gate #endif 147c478bd9Sstevel@tonic-gate 157c478bd9Sstevel@tonic-gate /* 167c478bd9Sstevel@tonic-gate * Copyright (c) 1989, 1990 William F. Jolitz 177c478bd9Sstevel@tonic-gate * Copyright (c) 1990 The Regents of the University of California. 187c478bd9Sstevel@tonic-gate * All rights reserved. 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * This code is derived from software contributed to Berkeley by 217c478bd9Sstevel@tonic-gate * William Jolitz. 227c478bd9Sstevel@tonic-gate * 237c478bd9Sstevel@tonic-gate * Redistribution and use in source and binary forms, with or without 247c478bd9Sstevel@tonic-gate * modification, are permitted provided that the following conditions 257c478bd9Sstevel@tonic-gate * are met: 267c478bd9Sstevel@tonic-gate * 1. Redistributions of source code must retain the above copyright 277c478bd9Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer. 287c478bd9Sstevel@tonic-gate * 2. Redistributions in binary form must reproduce the above copyright 297c478bd9Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer in the 307c478bd9Sstevel@tonic-gate * documentation and/or other materials provided with the distribution. 317c478bd9Sstevel@tonic-gate * 3. All advertising materials mentioning features or use of this software 327c478bd9Sstevel@tonic-gate * must display the following acknowledgement: 337c478bd9Sstevel@tonic-gate * This product includes software developed by the University of 347c478bd9Sstevel@tonic-gate * California, Berkeley and its contributors. 357c478bd9Sstevel@tonic-gate * 4. Neither the name of the University nor the names of its contributors 367c478bd9Sstevel@tonic-gate * may be used to endorse or promote products derived from this software 377c478bd9Sstevel@tonic-gate * without specific prior written permission. 387c478bd9Sstevel@tonic-gate * 397c478bd9Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 407c478bd9Sstevel@tonic-gate * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 417c478bd9Sstevel@tonic-gate * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 427c478bd9Sstevel@tonic-gate * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 437c478bd9Sstevel@tonic-gate * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 447c478bd9Sstevel@tonic-gate * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 457c478bd9Sstevel@tonic-gate * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 467c478bd9Sstevel@tonic-gate * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 477c478bd9Sstevel@tonic-gate * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 487c478bd9Sstevel@tonic-gate * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 497c478bd9Sstevel@tonic-gate * SUCH DAMAGE. 507c478bd9Sstevel@tonic-gate * 517c478bd9Sstevel@tonic-gate * from: @(#)segments.h 7.1 (Berkeley) 5/9/91 527c478bd9Sstevel@tonic-gate * $FreeBSD: src/sys/i386/include/segments.h,v 1.34 2003/09/10 01:07:04 537c478bd9Sstevel@tonic-gate * jhb Exp $ 547c478bd9Sstevel@tonic-gate * 557c478bd9Sstevel@tonic-gate * 386 Segmentation Data Structures and definitions 567c478bd9Sstevel@tonic-gate * William F. Jolitz (william@ernie.berkeley.edu) 6/20/1989 577c478bd9Sstevel@tonic-gate */ 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate #include <sys/tss.h> 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate /* 627c478bd9Sstevel@tonic-gate * Selector register format 637c478bd9Sstevel@tonic-gate * CS, DS, ES, FS, GS, SS 647c478bd9Sstevel@tonic-gate * 657c478bd9Sstevel@tonic-gate * 15 3 2 1 0 667c478bd9Sstevel@tonic-gate * +---------------------+---+----+ 677c478bd9Sstevel@tonic-gate * | SI |TI |RPL | 687c478bd9Sstevel@tonic-gate * +---------------------+---+----+ 697c478bd9Sstevel@tonic-gate * 707c478bd9Sstevel@tonic-gate * SI = selector index 717c478bd9Sstevel@tonic-gate * TI = table indicator (0 = GDT, 1 = LDT) 727c478bd9Sstevel@tonic-gate * RPL = requestor privilege level 737c478bd9Sstevel@tonic-gate */ 747c478bd9Sstevel@tonic-gate #if !defined(_ASM) || defined(__GNUC_AS__) 757c478bd9Sstevel@tonic-gate #define IDXTOSEL(s) ((s) << 3) /* index to selector */ 767c478bd9Sstevel@tonic-gate #define SEL_GDT(s, r) (IDXTOSEL(s) | r) /* global sel */ 777c478bd9Sstevel@tonic-gate #else 787c478bd9Sstevel@tonic-gate #define IDXTOSEL(s) [s << 3] 797c478bd9Sstevel@tonic-gate #define SEL_GDT(s, r) [IDXTOSEL(s) | r] 807c478bd9Sstevel@tonic-gate #endif 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate #define SELTOIDX(s) ((s) >> 3) /* selector to index */ 837c478bd9Sstevel@tonic-gate #define SEL_KPL 0 /* kernel priority level */ 847c478bd9Sstevel@tonic-gate #define SEL_UPL 3 /* user priority level */ 857c478bd9Sstevel@tonic-gate #define SEL_TI_LDT 4 /* local descriptor table */ 867c478bd9Sstevel@tonic-gate #define SEL_LDT(s) (IDXTOSEL(s) | SEL_TI_LDT | SEL_UPL) /* local sel */ 877c478bd9Sstevel@tonic-gate #define CPL_MASK 3 /* RPL mask for selector */ 887c478bd9Sstevel@tonic-gate #define SELISLDT(s) (((s) & SEL_TI_LDT) == SEL_TI_LDT) 897c478bd9Sstevel@tonic-gate #define SELISUPL(s) (((s) & CPL_MASK) == SEL_UPL) 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate #ifndef _ASM 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate typedef uint16_t selector_t; /* selector reigster */ 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate /* 967c478bd9Sstevel@tonic-gate * Hardware descriptor table register format for GDT and IDT. 977c478bd9Sstevel@tonic-gate */ 987c478bd9Sstevel@tonic-gate #if defined(__amd64) 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate #pragma pack(2) 1017c478bd9Sstevel@tonic-gate typedef struct { 1027c478bd9Sstevel@tonic-gate uint16_t dtr_limit; /* table limit */ 1037c478bd9Sstevel@tonic-gate uint64_t dtr_base; /* table base address */ 1047c478bd9Sstevel@tonic-gate } desctbr_t; 1057c478bd9Sstevel@tonic-gate #pragma pack() 1067c478bd9Sstevel@tonic-gate 1077c478bd9Sstevel@tonic-gate #elif defined(__i386) 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate #pragma pack(2) 1107c478bd9Sstevel@tonic-gate typedef struct { 1117c478bd9Sstevel@tonic-gate uint16_t dtr_limit; /* table limit */ 1127c478bd9Sstevel@tonic-gate uint32_t dtr_base; /* table base address */ 1137c478bd9Sstevel@tonic-gate } desctbr_t; 1147c478bd9Sstevel@tonic-gate #pragma pack() 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate #endif /* __i386 */ 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate /* 1197c478bd9Sstevel@tonic-gate * Functions for loading and storing descriptor table 1207c478bd9Sstevel@tonic-gate * registers. 1217c478bd9Sstevel@tonic-gate */ 1227c478bd9Sstevel@tonic-gate extern void rd_idtr(desctbr_t *); 1237c478bd9Sstevel@tonic-gate extern void wr_idtr(desctbr_t *); 1247c478bd9Sstevel@tonic-gate extern void rd_gdtr(desctbr_t *); 1257c478bd9Sstevel@tonic-gate extern void wr_gdtr(desctbr_t *); 1267c478bd9Sstevel@tonic-gate extern void wr_ldtr(selector_t); 1277c478bd9Sstevel@tonic-gate extern selector_t rd_ldtr(void); 1287c478bd9Sstevel@tonic-gate extern void wr_tsr(selector_t); 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate #if defined(__amd64) 1317c478bd9Sstevel@tonic-gate extern void clr_ldt_sregs(void); 1327c478bd9Sstevel@tonic-gate #endif 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate #if !defined(__amd64) 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate /* 1377c478bd9Sstevel@tonic-gate * User segment descriptors (code and data). 1387c478bd9Sstevel@tonic-gate * Legacy mode 64-bits wide. 1397c478bd9Sstevel@tonic-gate */ 1407c478bd9Sstevel@tonic-gate typedef struct user_desc { 1417c478bd9Sstevel@tonic-gate uint32_t usd_lolimit:16; /* segment limit 15:0 */ 1427c478bd9Sstevel@tonic-gate uint32_t usd_lobase:16; /* segment base 15:0 */ 1437c478bd9Sstevel@tonic-gate uint32_t usd_midbase:8; /* segment base 23:16 */ 1447c478bd9Sstevel@tonic-gate uint32_t usd_type:5; /* segment type, includes S bit */ 1457c478bd9Sstevel@tonic-gate uint32_t usd_dpl:2; /* segment descriptor priority level */ 1467c478bd9Sstevel@tonic-gate uint32_t usd_p:1; /* segment descriptor present */ 1477c478bd9Sstevel@tonic-gate uint32_t usd_hilimit:4; /* segment limit 19:16 */ 1487c478bd9Sstevel@tonic-gate uint32_t usd_avl:1; /* available to sw, but not used */ 1497c478bd9Sstevel@tonic-gate uint32_t usd_reserved:1; /* unused, ignored */ 1507c478bd9Sstevel@tonic-gate uint32_t usd_def32:1; /* default 32 vs 16 bit operand */ 1517c478bd9Sstevel@tonic-gate uint32_t usd_gran:1; /* limit units (bytes vs pages) */ 1527c478bd9Sstevel@tonic-gate uint32_t usd_hibase:8; /* segment base 31:24 */ 1537c478bd9Sstevel@tonic-gate } user_desc_t; 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate #define USEGD_GETBASE(usd) ((usd)->usd_lobase | \ 1567c478bd9Sstevel@tonic-gate (usd)->usd_midbase << 16 | \ 1577c478bd9Sstevel@tonic-gate (usd)->usd_hibase << (16 + 8)) 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate #define USEGD_SETBASE(usd, b) ((usd)->usd_lobase = (b), \ 1607c478bd9Sstevel@tonic-gate (usd)->usd_midbase = (b) >> 16, \ 1617c478bd9Sstevel@tonic-gate (usd)->usd_hibase = (b) >> (16 + 8)) 1627c478bd9Sstevel@tonic-gate 1637c478bd9Sstevel@tonic-gate #define USEGD_GETLIMIT(usd) ((usd)->usd_lolimit | \ 1647c478bd9Sstevel@tonic-gate (usd)->usd_hilimit << 16) 1657c478bd9Sstevel@tonic-gate 1667c478bd9Sstevel@tonic-gate #define USEGD_SETLIMIT(usd, lim) ((usd)->usd_lolimit = lim, \ 1677c478bd9Sstevel@tonic-gate (usd)->usd_hilimit = lim >> 16) 1687c478bd9Sstevel@tonic-gate 1697c478bd9Sstevel@tonic-gate #define USD_TYPESHIFT 5 /* size of usd_type field */ 1707c478bd9Sstevel@tonic-gate 1717c478bd9Sstevel@tonic-gate #else /* __amd64 */ 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate /* 1747c478bd9Sstevel@tonic-gate * User segment descriptors. 1757c478bd9Sstevel@tonic-gate * Long mode 64-bits wide. 1767c478bd9Sstevel@tonic-gate * 1777c478bd9Sstevel@tonic-gate * In 32-bit compatibility mode (%cs:usd_long=0) all fields are interpreted 1787c478bd9Sstevel@tonic-gate * as in legacy mode for both code and data. 1797c478bd9Sstevel@tonic-gate * 1807c478bd9Sstevel@tonic-gate * In 64-bit mode (%cs:usd_long=1) code segments only have the conforming 1817c478bd9Sstevel@tonic-gate * bit in usd_type, usd_dpl, usd_p, usd_long and usd_def32=0. usd_def32 1827c478bd9Sstevel@tonic-gate * must be zero in 64-bit mode. Setting it to 1 is reserved for future use. 1837c478bd9Sstevel@tonic-gate * All other fields are loaded but ignored by hardware. 1847c478bd9Sstevel@tonic-gate * 1857c478bd9Sstevel@tonic-gate * 64-bit data segments only have usd_p. All other fields are loaded but 1867c478bd9Sstevel@tonic-gate * ignored by hardware when in 64-bit mode. 1877c478bd9Sstevel@tonic-gate */ 1887c478bd9Sstevel@tonic-gate typedef struct user_desc { 1897c478bd9Sstevel@tonic-gate uint64_t usd_lolimit:16; /* segment limit 15:0 */ 1907c478bd9Sstevel@tonic-gate uint64_t usd_lobase:16; /* segment base 15:0 */ 1917c478bd9Sstevel@tonic-gate uint64_t usd_midbase:8; /* segment base 23:16 */ 1927c478bd9Sstevel@tonic-gate uint64_t usd_type:5; /* segment type, includes S bit */ 1937c478bd9Sstevel@tonic-gate uint64_t usd_dpl:2; /* segment descriptor priority level */ 1947c478bd9Sstevel@tonic-gate uint64_t usd_p:1; /* segment descriptor present */ 1957c478bd9Sstevel@tonic-gate uint64_t usd_hilimit:4; /* segment limit 19:16 */ 1967c478bd9Sstevel@tonic-gate uint64_t usd_avl:1; /* available to sw, but not used */ 1977c478bd9Sstevel@tonic-gate uint64_t usd_long:1; /* long mode (%cs only) */ 1987c478bd9Sstevel@tonic-gate uint64_t usd_def32:1; /* default 32 vs 16 bit operand */ 1997c478bd9Sstevel@tonic-gate uint64_t usd_gran:1; /* limit units (bytes vs page) */ 2007c478bd9Sstevel@tonic-gate uint64_t usd_hibase:8; /* segment base 31:24 */ 2017c478bd9Sstevel@tonic-gate } user_desc_t; 2027c478bd9Sstevel@tonic-gate 2037c478bd9Sstevel@tonic-gate #define USEGD_GETBASE(usd) ((usd)->usd_lobase | \ 2047c478bd9Sstevel@tonic-gate (usd)->usd_midbase << 16 | \ 2057c478bd9Sstevel@tonic-gate (usd)->usd_hibase << (16 + 8)) 2067c478bd9Sstevel@tonic-gate 2077c478bd9Sstevel@tonic-gate #define USEGD_SETBASE(usd, b) ((usd)->usd_lobase = (b), \ 2087c478bd9Sstevel@tonic-gate (usd)->usd_midbase = (b) >> 16, \ 2097c478bd9Sstevel@tonic-gate (usd)->usd_hibase = (b) >> (16 + 8)) 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate #define USEGD_GETLIMIT(usd) ((usd)->usd_lolimit | \ 2127c478bd9Sstevel@tonic-gate (usd)->usd_hilimit << 16) 2137c478bd9Sstevel@tonic-gate 2147c478bd9Sstevel@tonic-gate #define USEGD_SETLIMIT(usd, lim) ((usd)->usd_lolimit = lim, \ 2157c478bd9Sstevel@tonic-gate (usd)->usd_hilimit = lim >> 16) 2167c478bd9Sstevel@tonic-gate 2177c478bd9Sstevel@tonic-gate #define USD_TYPESHIFT 5 /* size of usd_type field */ 2187c478bd9Sstevel@tonic-gate 2197c478bd9Sstevel@tonic-gate #endif /* __amd64 */ 2207c478bd9Sstevel@tonic-gate 2217c478bd9Sstevel@tonic-gate #if !defined(__amd64) 2227c478bd9Sstevel@tonic-gate 2237c478bd9Sstevel@tonic-gate /* 2247c478bd9Sstevel@tonic-gate * System segment descriptors for LDT and TSS segments. 2257c478bd9Sstevel@tonic-gate * Legacy mode 64-bits wide. 2267c478bd9Sstevel@tonic-gate */ 2277c478bd9Sstevel@tonic-gate typedef struct system_desc { 2287c478bd9Sstevel@tonic-gate uint32_t ssd_lolimit:16; /* segment limit 15:0 */ 2297c478bd9Sstevel@tonic-gate uint32_t ssd_lobase:16; /* segment base 15:0 */ 2307c478bd9Sstevel@tonic-gate uint32_t ssd_midbase:8; /* segment base 23:16 */ 2317c478bd9Sstevel@tonic-gate uint32_t ssd_type:4; /* segment type */ 2327c478bd9Sstevel@tonic-gate uint32_t ssd_zero:1; /* must be zero */ 2337c478bd9Sstevel@tonic-gate uint32_t ssd_dpl:2; /* segment descriptor priority level */ 2347c478bd9Sstevel@tonic-gate uint32_t ssd_p:1; /* segment descriptor present */ 2357c478bd9Sstevel@tonic-gate uint32_t ssd_hilimit:4; /* segment limit 19:16 */ 2367c478bd9Sstevel@tonic-gate uint32_t ssd_avl:1; /* available to sw, but not used */ 2377c478bd9Sstevel@tonic-gate uint32_t ssd_reserved:2; /* unused, ignored */ 2387c478bd9Sstevel@tonic-gate uint32_t ssd_gran:1; /* limit unit (bytes vs pages) */ 2397c478bd9Sstevel@tonic-gate uint32_t ssd_hibase:8; /* segment base 31:24 */ 2407c478bd9Sstevel@tonic-gate } system_desc_t; 2417c478bd9Sstevel@tonic-gate 2427c478bd9Sstevel@tonic-gate #else /* __amd64 */ 2437c478bd9Sstevel@tonic-gate 2447c478bd9Sstevel@tonic-gate /* 2457c478bd9Sstevel@tonic-gate * System segment descriptors for LDT and TSS segments. 2467c478bd9Sstevel@tonic-gate * Long mode 128-bits wide. 2477c478bd9Sstevel@tonic-gate * 2487c478bd9Sstevel@tonic-gate * 32-bit LDT and TSS descriptor types are redefined to 64-bit equivalents. 2497c478bd9Sstevel@tonic-gate * All other legacy types are reserved and illegal. 2507c478bd9Sstevel@tonic-gate */ 2517c478bd9Sstevel@tonic-gate typedef struct system_desc { 2527c478bd9Sstevel@tonic-gate uint64_t ssd_lolimit:16; /* segment limit 15:0 */ 2537c478bd9Sstevel@tonic-gate uint64_t ssd_lobase:16; /* segment base 15:0 */ 2547c478bd9Sstevel@tonic-gate uint64_t ssd_midbase:8; /* segment base 23:16 */ 2557c478bd9Sstevel@tonic-gate uint64_t ssd_type:4; /* segment type */ 2567c478bd9Sstevel@tonic-gate uint64_t ssd_zero1:1; /* must be zero */ 2577c478bd9Sstevel@tonic-gate uint64_t ssd_dpl:2; /* segment descriptor priority level */ 2587c478bd9Sstevel@tonic-gate uint64_t ssd_p:1; /* segment descriptor present */ 2597c478bd9Sstevel@tonic-gate uint64_t ssd_hilimit:4; /* segment limit 19:16 */ 2607c478bd9Sstevel@tonic-gate uint64_t ssd_avl:1; /* available to sw, but not used */ 2617c478bd9Sstevel@tonic-gate uint64_t ssd_resv1:2; /* unused, ignored */ 2627c478bd9Sstevel@tonic-gate uint64_t ssd_gran:1; /* limit unit (bytes vs pages) */ 2637c478bd9Sstevel@tonic-gate uint64_t ssd_hibase:8; /* segment base 31:24 */ 2647c478bd9Sstevel@tonic-gate uint64_t ssd_hi64base:32; /* segment base 63:32 */ 2657c478bd9Sstevel@tonic-gate uint64_t ssd_resv2:8; /* unused, ignored */ 2667c478bd9Sstevel@tonic-gate uint64_t ssd_zero2:5; /* must be zero */ 2677c478bd9Sstevel@tonic-gate uint64_t ssd_resv3:19; /* unused, ignored */ 2687c478bd9Sstevel@tonic-gate } system_desc_t; 2697c478bd9Sstevel@tonic-gate 2707c478bd9Sstevel@tonic-gate #endif /* __amd64 */ 2717c478bd9Sstevel@tonic-gate 2727c478bd9Sstevel@tonic-gate #define SYSSEGD_SETLIMIT(ssd, lim) ((ssd)->ssd_lolimit = lim, \ 2737c478bd9Sstevel@tonic-gate (ssd)->ssd_hilimit = lim >> 16) 2747c478bd9Sstevel@tonic-gate #if !defined(__amd64) 2757c478bd9Sstevel@tonic-gate 2767c478bd9Sstevel@tonic-gate /* 2777c478bd9Sstevel@tonic-gate * System gate segment descriptors for interrupt, trap, call and task gates. 2787c478bd9Sstevel@tonic-gate * Legacy mode 64-bits wide. 2797c478bd9Sstevel@tonic-gate */ 2807c478bd9Sstevel@tonic-gate typedef struct gate_desc { 2817c478bd9Sstevel@tonic-gate uint32_t sgd_looffset:16; /* segment code offset 15:0 */ 2827c478bd9Sstevel@tonic-gate uint32_t sgd_selector:16; /* target code or task selector */ 2837c478bd9Sstevel@tonic-gate uint32_t sgd_stkcpy:5; /* number of stack wds to cpy */ 2847c478bd9Sstevel@tonic-gate uint32_t sgd_resv:3; /* unused, ignored */ 2857c478bd9Sstevel@tonic-gate uint32_t sgd_type:5; /* segment type, includes S bit */ 2867c478bd9Sstevel@tonic-gate uint32_t sgd_dpl:2; /* segment descriptor priority level */ 2877c478bd9Sstevel@tonic-gate uint32_t sgd_p:1; /* segment descriptor present */ 2887c478bd9Sstevel@tonic-gate uint32_t sgd_hioffset:16; /* code seg off 31:16 */ 2897c478bd9Sstevel@tonic-gate } gate_desc_t; 2907c478bd9Sstevel@tonic-gate 2917c478bd9Sstevel@tonic-gate #define GATESEG_GETOFFSET(sgd) ((sgd)->sgd_looffset | \ 2927c478bd9Sstevel@tonic-gate (sgd)->sgd_hioffset << 16) 2937c478bd9Sstevel@tonic-gate 2947c478bd9Sstevel@tonic-gate #else /* __amd64 */ 2957c478bd9Sstevel@tonic-gate 2967c478bd9Sstevel@tonic-gate /* 2977c478bd9Sstevel@tonic-gate * System segment descriptors for interrupt, trap and call gates. 2987c478bd9Sstevel@tonic-gate * Long mode 128-bits wide. 2997c478bd9Sstevel@tonic-gate * 3007c478bd9Sstevel@tonic-gate * 32-bit interrupt, trap and call gate types are redefined to 64-bit 3017c478bd9Sstevel@tonic-gate * equivalents. Task gates along with all other legacy types are reserved 3027c478bd9Sstevel@tonic-gate * and illegal. 3037c478bd9Sstevel@tonic-gate */ 3047c478bd9Sstevel@tonic-gate typedef struct gate_desc { 3057c478bd9Sstevel@tonic-gate uint64_t sgd_looffset:16; /* segment code offset 15:0 */ 3067c478bd9Sstevel@tonic-gate uint64_t sgd_selector:16; /* target code or task selector */ 3077c478bd9Sstevel@tonic-gate uint64_t sgd_ist:3; /* IST table index */ 3087c478bd9Sstevel@tonic-gate uint64_t sgd_resv1:5; /* unused, ignored */ 3097c478bd9Sstevel@tonic-gate uint64_t sgd_type:5; /* segment type, includes S bit */ 3107c478bd9Sstevel@tonic-gate uint64_t sgd_dpl:2; /* segment descriptor priority level */ 3117c478bd9Sstevel@tonic-gate uint64_t sgd_p:1; /* segment descriptor present */ 3127c478bd9Sstevel@tonic-gate uint64_t sgd_hioffset:16; /* segment code offset 31:16 */ 3137c478bd9Sstevel@tonic-gate uint64_t sgd_hi64offset:32; /* segment code offset 63:32 */ 3147c478bd9Sstevel@tonic-gate uint64_t sgd_resv2:8; /* unused, ignored */ 3157c478bd9Sstevel@tonic-gate uint64_t sgd_zero:5; /* call gate only: must be zero */ 3167c478bd9Sstevel@tonic-gate uint64_t sgd_resv3:19; /* unused, ignored */ 3177c478bd9Sstevel@tonic-gate } gate_desc_t; 3187c478bd9Sstevel@tonic-gate 3197c478bd9Sstevel@tonic-gate #define GATESEG_GETOFFSET(sgd) ((sgd)->sgd_looffset | \ 3207c478bd9Sstevel@tonic-gate (sgd)->sgd_hioffset << 16 | \ 3217c478bd9Sstevel@tonic-gate (sgd)->sgd_hi64offset << 32) 3227c478bd9Sstevel@tonic-gate 3237c478bd9Sstevel@tonic-gate #endif /* __amd64 */ 3247c478bd9Sstevel@tonic-gate 3257c478bd9Sstevel@tonic-gate /* 3267c478bd9Sstevel@tonic-gate * functions for initializing and updating segment descriptors. 3277c478bd9Sstevel@tonic-gate */ 3287c478bd9Sstevel@tonic-gate #if defined(__amd64) 3297c478bd9Sstevel@tonic-gate 3307c478bd9Sstevel@tonic-gate extern void set_usegd(user_desc_t *, uint_t, void *, size_t, uint_t, uint_t, 3317c478bd9Sstevel@tonic-gate uint_t, uint_t); 3327c478bd9Sstevel@tonic-gate extern void set_gatesegd(gate_desc_t *, void (*)(void), selector_t, uint_t, 3337c478bd9Sstevel@tonic-gate uint_t, uint_t); 3347c478bd9Sstevel@tonic-gate 3357c478bd9Sstevel@tonic-gate #elif defined(__i386) 3367c478bd9Sstevel@tonic-gate 3377c478bd9Sstevel@tonic-gate extern void set_usegd(user_desc_t *, void *, size_t, uint_t, uint_t, 3387c478bd9Sstevel@tonic-gate uint_t, uint_t); 3397c478bd9Sstevel@tonic-gate extern void set_gatesegd(gate_desc_t *, void (*)(void), selector_t, 3407c478bd9Sstevel@tonic-gate uint_t, uint_t, uint_t); 3417c478bd9Sstevel@tonic-gate 3427c478bd9Sstevel@tonic-gate #endif /* __i386 */ 3437c478bd9Sstevel@tonic-gate 3447c478bd9Sstevel@tonic-gate void set_syssegd(system_desc_t *, void *, size_t, uint_t, uint_t); 3457c478bd9Sstevel@tonic-gate 3467c478bd9Sstevel@tonic-gate #endif /* _ASM */ 3477c478bd9Sstevel@tonic-gate 3487c478bd9Sstevel@tonic-gate /* 3497c478bd9Sstevel@tonic-gate * Common segment parameter defintions for granularity, default 3507c478bd9Sstevel@tonic-gate * operand size and operaton mode. 3517c478bd9Sstevel@tonic-gate */ 3527c478bd9Sstevel@tonic-gate #define SDP_BYTES 0 /* segment limit scaled to bytes */ 3537c478bd9Sstevel@tonic-gate #define SDP_PAGES 1 /* segment limit scaled to pages */ 3547c478bd9Sstevel@tonic-gate #define SDP_OP32 1 /* code and data default operand = 32 bits */ 3557c478bd9Sstevel@tonic-gate #define SDP_LONG 1 /* long mode code segment (64 bits) */ 3567c478bd9Sstevel@tonic-gate #define SDP_SHORT 0 /* compat/legacy code segment (32 bits) */ 3577c478bd9Sstevel@tonic-gate /* 3587c478bd9Sstevel@tonic-gate * System segments and gate types. 3597c478bd9Sstevel@tonic-gate * 3607c478bd9Sstevel@tonic-gate * In long mode i386 32-bit ldt, tss, call, interrupt and trap gate 3617c478bd9Sstevel@tonic-gate * types are redefined into 64-bit equivalents. 3627c478bd9Sstevel@tonic-gate */ 3637c478bd9Sstevel@tonic-gate #define SDT_SYSNULL 0 /* system null */ 3647c478bd9Sstevel@tonic-gate #define SDT_SYS286TSS 1 /* system 286 TSS available */ 3657c478bd9Sstevel@tonic-gate #define SDT_SYSLDT 2 /* system local descriptor table */ 3667c478bd9Sstevel@tonic-gate #define SDT_SYS286BSY 3 /* system 286 TSS busy */ 3677c478bd9Sstevel@tonic-gate #define SDT_SYS286CGT 4 /* system 286 call gate */ 3687c478bd9Sstevel@tonic-gate #define SDT_SYSTASKGT 5 /* system task gate */ 3697c478bd9Sstevel@tonic-gate #define SDT_SYS286IGT 6 /* system 286 interrupt gate */ 3707c478bd9Sstevel@tonic-gate #define SDT_SYS286TGT 7 /* system 286 trap gate */ 3717c478bd9Sstevel@tonic-gate #define SDT_SYSNULL2 8 /* system null again */ 3727c478bd9Sstevel@tonic-gate #define SDT_SYSTSS 9 /* system TSS available */ 3737c478bd9Sstevel@tonic-gate #define SDT_SYSNULL3 10 /* system null again */ 3747c478bd9Sstevel@tonic-gate #define SDT_SYSTSSBSY 11 /* system TSS busy */ 3757c478bd9Sstevel@tonic-gate #define SDT_SYSCGT 12 /* system call gate */ 3767c478bd9Sstevel@tonic-gate #define SDT_SYSNULL4 13 /* system null again */ 3777c478bd9Sstevel@tonic-gate #define SDT_SYSIGT 14 /* system interrupt gate */ 3787c478bd9Sstevel@tonic-gate #define SDT_SYSTGT 15 /* system trap gate */ 3797c478bd9Sstevel@tonic-gate 3807c478bd9Sstevel@tonic-gate /* 3817c478bd9Sstevel@tonic-gate * Memory segment types. 3827c478bd9Sstevel@tonic-gate * 3837c478bd9Sstevel@tonic-gate * While in long mode expand-down, writable and accessed type field 3847c478bd9Sstevel@tonic-gate * attributes are ignored. Only the conforming bit is loaded by hardware 3857c478bd9Sstevel@tonic-gate * for long mode code segment descriptors. 3867c478bd9Sstevel@tonic-gate */ 3877c478bd9Sstevel@tonic-gate #define SDT_MEMRO 16 /* read only */ 3887c478bd9Sstevel@tonic-gate #define SDT_MEMROA 17 /* read only accessed */ 3897c478bd9Sstevel@tonic-gate #define SDT_MEMRW 18 /* read write */ 3907c478bd9Sstevel@tonic-gate #define SDT_MEMRWA 19 /* read write accessed */ 3917c478bd9Sstevel@tonic-gate #define SDT_MEMROD 20 /* read only expand dwn limit */ 3927c478bd9Sstevel@tonic-gate #define SDT_MEMRODA 21 /* read only expand dwn limit accessed */ 3937c478bd9Sstevel@tonic-gate #define SDT_MEMRWD 22 /* read write expand dwn limit */ 3947c478bd9Sstevel@tonic-gate #define SDT_MEMRWDA 23 /* read write expand dwn limit accessed */ 3957c478bd9Sstevel@tonic-gate #define SDT_MEME 24 /* execute only */ 3967c478bd9Sstevel@tonic-gate #define SDT_MEMEA 25 /* execute only accessed */ 3977c478bd9Sstevel@tonic-gate #define SDT_MEMER 26 /* execute read */ 3987c478bd9Sstevel@tonic-gate #define SDT_MEMERA 27 /* execute read accessed */ 3997c478bd9Sstevel@tonic-gate #define SDT_MEMEC 28 /* execute only conforming */ 4007c478bd9Sstevel@tonic-gate #define SDT_MEMEAC 29 /* execute only accessed conforming */ 4017c478bd9Sstevel@tonic-gate #define SDT_MEMERC 30 /* execute read conforming */ 4027c478bd9Sstevel@tonic-gate #define SDT_MEMERAC 31 /* execute read accessed conforming */ 4037c478bd9Sstevel@tonic-gate 4047c478bd9Sstevel@tonic-gate /* 4057c478bd9Sstevel@tonic-gate * Entries in the Interrupt Descriptor Table (IDT) 4067c478bd9Sstevel@tonic-gate */ 4077c478bd9Sstevel@tonic-gate #define IDT_DE 0 /* #DE: Divide Error */ 4087c478bd9Sstevel@tonic-gate #define IDT_DB 1 /* #DB: Debug */ 4097c478bd9Sstevel@tonic-gate #define IDT_NMI 2 /* Nonmaskable External Interrupt */ 4107c478bd9Sstevel@tonic-gate #define IDT_BP 3 /* #BP: Breakpoint */ 4117c478bd9Sstevel@tonic-gate #define IDT_OF 4 /* #OF: Overflow */ 4127c478bd9Sstevel@tonic-gate #define IDT_BR 5 /* #BR: Bound Range Exceeded */ 4137c478bd9Sstevel@tonic-gate #define IDT_UD 6 /* #UD: Undefined/Invalid Opcode */ 4147c478bd9Sstevel@tonic-gate #define IDT_NM 7 /* #NM: No Math Coprocessor */ 4157c478bd9Sstevel@tonic-gate #define IDT_DF 8 /* #DF: Double Fault */ 4167c478bd9Sstevel@tonic-gate #define IDT_FPUGP 9 /* Coprocessor Segment Overrun */ 4177c478bd9Sstevel@tonic-gate #define IDT_TS 10 /* #TS: Invalid TSS */ 4187c478bd9Sstevel@tonic-gate #define IDT_NP 11 /* #NP: Segment Not Present */ 4197c478bd9Sstevel@tonic-gate #define IDT_SS 12 /* #SS: Stack Segment Fault */ 4207c478bd9Sstevel@tonic-gate #define IDT_GP 13 /* #GP: General Protection Fault */ 4217c478bd9Sstevel@tonic-gate #define IDT_PF 14 /* #PF: Page Fault */ 4227c478bd9Sstevel@tonic-gate #define IDT_MF 16 /* #MF: FPU Floating-Point Error */ 4237c478bd9Sstevel@tonic-gate #define IDT_AC 17 /* #AC: Alignment Check */ 4247c478bd9Sstevel@tonic-gate #define IDT_MC 18 /* #MC: Machine Check */ 4257c478bd9Sstevel@tonic-gate #define IDT_XF 19 /* #XF: SIMD Floating-Point Exception */ 4267c478bd9Sstevel@tonic-gate #define NIDT 256 /* size in entries of IDT */ 4277c478bd9Sstevel@tonic-gate 4287c478bd9Sstevel@tonic-gate /* 4297c478bd9Sstevel@tonic-gate * Entries in the Global Descriptor Table (GDT) 4307c478bd9Sstevel@tonic-gate * 4317c478bd9Sstevel@tonic-gate * We make sure to space the system descriptors (LDT's, TSS') 4327c478bd9Sstevel@tonic-gate * such that they are double gdt slot aligned. This is because 4337c478bd9Sstevel@tonic-gate * in long mode system segment decriptors expand to 128 bits. 4347c478bd9Sstevel@tonic-gate * 4357c478bd9Sstevel@tonic-gate * GDT_LWPFS and GDT_LWPGS must be the same for both 32 and 64-bit 4367c478bd9Sstevel@tonic-gate * kernels. See setup_context in libc. 4377c478bd9Sstevel@tonic-gate */ 4387c478bd9Sstevel@tonic-gate #if defined(__amd64) 4397c478bd9Sstevel@tonic-gate 4407c478bd9Sstevel@tonic-gate #define GDT_NULL 0 /* null */ 4417c478bd9Sstevel@tonic-gate #define GDT_B32DATA 1 /* copied from boot */ 4427c478bd9Sstevel@tonic-gate #define GDT_B32CODE 2 /* copied from boot */ 4437c478bd9Sstevel@tonic-gate #define GDT_B64DATA 3 /* copied from boot */ 4447c478bd9Sstevel@tonic-gate #define GDT_B64CODE 4 /* copied from boot */ 4457c478bd9Sstevel@tonic-gate #define GDT_KCODE 5 /* kernel code seg %cs */ 4467c478bd9Sstevel@tonic-gate #define GDT_KDATA 6 /* kernel data seg %ds */ 4477c478bd9Sstevel@tonic-gate #define GDT_U32CODE 7 /* 32-bit process on 64-bit kernel %cs */ 4487c478bd9Sstevel@tonic-gate #define GDT_UDATA 8 /* user data seg %ds (32 and 64 bit) */ 4497c478bd9Sstevel@tonic-gate #define GDT_UCODE 9 /* native user code seg %cs */ 4507c478bd9Sstevel@tonic-gate #define GDT_LDT 10 /* LDT for current process */ 4517c478bd9Sstevel@tonic-gate #define GDT_KTSS 12 /* kernel tss */ 4527c478bd9Sstevel@tonic-gate #define GDT_FS GDT_NULL /* kernel %fs segment selector */ 4537c478bd9Sstevel@tonic-gate #define GDT_GS GDT_NULL /* kernel %gs segment selector */ 4547c478bd9Sstevel@tonic-gate #define GDT_LWPFS 55 /* lwp private %fs segment selector */ 4557c478bd9Sstevel@tonic-gate #define GDT_LWPGS 56 /* lwp private %gs segment selector */ 4567c478bd9Sstevel@tonic-gate #define NGDT 58 /* number of entries in GDT */ 4577c478bd9Sstevel@tonic-gate 4587c478bd9Sstevel@tonic-gate /* 4597c478bd9Sstevel@tonic-gate * This selector is only used in the temporary GDT used to bring additional 4607c478bd9Sstevel@tonic-gate * CPUs from 16-bit real mode into long mode in real_mode_start(). 4617c478bd9Sstevel@tonic-gate */ 4627c478bd9Sstevel@tonic-gate #define TEMPGDT_KCODE64 1 /* 64-bit code selector */ 4637c478bd9Sstevel@tonic-gate 4647c478bd9Sstevel@tonic-gate #elif defined(__i386) 4657c478bd9Sstevel@tonic-gate 4667c478bd9Sstevel@tonic-gate #define GDT_NULL 0 /* null */ 4677c478bd9Sstevel@tonic-gate #define GDT_BOOTFLAT 1 /* copied from boot */ 4687c478bd9Sstevel@tonic-gate #define GDT_BOOTCODE 2 /* copied from boot */ 4697c478bd9Sstevel@tonic-gate #define GDT_BOOTCODE16 3 /* copied from boot */ 4707c478bd9Sstevel@tonic-gate #define GDT_BOOTDATA 4 /* copied from boot */ 4717c478bd9Sstevel@tonic-gate #define GDT_LDT 40 /* LDT for current process */ 4727c478bd9Sstevel@tonic-gate #define GDT_KTSS 42 /* kernel tss */ 4737c478bd9Sstevel@tonic-gate #define GDT_KCODE 43 /* kernel code seg %cs */ 4747c478bd9Sstevel@tonic-gate #define GDT_KDATA 44 /* kernel data seg %ds */ 4757c478bd9Sstevel@tonic-gate #define GDT_UCODE 45 /* native user code seg %cs */ 4767c478bd9Sstevel@tonic-gate #define GDT_UDATA 46 /* user data seg %ds (32 and 64 bit) */ 4777c478bd9Sstevel@tonic-gate #define GDT_DBFLT 47 /* double fault #DF selector */ 4787c478bd9Sstevel@tonic-gate #define GDT_FS 53 /* kernel %fs segment selector */ 4797c478bd9Sstevel@tonic-gate #define GDT_GS 54 /* kernel %gs segment selector */ 4807c478bd9Sstevel@tonic-gate #define GDT_LWPFS 55 /* lwp private %fs segment selector */ 4817c478bd9Sstevel@tonic-gate #define GDT_LWPGS 56 /* lwp private %gs segment selector */ 4827c478bd9Sstevel@tonic-gate #define NGDT 90 /* number of entries in GDT */ 4837c478bd9Sstevel@tonic-gate 4847c478bd9Sstevel@tonic-gate #endif /* __i386 */ 4857c478bd9Sstevel@tonic-gate 4867c478bd9Sstevel@tonic-gate /* 4877c478bd9Sstevel@tonic-gate * Convenient selector definitions. 4887c478bd9Sstevel@tonic-gate */ 4897c478bd9Sstevel@tonic-gate #define KCS_SEL SEL_GDT(GDT_KCODE, SEL_KPL) 4907c478bd9Sstevel@tonic-gate #define KDS_SEL SEL_GDT(GDT_KDATA, SEL_KPL) 4917c478bd9Sstevel@tonic-gate #define UCS_SEL SEL_GDT(GDT_UCODE, SEL_UPL) 4927c478bd9Sstevel@tonic-gate #if defined(__amd64) 4937c478bd9Sstevel@tonic-gate #define TEMP_CS64_SEL SEL_GDT(TEMPGDT_KCODE64, SEL_KPL) 4947c478bd9Sstevel@tonic-gate #define U32CS_SEL SEL_GDT(GDT_U32CODE, SEL_UPL) 4957c478bd9Sstevel@tonic-gate #endif /* __amd64 */ 4967c478bd9Sstevel@tonic-gate #define UDS_SEL SEL_GDT(GDT_UDATA, SEL_UPL) 4977c478bd9Sstevel@tonic-gate #define ULDT_SEL SEL_GDT(GDT_LDT, SEL_KPL) 4987c478bd9Sstevel@tonic-gate #define KTSS_SEL SEL_GDT(GDT_KTSS, SEL_KPL) 4997c478bd9Sstevel@tonic-gate #define DFTSS_SEL SEL_GDT(GDT_DBFLT, SEL_KPL) 5007c478bd9Sstevel@tonic-gate #define KFS_SEL SEL_GDT(GDT_NULL, SEL_KPL) 5017c478bd9Sstevel@tonic-gate #define KGS_SEL SEL_GDT(GDT_GS, SEL_KPL) 5027c478bd9Sstevel@tonic-gate #define LWPFS_SEL SEL_GDT(GDT_LWPFS, SEL_UPL) 5037c478bd9Sstevel@tonic-gate #define LWPGS_SEL SEL_GDT(GDT_LWPGS, SEL_UPL) 5047c478bd9Sstevel@tonic-gate #if defined(__amd64) 5057c478bd9Sstevel@tonic-gate #define B64CODE_SEL SEL_GDT(GDT_B64CODE, SEL_KPL) 5067c478bd9Sstevel@tonic-gate #else 5077c478bd9Sstevel@tonic-gate #define BOOTCODE_SEL SEL_GDT(GDT_BOOTCODE, SEL_KPL) 5087c478bd9Sstevel@tonic-gate #define BOOTFLAT_SEL SEL_GDT(GDT_BOOTFLAT, SEL_KPL) 5097c478bd9Sstevel@tonic-gate #endif 5107c478bd9Sstevel@tonic-gate 5117c478bd9Sstevel@tonic-gate /* 5127c478bd9Sstevel@tonic-gate * Entries in default Local Descriptor Table (LDT) for every process. 5137c478bd9Sstevel@tonic-gate */ 5147c478bd9Sstevel@tonic-gate #define LDT_SYSCALL 0 /* call gate for libc.a (obsolete) */ 5157c478bd9Sstevel@tonic-gate #define LDT_SIGCALL 1 /* EOL me, call gate for static sigreturn */ 5167c478bd9Sstevel@tonic-gate #define LDT_RESVD1 2 /* old user %cs */ 5177c478bd9Sstevel@tonic-gate #define LDT_RESVD2 3 /* old user %ds */ 5187c478bd9Sstevel@tonic-gate #define LDT_ALTSYSCALL 4 /* alternate call gate for system calls */ 5197c478bd9Sstevel@tonic-gate #define LDT_ALTSIGCALL 5 /* EOL me, alternate call gate for sigreturn */ 5207c478bd9Sstevel@tonic-gate #define LDT_UDBASE 6 /* user descriptor base index */ 5217c478bd9Sstevel@tonic-gate #define MINNLDT 64 /* Current min solaris ldt size */ 5227c478bd9Sstevel@tonic-gate #define MAXNLDT 8192 /* max solaris ldt size */ 5237c478bd9Sstevel@tonic-gate 5247c478bd9Sstevel@tonic-gate #ifndef _ASM 5257c478bd9Sstevel@tonic-gate 5267c478bd9Sstevel@tonic-gate #pragma align 16(idt0) 5277c478bd9Sstevel@tonic-gate extern gate_desc_t idt0[NIDT]; 5287c478bd9Sstevel@tonic-gate extern desctbr_t idt0_default_reg; 5297c478bd9Sstevel@tonic-gate extern user_desc_t gdt0[NGDT]; 5300baeff3dSrab 5317c478bd9Sstevel@tonic-gate extern user_desc_t zero_udesc; 5320baeff3dSrab extern system_desc_t zero_sdesc; 5330baeff3dSrab 5347c478bd9Sstevel@tonic-gate #if defined(__amd64) 5357c478bd9Sstevel@tonic-gate extern user_desc_t zero_u32desc; 5367c478bd9Sstevel@tonic-gate #endif 5377c478bd9Sstevel@tonic-gate 5387c478bd9Sstevel@tonic-gate #pragma align 16(ktss0) 5397c478bd9Sstevel@tonic-gate extern struct tss ktss0; 5407c478bd9Sstevel@tonic-gate 5417c478bd9Sstevel@tonic-gate #if defined(__i386) 5427c478bd9Sstevel@tonic-gate extern struct tss dftss0; 5437c478bd9Sstevel@tonic-gate #endif /* __i386 */ 5447c478bd9Sstevel@tonic-gate 5457c478bd9Sstevel@tonic-gate extern void div0trap(), dbgtrap(), nmiint(), brktrap(), ovflotrap(); 5467c478bd9Sstevel@tonic-gate extern void boundstrap(), invoptrap(), ndptrap(), syserrtrap(); 5477c478bd9Sstevel@tonic-gate extern void invaltrap(), invtsstrap(), segnptrap(), stktrap(); 5487c478bd9Sstevel@tonic-gate extern void gptrap(), pftrap(), ndperr(); 5497c478bd9Sstevel@tonic-gate extern void overrun(), resvtrap(); 5507c478bd9Sstevel@tonic-gate extern void _start(), cmnint(); 5517c478bd9Sstevel@tonic-gate extern void achktrap(), mcetrap(); 5527c478bd9Sstevel@tonic-gate extern void xmtrap(); 5537c478bd9Sstevel@tonic-gate extern void fasttrap(); 554*f498645aSahl extern void dtrace_ret(); 5557c478bd9Sstevel@tonic-gate 5567c478bd9Sstevel@tonic-gate #if !defined(__amd64) 5577c478bd9Sstevel@tonic-gate extern void pentium_pftrap(); 5587c478bd9Sstevel@tonic-gate #endif 5597c478bd9Sstevel@tonic-gate 5607c478bd9Sstevel@tonic-gate #endif /* _ASM */ 5617c478bd9Sstevel@tonic-gate 5627c478bd9Sstevel@tonic-gate #ifdef __cplusplus 5637c478bd9Sstevel@tonic-gate } 5647c478bd9Sstevel@tonic-gate #endif 5657c478bd9Sstevel@tonic-gate 5667c478bd9Sstevel@tonic-gate #endif /* _SYS_SEGMENTS_H */ 567