1 /* 2 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 3 * Use is subject to license terms. 4 */ 5 6 #ifndef _SYS_TSS_H 7 #define _SYS_TSS_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */ 14 /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */ 15 /* All Rights Reserved */ 16 17 /* 18 * Copyright (c) 1990 The Regents of the University of California. 19 * All rights reserved. 20 * 21 * This code is derived from software contributed to Berkeley by 22 * William Jolitz. 23 * 24 * Redistribution and use in source and binary forms, with or without 25 * modification, are permitted provided that the following conditions 26 * are met: 27 * 1. Redistributions of source code must retain the above copyright 28 * notice, this list of conditions and the following disclaimer. 29 * 2. Redistributions in binary form must reproduce the above copyright 30 * notice, this list of conditions and the following disclaimer in the 31 * documentation and/or other materials provided with the distribution. 32 * 3. All advertising materials mentioning features or use of this software 33 * must display the following acknowledgement: 34 * This product includes software developed by the University of 35 * California, Berkeley and its contributors. 36 * 4. Neither the name of the University nor the names of its contributors 37 * may be used to endorse or promote products derived from this software 38 * without specific prior written permission. 39 * 40 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 41 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 43 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 44 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 45 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 46 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 48 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 49 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 50 * SUCH DAMAGE. 51 * 52 * from: @(#)tss.h 5.4 (Berkeley) 1/18/91 53 * $FreeBSD: src/sys/i386/include/tss.h,v 1.13 2002/09/23 05:04:05 peter Exp $ 54 */ 55 /* 56 * Copyright 2011 Joyent, Inc. All rights reserved. 57 */ 58 59 /* 60 * Maximum I/O address that will be in TSS bitmap 61 */ 62 #define MAXTSSIOADDR 0x3ff /* XXX - needs to support 64K I/O space */ 63 64 #ifndef _ASM 65 66 /* 67 * Task state segment (tss). Holds the processor state assoicated with a task. 68 * 69 * Historically, this header only exposed a struct tss that was relevant to the 70 * specific Intel architecture that we were deploying on. However, the tss 71 * structures are defined by the Intel Architecture and other consumers would 72 * like to use them. Rather than requiring them to duplicate all of this 73 * information, we instead expose each version under different names but in a 74 * backwards compatible manner. 75 */ 76 77 #pragma pack(4) 78 struct tss64 { 79 uint32_t tss_rsvd0; /* reserved, ignored */ 80 uint64_t tss_rsp0; /* stack pointer CPL = 0 */ 81 uint64_t tss_rsp1; /* stack pointer CPL = 1 */ 82 uint64_t tss_rsp2; /* stack pointer CPL = 2 */ 83 uint64_t tss_rsvd1; /* reserved, ignored */ 84 uint64_t tss_ist1; /* Interrupt stack table 1 */ 85 uint64_t tss_ist2; /* Interrupt stack table 2 */ 86 uint64_t tss_ist3; /* Interrupt stack table 3 */ 87 uint64_t tss_ist4; /* Interrupt stack table 4 */ 88 uint64_t tss_ist5; /* Interrupt stack table 5 */ 89 uint64_t tss_ist6; /* Interrupt stack table 6 */ 90 uint64_t tss_ist7; /* Interrupt stack table 7 */ 91 uint64_t tss_rsvd2; /* reserved, ignored */ 92 uint16_t tss_rsvd3; /* reserved, ignored */ 93 uint16_t tss_bitmapbase; /* io permission bitmap base address */ 94 }; 95 #pragma pack() 96 97 struct tss32 { 98 uint16_t tss_link; /* 16-bit prior TSS selector */ 99 uint16_t tss_rsvd0; /* reserved, ignored */ 100 uint32_t tss_esp0; 101 uint16_t tss_ss0; 102 uint16_t tss_rsvd1; /* reserved, ignored */ 103 uint32_t tss_esp1; 104 uint16_t tss_ss1; 105 uint16_t tss_rsvd2; /* reserved, ignored */ 106 uint32_t tss_esp2; 107 uint16_t tss_ss2; 108 uint16_t tss_rsvd3; /* reserved, ignored */ 109 uint32_t tss_cr3; 110 uint32_t tss_eip; 111 uint32_t tss_eflags; 112 uint32_t tss_eax; 113 uint32_t tss_ecx; 114 uint32_t tss_edx; 115 uint32_t tss_ebx; 116 uint32_t tss_esp; 117 uint32_t tss_ebp; 118 uint32_t tss_esi; 119 uint32_t tss_edi; 120 uint16_t tss_es; 121 uint16_t tss_rsvd4; /* reserved, ignored */ 122 uint16_t tss_cs; 123 uint16_t tss_rsvd5; /* reserved, ignored */ 124 uint16_t tss_ss; 125 uint16_t tss_rsvd6; /* reserved, ignored */ 126 uint16_t tss_ds; 127 uint16_t tss_rsvd7; /* reserved, ignored */ 128 uint16_t tss_fs; 129 uint16_t tss_rsvd8; /* reserved, ignored */ 130 uint16_t tss_gs; 131 uint16_t tss_rsvd9; /* reserved, ignored */ 132 uint16_t tss_ldt; 133 uint16_t tss_rsvd10; /* reserved, ignored */ 134 uint16_t tss_rsvd11; /* reserved, ignored */ 135 uint16_t tss_bitmapbase; /* io permission bitmap base address */ 136 }; 137 138 struct tss16 { 139 uint16_t tss_link; 140 uint16_t tss_sp0; 141 uint16_t tss_ss0; 142 uint16_t tss_sp1; 143 uint16_t tss_ss1; 144 uint16_t tss_sp2; 145 uint16_t tss_ss2; 146 uint16_t tss_ip; 147 uint16_t tss_flag; 148 uint16_t tss_ax; 149 uint16_t tss_cx; 150 uint16_t tss_dx; 151 uint16_t tss_bx; 152 uint16_t tss_sp; 153 uint16_t tss_bp; 154 uint16_t tss_si; 155 uint16_t tss_di; 156 uint16_t tss_es; 157 uint16_t tss_cs; 158 uint16_t tss_ss; 159 uint16_t tss_ds; 160 uint16_t tss_ldt; 161 }; 162 163 #if defined(__amd64) 164 165 typedef struct tss64 tss_t; 166 167 #elif defined(__i386) 168 169 typedef struct tss32 tss_t; 170 171 #endif /* __i386 */ 172 173 #endif /* !_ASM */ 174 175 #ifdef __cplusplus 176 } 177 #endif 178 179 #endif /* _SYS_TSS_H */ 180