1/*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * Copyright (c) 1992 NeXT Computer, Inc.
25 *
26 * Intel386 Family:	Task State Segment.
27 *
28 * HISTORY
29 *
30 * 29 March 1992 ? at NeXT
31 *	Created.
32 */
33
34#ifndef _ARCH_I386_TSS_H_
35#define _ARCH_I386_TSS_H_
36
37#include <architecture/i386/sel.h>
38
39/*
40 * Task State segment.
41 */
42
43typedef struct tss {
44    sel_t		oldtss;
45    unsigned int		:0;
46    unsigned int	esp0;
47    sel_t		ss0;
48    unsigned int		:0;
49    unsigned int	esp1;
50    sel_t		ss1;
51    unsigned int		:0;
52    unsigned int	esp2;
53    sel_t		ss2;
54    unsigned int		:0;
55    unsigned int	cr3;
56    unsigned int	eip;
57    unsigned int	eflags;
58    unsigned int	eax;
59    unsigned int	ecx;
60    unsigned int	edx;
61    unsigned int	ebx;
62    unsigned int	esp;
63    unsigned int	ebp;
64    unsigned int	esi;
65    unsigned int	edi;
66    sel_t		es;
67    unsigned int		:0;
68    sel_t		cs;
69    unsigned int		:0;
70    sel_t		ss;
71    unsigned int		:0;
72    sel_t		ds;
73    unsigned int		:0;
74    sel_t		fs;
75    unsigned int		:0;
76    sel_t		gs;
77    unsigned int		:0;
78    sel_t		ldt;
79    unsigned int		:0;
80    unsigned int	t	:1,
81    				:15,
82			io_bmap	:16;
83} tss_t;
84
85#define TSS_SIZE(n)	(sizeof (struct tss) + (n))
86
87/*
88 * Task State segment descriptor.
89 */
90
91typedef struct tss_desc {
92    unsigned short	limit00;
93    unsigned short	base00;
94    unsigned char	base16;
95    unsigned char	type	:5,
96#define DESC_TSS	0x09
97			dpl	:2,
98			present	:1;
99    unsigned char	limit16	:4,
100				:3,
101			granular:1;
102    unsigned char	base24;
103} tss_desc_t;
104
105/*
106 * Task gate descriptor.
107 */
108
109typedef struct task_gate {
110    unsigned short		:16;
111    sel_t		tss;
112    unsigned int		:8,
113    			type	:5,
114#define DESC_TASK_GATE	0x05
115			dpl	:2,
116			present	:1,
117				:0;
118} task_gate_t;
119
120#endif	/* _ARCH_I386_TSS_H_ */
121