14Srgrimes/*-
24Srgrimes * Copyright (c) 1990 The Regents of the University of California.
34Srgrimes * All rights reserved.
44Srgrimes *
54Srgrimes * This code is derived from software contributed to Berkeley by
64Srgrimes * William Jolitz.
74Srgrimes *
84Srgrimes * Redistribution and use in source and binary forms, with or without
94Srgrimes * modification, are permitted provided that the following conditions
104Srgrimes * are met:
114Srgrimes * 1. Redistributions of source code must retain the above copyright
124Srgrimes *    notice, this list of conditions and the following disclaimer.
134Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
144Srgrimes *    notice, this list of conditions and the following disclaimer in the
154Srgrimes *    documentation and/or other materials provided with the distribution.
164Srgrimes * 4. Neither the name of the University nor the names of its contributors
174Srgrimes *    may be used to endorse or promote products derived from this software
184Srgrimes *    without specific prior written permission.
194Srgrimes *
204Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
214Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
224Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
234Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
244Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
254Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
264Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
274Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
284Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
294Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
304Srgrimes * SUCH DAMAGE.
314Srgrimes *
32557Srgrimes *	from: @(#)pcb.h	5.10 (Berkeley) 5/12/91
3350477Speter * $FreeBSD$
344Srgrimes */
354Srgrimes
36557Srgrimes#ifndef _I386_PCB_H_
37557Srgrimes#define _I386_PCB_H_
38557Srgrimes
394Srgrimes/*
404Srgrimes * Intel 386 process control block
414Srgrimes */
42145047Speter#ifndef _KERNEL
43145047Speter#include <machine/segments.h>
44145047Speter#endif
452056Swollman#include <machine/npx.h>
464Srgrimes
47294283Sjhb/*
48294283Sjhb * NB: The fields marked with (*) are used by kernel debuggers.  Their
49294283Sjhb * ABI should be preserved.
50294283Sjhb */
514Srgrimesstruct pcb {
52294283Sjhb	int	pcb_edi;	/* (*) */
53294283Sjhb	int	pcb_esi;	/* (*) */
54294283Sjhb	int	pcb_ebp;	/* (*) */
55294283Sjhb	int	pcb_esp;	/* (*) */
56294283Sjhb	int	pcb_ebx;	/* (*) */
57294283Sjhb	int	pcb_eip;	/* (*) */
58276084Sjhb	struct segment_descriptor pcb_fsd;
59276084Sjhb	struct segment_descriptor pcb_gsd;
60276084Sjhb	int	pcb_ds;
61276084Sjhb	int	pcb_es;
62276084Sjhb	int	pcb_fs;
63276084Sjhb	int	pcb_gs;
64276084Sjhb	int	pcb_ss;
65276084Sjhb	int	pcb_cr0;
66276084Sjhb	int	pcb_cr2;
67276084Sjhb	int	pcb_cr3;
68276084Sjhb	int	pcb_cr4;
6948691Sjlemon	int     pcb_dr0;
7048691Sjlemon	int     pcb_dr1;
7148691Sjlemon	int     pcb_dr2;
7248691Sjlemon	int     pcb_dr3;
7348691Sjlemon	int     pcb_dr6;
7448691Sjlemon	int     pcb_dr7;
7548691Sjlemon
76276084Sjhb	struct region_descriptor pcb_gdt;
77276084Sjhb	struct region_descriptor pcb_idt;
78276084Sjhb	uint16_t	pcb_ldt;
79276084Sjhb	uint16_t	pcb_tr;
80276084Sjhb
8189466Sbde	u_int	pcb_flags;
8248691Sjlemon#define	PCB_DBREGS	0x02	/* process using debug registers */
83103408Smini#define	PCB_NPXINITDONE	0x08	/* fpu state is initialized */
84106542Sdavidxu#define	PCB_VM86CALL	0x10	/* in vm86 call */
85208833Skib#define	PCB_NPXUSERINITDONE 0x20 /* user fpu state is initialized */
86208833Skib#define	PCB_KERNNPX	0x40	/* kernel uses npx */
87106542Sdavidxu
88276084Sjhb	uint16_t pcb_initial_npxcw;
89276084Sjhb
904Srgrimes	caddr_t	pcb_onfault;	/* copyin/out fault recovery */
9127993Sdyson	struct	pcb_ext	*pcb_ext;	/* optional pcb extension */
9293264Sdillon	int	pcb_psl;	/* process status long */
93145025Speter	u_long	pcb_vm86[2];	/* vm86bios scratch space */
94208833Skib	union	savefpu *pcb_save;
95235622Siwasaki
96276084Sjhb	uint32_t pcb_pad[10];
974Srgrimes};
984Srgrimes
99276084Sjhb/* Per-CPU state saved during suspend and resume. */
100271999Sjhbstruct susppcb {
101271999Sjhb	struct pcb	sp_pcb;
102276084Sjhb
103276084Sjhb	/* fpu context for suspend/resume */
104276084Sjhb	void		*sp_fpususpend;
105271999Sjhb};
106271999Sjhb
10755205Speter#ifdef _KERNEL
108131905Smarcelstruct trapframe;
109131905Smarcel
110131905Smarcelvoid	makectx(struct trapframe *, struct pcb *);
111236772Siwasakiint	savectx(struct pcb *) __returns_twice;
112237027Sjkimvoid	resumectx(struct pcb *) __fastcall;
1134Srgrimes#endif
114557Srgrimes
115557Srgrimes#endif /* _I386_PCB_H_ */
116