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
474Srgrimesstruct pcb {
48235622Siwasaki	int	pcb_cr0;
49235622Siwasaki	int	pcb_cr2;
5024690Speter	int	pcb_cr3;
51235622Siwasaki	int	pcb_cr4;
5224690Speter	int	pcb_edi;
5324690Speter	int	pcb_esi;
5424690Speter	int	pcb_ebp;
5524690Speter	int	pcb_esp;
5624690Speter	int	pcb_ebx;
5724690Speter	int	pcb_eip;
5848691Sjlemon
5948691Sjlemon	int     pcb_dr0;
6048691Sjlemon	int     pcb_dr1;
6148691Sjlemon	int     pcb_dr2;
6248691Sjlemon	int     pcb_dr3;
6348691Sjlemon	int     pcb_dr6;
6448691Sjlemon	int     pcb_dr7;
6548691Sjlemon
66208833Skib	union	savefpu	pcb_user_save;
67189423Sjhb	uint16_t pcb_initial_npxcw;
6889466Sbde	u_int	pcb_flags;
6910092Sdg#define	FP_SOFTFP	0x01	/* process using software fltng pnt emulator */
7048691Sjlemon#define	PCB_DBREGS	0x02	/* process using debug registers */
71103408Smini#define	PCB_NPXINITDONE	0x08	/* fpu state is initialized */
72106542Sdavidxu#define	PCB_VM86CALL	0x10	/* in vm86 call */
73208833Skib#define	PCB_NPXUSERINITDONE 0x20 /* user fpu state is initialized */
74208833Skib#define	PCB_KERNNPX	0x40	/* kernel uses npx */
75106542Sdavidxu
764Srgrimes	caddr_t	pcb_onfault;	/* copyin/out fault recovery */
77235622Siwasaki	int	pcb_ds;
78235622Siwasaki	int	pcb_es;
79235622Siwasaki	int	pcb_fs;
8026494Sbde	int	pcb_gs;
81235622Siwasaki	int	pcb_ss;
82145034Speter	struct segment_descriptor pcb_fsd;
83145034Speter	struct segment_descriptor pcb_gsd;
8427993Sdyson	struct	pcb_ext	*pcb_ext;	/* optional pcb extension */
8593264Sdillon	int	pcb_psl;	/* process status long */
86145025Speter	u_long	pcb_vm86[2];	/* vm86bios scratch space */
87208833Skib	union	savefpu *pcb_save;
88235622Siwasaki
89235622Siwasaki	struct region_descriptor pcb_gdt;
90235622Siwasaki	struct region_descriptor pcb_idt;
91235622Siwasaki	uint16_t	pcb_ldt;
92235622Siwasaki	uint16_t	pcb_tr;
934Srgrimes};
944Srgrimes
95271999Sjhbstruct susppcb {
96271999Sjhb	struct pcb	sp_pcb;
97271999Sjhb	union savefpu	sp_fpususpend;
98271999Sjhb};
99271999Sjhb
10055205Speter#ifdef _KERNEL
101131905Smarcelstruct trapframe;
102131905Smarcel
103131905Smarcelvoid	makectx(struct trapframe *, struct pcb *);
104236772Siwasakiint	savectx(struct pcb *) __returns_twice;
105237027Sjkimvoid	resumectx(struct pcb *) __fastcall;
1064Srgrimes#endif
107557Srgrimes
108557Srgrimes#endif /* _I386_PCB_H_ */
109