xref: /openbsd/sys/arch/i386/include/pcb.h (revision 7018d8c3)
1 /*	$OpenBSD: pcb.h,v 1.25 2022/02/21 14:26:19 jsg Exp $	*/
2 /*	$NetBSD: pcb.h,v 1.21 1996/01/08 13:51:42 mycroft Exp $	*/
3 
4 /*-
5  * Copyright (c) 1995 Charles M. Hannum.  All rights reserved.
6  * Copyright (c) 1990 The Regents of the University of California.
7  * All rights reserved.
8  *
9  * This code is derived from software contributed to Berkeley by
10  * William Jolitz.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  * 3. Neither the name of the University nor the names of its contributors
21  *    may be used to endorse or promote products derived from this software
22  *    without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34  * SUCH DAMAGE.
35  *
36  *	@(#)pcb.h	5.10 (Berkeley) 5/12/91
37  */
38 
39 /*
40  * Intel 386 process control block
41  */
42 
43 #ifndef _MACHINE_PCB_H_
44 #define _MACHINE_PCB_H_
45 
46 #include <sys/signal.h>
47 
48 #include <machine/segments.h>
49 #include <machine/npx.h>
50 #include <machine/sysarch.h>
51 
52 /*
53  * Please note that pcb_savefpu must be aligned to 16 bytes.
54  */
55 struct pcb {
56 	union	savefpu pcb_savefpu;	/* floating point state for FPU */
57 	int	pcb_cr3;
58 	int	pcb_esp;
59 	int	pcb_ebp;
60 	int	pcb_kstack;		/* kernel stack address */
61 	int	pcb_cr0;		/* saved image of CR0 */
62 	caddr_t	pcb_onfault;		/* copyin/out fault recovery */
63 	struct	segment_descriptor pcb_threadsegs[2];
64 					/* per-thread descriptors */
65 	int	vm86_eflags;		/* virtual eflags for vm86 mode */
66 	int	vm86_flagmask;		/* flag mask for vm86 mode */
67 	void	*vm86_userp;		/* XXX performance hack */
68 	struct  pmap *pcb_pmap;         /* back pointer to our pmap */
69 	struct	cpu_info *pcb_fpcpu;	/* cpu holding our fpu state */
70 	int	pcb_flags;
71 #define PCB_SAVECTX	0x00000001
72 };
73 
74 /* the indexes of the %fs/%gs segments in pcb_threadsegs */
75 #define	TSEG_FS		0
76 #define	TSEG_GS		1
77 
78 #endif /* _MACHINE_PCB_H_ */
79