xref: /netbsd-src/sys/arch/amd64/include/tss.h (revision d568df3e3f5b965ae6c75203a8ae7f21d6d2dae4)
1*d568df3eSkamil /*	$NetBSD: tss.h,v 1.8 2018/07/07 21:35:16 kamil Exp $	*/
281918bf8Sfvdl 
381918bf8Sfvdl /*
481918bf8Sfvdl  * Copyright (c) 2001 Wasabi Systems, Inc.
581918bf8Sfvdl  * All rights reserved.
681918bf8Sfvdl  *
781918bf8Sfvdl  * Written by Frank van der Linden for Wasabi Systems, Inc.
881918bf8Sfvdl  *
981918bf8Sfvdl  * Redistribution and use in source and binary forms, with or without
1081918bf8Sfvdl  * modification, are permitted provided that the following conditions
1181918bf8Sfvdl  * are met:
1281918bf8Sfvdl  * 1. Redistributions of source code must retain the above copyright
1381918bf8Sfvdl  *    notice, this list of conditions and the following disclaimer.
1481918bf8Sfvdl  * 2. Redistributions in binary form must reproduce the above copyright
1581918bf8Sfvdl  *    notice, this list of conditions and the following disclaimer in the
1681918bf8Sfvdl  *    documentation and/or other materials provided with the distribution.
1781918bf8Sfvdl  * 3. All advertising materials mentioning features or use of this software
1881918bf8Sfvdl  *    must display the following acknowledgement:
1981918bf8Sfvdl  *      This product includes software developed for the NetBSD Project by
2081918bf8Sfvdl  *      Wasabi Systems, Inc.
2181918bf8Sfvdl  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
2281918bf8Sfvdl  *    or promote products derived from this software without specific prior
2381918bf8Sfvdl  *    written permission.
2481918bf8Sfvdl  *
2581918bf8Sfvdl  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
2681918bf8Sfvdl  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2781918bf8Sfvdl  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2881918bf8Sfvdl  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
2981918bf8Sfvdl  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
3081918bf8Sfvdl  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
3181918bf8Sfvdl  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
3281918bf8Sfvdl  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
3381918bf8Sfvdl  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3481918bf8Sfvdl  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3581918bf8Sfvdl  * POSSIBILITY OF SUCH DAMAGE.
3681918bf8Sfvdl  */
3781918bf8Sfvdl 
3881918bf8Sfvdl #ifndef _AMD64_TSS_H_
3981918bf8Sfvdl #define _AMD64_TSS_H_
4081918bf8Sfvdl 
41433b5ddeSmrg #ifdef __x86_64__
42433b5ddeSmrg 
4381918bf8Sfvdl /*
4481918bf8Sfvdl  * TSS structure. Since TSS hw switching is not supported in long
4581918bf8Sfvdl  * mode, this is mainly there for the I/O permission map in
4681918bf8Sfvdl  * normal processes.
4781918bf8Sfvdl  */
4881918bf8Sfvdl 
4981918bf8Sfvdl struct x86_64_tss {
50a0fc30e9Scegger 	uint32_t	tss_reserved1;
51a0fc30e9Scegger 	uint64_t	tss_rsp0;
52a0fc30e9Scegger 	uint64_t	tss_rsp1;
539eebcc09Smaxv 	uint64_t	tss_rsp2;
54a0fc30e9Scegger 	uint32_t	tss_reserved2;
55a0fc30e9Scegger 	uint32_t	tss_reserved3;
56a0fc30e9Scegger 	uint64_t	tss_ist[7];
57a0fc30e9Scegger 	uint32_t	tss_reserved4;
58a0fc30e9Scegger 	uint32_t	tss_reserved5;
59a0fc30e9Scegger 	uint32_t	tss_iobase;
60b6a2ef75Sperry } __packed;
6181918bf8Sfvdl 
6235f1be57Syamt /*
6335f1be57Syamt  * I/O bitmap offset beyond TSS's segment limit means no bitmaps.
6435f1be57Syamt  * (i.e. any I/O attempt generates an exception.)
6535f1be57Syamt  */
66*d568df3eSkamil #define	IOMAP_INVALOFF	0xffffu
6735f1be57Syamt 
689baa91b0Smaxv /*
699baa91b0Smaxv  * If we have an I/O bitmap, there is only one valid offset.
709baa91b0Smaxv  */
719baa91b0Smaxv #define	IOMAP_VALIDOFF	sizeof(struct x86_64_tss)
729baa91b0Smaxv 
73433b5ddeSmrg #else	/*	__x86_64__	*/
74433b5ddeSmrg 
75433b5ddeSmrg #include <i386/tss.h>
76433b5ddeSmrg 
77433b5ddeSmrg #endif	/*	__x86_64__	*/
78433b5ddeSmrg 
7981918bf8Sfvdl #endif /* _AMD64_TSS_H_ */
80