17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * Copyright 2004 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_TSS_H 77c478bd9Sstevel@tonic-gate #define _SYS_TSS_H 87c478bd9Sstevel@tonic-gate 97c478bd9Sstevel@tonic-gate #ifdef __cplusplus 107c478bd9Sstevel@tonic-gate extern "C" { 117c478bd9Sstevel@tonic-gate #endif 127c478bd9Sstevel@tonic-gate 137c478bd9Sstevel@tonic-gate /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */ 147c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */ 157c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 167c478bd9Sstevel@tonic-gate 177c478bd9Sstevel@tonic-gate /* 187c478bd9Sstevel@tonic-gate * Copyright (c) 1990 The Regents of the University of California. 197c478bd9Sstevel@tonic-gate * All rights reserved. 207c478bd9Sstevel@tonic-gate * 217c478bd9Sstevel@tonic-gate * This code is derived from software contributed to Berkeley by 227c478bd9Sstevel@tonic-gate * William Jolitz. 237c478bd9Sstevel@tonic-gate * 247c478bd9Sstevel@tonic-gate * Redistribution and use in source and binary forms, with or without 257c478bd9Sstevel@tonic-gate * modification, are permitted provided that the following conditions 267c478bd9Sstevel@tonic-gate * are met: 277c478bd9Sstevel@tonic-gate * 1. Redistributions of source code must retain the above copyright 287c478bd9Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer. 297c478bd9Sstevel@tonic-gate * 2. Redistributions in binary form must reproduce the above copyright 307c478bd9Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer in the 317c478bd9Sstevel@tonic-gate * documentation and/or other materials provided with the distribution. 327c478bd9Sstevel@tonic-gate * 3. All advertising materials mentioning features or use of this software 337c478bd9Sstevel@tonic-gate * must display the following acknowledgement: 347c478bd9Sstevel@tonic-gate * This product includes software developed by the University of 357c478bd9Sstevel@tonic-gate * California, Berkeley and its contributors. 367c478bd9Sstevel@tonic-gate * 4. Neither the name of the University nor the names of its contributors 377c478bd9Sstevel@tonic-gate * may be used to endorse or promote products derived from this software 387c478bd9Sstevel@tonic-gate * without specific prior written permission. 397c478bd9Sstevel@tonic-gate * 407c478bd9Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 417c478bd9Sstevel@tonic-gate * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 427c478bd9Sstevel@tonic-gate * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 437c478bd9Sstevel@tonic-gate * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 447c478bd9Sstevel@tonic-gate * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 457c478bd9Sstevel@tonic-gate * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 467c478bd9Sstevel@tonic-gate * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 477c478bd9Sstevel@tonic-gate * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 487c478bd9Sstevel@tonic-gate * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 497c478bd9Sstevel@tonic-gate * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 507c478bd9Sstevel@tonic-gate * SUCH DAMAGE. 517c478bd9Sstevel@tonic-gate * 527c478bd9Sstevel@tonic-gate * from: @(#)tss.h 5.4 (Berkeley) 1/18/91 537c478bd9Sstevel@tonic-gate * $FreeBSD: src/sys/i386/include/tss.h,v 1.13 2002/09/23 05:04:05 peter Exp $ 547c478bd9Sstevel@tonic-gate */ 55*f16a0f4cSRobert Mustacchi /* 56*f16a0f4cSRobert Mustacchi * Copyright 2011 Joyent, Inc. All rights reserved. 57*f16a0f4cSRobert Mustacchi */ 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate /* 607c478bd9Sstevel@tonic-gate * Maximum I/O address that will be in TSS bitmap 617c478bd9Sstevel@tonic-gate */ 627c478bd9Sstevel@tonic-gate #define MAXTSSIOADDR 0x3ff /* XXX - needs to support 64K I/O space */ 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate #ifndef _ASM 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate /* 67*f16a0f4cSRobert Mustacchi * Task state segment (tss). Holds the processor state assoicated with a task. 68*f16a0f4cSRobert Mustacchi * 69*f16a0f4cSRobert Mustacchi * Historically, this header only exposed a struct tss that was relevant to the 70*f16a0f4cSRobert Mustacchi * specific Intel architecture that we were deploying on. However, the tss 71*f16a0f4cSRobert Mustacchi * structures are defined by the Intel Architecture and other consumers would 72*f16a0f4cSRobert Mustacchi * like to use them. Rather than requiring them to duplicate all of this 73*f16a0f4cSRobert Mustacchi * information, we instead expose each version under different names but in a 74*f16a0f4cSRobert Mustacchi * backwards compatible manner. 757c478bd9Sstevel@tonic-gate */ 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate #pragma pack(4) 78*f16a0f4cSRobert Mustacchi struct tss64 { 797c478bd9Sstevel@tonic-gate uint32_t tss_rsvd0; /* reserved, ignored */ 807c478bd9Sstevel@tonic-gate uint64_t tss_rsp0; /* stack pointer CPL = 0 */ 817c478bd9Sstevel@tonic-gate uint64_t tss_rsp1; /* stack pointer CPL = 1 */ 827c478bd9Sstevel@tonic-gate uint64_t tss_rsp2; /* stack pointer CPL = 2 */ 837c478bd9Sstevel@tonic-gate uint64_t tss_rsvd1; /* reserved, ignored */ 847c478bd9Sstevel@tonic-gate uint64_t tss_ist1; /* Interrupt stack table 1 */ 857c478bd9Sstevel@tonic-gate uint64_t tss_ist2; /* Interrupt stack table 2 */ 867c478bd9Sstevel@tonic-gate uint64_t tss_ist3; /* Interrupt stack table 3 */ 877c478bd9Sstevel@tonic-gate uint64_t tss_ist4; /* Interrupt stack table 4 */ 887c478bd9Sstevel@tonic-gate uint64_t tss_ist5; /* Interrupt stack table 5 */ 897c478bd9Sstevel@tonic-gate uint64_t tss_ist6; /* Interrupt stack table 6 */ 907c478bd9Sstevel@tonic-gate uint64_t tss_ist7; /* Interrupt stack table 7 */ 917c478bd9Sstevel@tonic-gate uint64_t tss_rsvd2; /* reserved, ignored */ 927c478bd9Sstevel@tonic-gate uint16_t tss_rsvd3; /* reserved, ignored */ 937c478bd9Sstevel@tonic-gate uint16_t tss_bitmapbase; /* io permission bitmap base address */ 947c478bd9Sstevel@tonic-gate }; 957c478bd9Sstevel@tonic-gate #pragma pack() 967c478bd9Sstevel@tonic-gate 97*f16a0f4cSRobert Mustacchi struct tss32 { 987c478bd9Sstevel@tonic-gate uint16_t tss_link; /* 16-bit prior TSS selector */ 997c478bd9Sstevel@tonic-gate uint16_t tss_rsvd0; /* reserved, ignored */ 1007c478bd9Sstevel@tonic-gate uint32_t tss_esp0; 1017c478bd9Sstevel@tonic-gate uint16_t tss_ss0; 1027c478bd9Sstevel@tonic-gate uint16_t tss_rsvd1; /* reserved, ignored */ 1037c478bd9Sstevel@tonic-gate uint32_t tss_esp1; 1047c478bd9Sstevel@tonic-gate uint16_t tss_ss1; 1057c478bd9Sstevel@tonic-gate uint16_t tss_rsvd2; /* reserved, ignored */ 1067c478bd9Sstevel@tonic-gate uint32_t tss_esp2; 1077c478bd9Sstevel@tonic-gate uint16_t tss_ss2; 1087c478bd9Sstevel@tonic-gate uint16_t tss_rsvd3; /* reserved, ignored */ 1097c478bd9Sstevel@tonic-gate uint32_t tss_cr3; 1107c478bd9Sstevel@tonic-gate uint32_t tss_eip; 1117c478bd9Sstevel@tonic-gate uint32_t tss_eflags; 1127c478bd9Sstevel@tonic-gate uint32_t tss_eax; 1137c478bd9Sstevel@tonic-gate uint32_t tss_ecx; 1147c478bd9Sstevel@tonic-gate uint32_t tss_edx; 1157c478bd9Sstevel@tonic-gate uint32_t tss_ebx; 1167c478bd9Sstevel@tonic-gate uint32_t tss_esp; 1177c478bd9Sstevel@tonic-gate uint32_t tss_ebp; 1187c478bd9Sstevel@tonic-gate uint32_t tss_esi; 1197c478bd9Sstevel@tonic-gate uint32_t tss_edi; 1207c478bd9Sstevel@tonic-gate uint16_t tss_es; 1217c478bd9Sstevel@tonic-gate uint16_t tss_rsvd4; /* reserved, ignored */ 1227c478bd9Sstevel@tonic-gate uint16_t tss_cs; 1237c478bd9Sstevel@tonic-gate uint16_t tss_rsvd5; /* reserved, ignored */ 1247c478bd9Sstevel@tonic-gate uint16_t tss_ss; 1257c478bd9Sstevel@tonic-gate uint16_t tss_rsvd6; /* reserved, ignored */ 1267c478bd9Sstevel@tonic-gate uint16_t tss_ds; 1277c478bd9Sstevel@tonic-gate uint16_t tss_rsvd7; /* reserved, ignored */ 1287c478bd9Sstevel@tonic-gate uint16_t tss_fs; 1297c478bd9Sstevel@tonic-gate uint16_t tss_rsvd8; /* reserved, ignored */ 1307c478bd9Sstevel@tonic-gate uint16_t tss_gs; 1317c478bd9Sstevel@tonic-gate uint16_t tss_rsvd9; /* reserved, ignored */ 1327c478bd9Sstevel@tonic-gate uint16_t tss_ldt; 1337c478bd9Sstevel@tonic-gate uint16_t tss_rsvd10; /* reserved, ignored */ 1347c478bd9Sstevel@tonic-gate uint16_t tss_rsvd11; /* reserved, ignored */ 1357c478bd9Sstevel@tonic-gate uint16_t tss_bitmapbase; /* io permission bitmap base address */ 1367c478bd9Sstevel@tonic-gate }; 1377c478bd9Sstevel@tonic-gate 138*f16a0f4cSRobert Mustacchi struct tss16 { 139*f16a0f4cSRobert Mustacchi uint16_t tss_link; 140*f16a0f4cSRobert Mustacchi uint16_t tss_sp0; 141*f16a0f4cSRobert Mustacchi uint16_t tss_ss0; 142*f16a0f4cSRobert Mustacchi uint16_t tss_sp1; 143*f16a0f4cSRobert Mustacchi uint16_t tss_ss1; 144*f16a0f4cSRobert Mustacchi uint16_t tss_sp2; 145*f16a0f4cSRobert Mustacchi uint16_t tss_ss2; 146*f16a0f4cSRobert Mustacchi uint16_t tss_ip; 147*f16a0f4cSRobert Mustacchi uint16_t tss_flag; 148*f16a0f4cSRobert Mustacchi uint16_t tss_ax; 149*f16a0f4cSRobert Mustacchi uint16_t tss_cx; 150*f16a0f4cSRobert Mustacchi uint16_t tss_dx; 151*f16a0f4cSRobert Mustacchi uint16_t tss_bx; 152*f16a0f4cSRobert Mustacchi uint16_t tss_sp; 153*f16a0f4cSRobert Mustacchi uint16_t tss_bp; 154*f16a0f4cSRobert Mustacchi uint16_t tss_si; 155*f16a0f4cSRobert Mustacchi uint16_t tss_di; 156*f16a0f4cSRobert Mustacchi uint16_t tss_es; 157*f16a0f4cSRobert Mustacchi uint16_t tss_cs; 158*f16a0f4cSRobert Mustacchi uint16_t tss_ss; 159*f16a0f4cSRobert Mustacchi uint16_t tss_ds; 160*f16a0f4cSRobert Mustacchi uint16_t tss_ldt; 161*f16a0f4cSRobert Mustacchi }; 162*f16a0f4cSRobert Mustacchi 163*f16a0f4cSRobert Mustacchi #if defined(__amd64) 164*f16a0f4cSRobert Mustacchi 165*f16a0f4cSRobert Mustacchi typedef struct tss64 tss_t; 166*f16a0f4cSRobert Mustacchi 167*f16a0f4cSRobert Mustacchi #elif defined(__i386) 168*f16a0f4cSRobert Mustacchi 169*f16a0f4cSRobert Mustacchi typedef struct tss32 tss_t; 170*f16a0f4cSRobert Mustacchi 1717c478bd9Sstevel@tonic-gate #endif /* __i386 */ 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate #endif /* !_ASM */ 1747c478bd9Sstevel@tonic-gate 1757c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1767c478bd9Sstevel@tonic-gate } 1777c478bd9Sstevel@tonic-gate #endif 1787c478bd9Sstevel@tonic-gate 1797c478bd9Sstevel@tonic-gate #endif /* _SYS_TSS_H */ 180