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