pcb.h revision 25545
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 * 3. All advertising materials mentioning features or use of this software
174Srgrimes *    must display the following acknowledgement:
184Srgrimes *	This product includes software developed by the University of
194Srgrimes *	California, Berkeley and its contributors.
204Srgrimes * 4. Neither the name of the University nor the names of its contributors
214Srgrimes *    may be used to endorse or promote products derived from this software
224Srgrimes *    without specific prior written permission.
234Srgrimes *
244Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
254Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
264Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
274Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
284Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
294Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
304Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
314Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
324Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
334Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
344Srgrimes * SUCH DAMAGE.
354Srgrimes *
36557Srgrimes *	from: @(#)pcb.h	5.10 (Berkeley) 5/12/91
3725545Speter *	$Id: pcb.h,v 1.20 1997/04/26 11:45:39 peter Exp $
384Srgrimes */
394Srgrimes
40557Srgrimes#ifndef _I386_PCB_H_
41557Srgrimes#define _I386_PCB_H_
42557Srgrimes
434Srgrimes/*
444Srgrimes * Intel 386 process control block
454Srgrimes */
462056Swollman#include <machine/tss.h>
472056Swollman#include <machine/npx.h>
4825545Speter#if defined(KERNEL) && defined(SMP)
4925545Speter#include <machine/smp.h>	/* cpunumber() */
5025545Speter#endif
514Srgrimes
524Srgrimesstruct pcb {
5324690Speter	int	pcb_cr3;
5424690Speter	int	pcb_edi;
5524690Speter	int	pcb_esi;
5624690Speter	int	pcb_ebp;
5724690Speter	int	pcb_esp;
5824690Speter	int	pcb_ebx;
5924690Speter	int	pcb_eip;
60557Srgrimes	caddr_t	pcb_ldt;		/* per process (user) LDT */
61557Srgrimes	int	pcb_ldt_len;		/* number of LDT entries */
624Srgrimes	struct	save87	pcb_savefpu;	/* floating point state for 287/387 */
6310092Sdg	u_char	pcb_flags;
6410092Sdg#define	FP_SOFTFP	0x01	/* process using software fltng pnt emulator */
654Srgrimes	caddr_t	pcb_onfault;	/* copyin/out fault recovery */
6625164Speter	u_long	pcb_mpnest;
6725164Speter	u_long	__pcb_spare[7];	/* adjust to avoid core dump size changes */
6824690Speter#if 0	/* some day we may switch between procs that have their own i386tss */
6924690Speter	struct	i386tss pcb_tss;
7024690Speter	u_char	pcb_iomap[NPORT/sizeof(u_char)]; /* i/o port bitmap */
7124690Speter#endif
724Srgrimes};
734Srgrimes
741549Srgrimes/*
751549Srgrimes * The pcb is augmented with machine-dependent additional data for
761549Srgrimes * core dumps. For the i386: ???
771549Srgrimes */
781549Srgrimesstruct md_coredump {
791549Srgrimes};
801549Srgrimes
814Srgrimes#ifdef KERNEL
8225164Speter
8325164Speter#ifdef SMP
8425545Speterextern struct pcb *SMPcurpcb[];		/* our current running pcb */
8525164Speter#define curpcb (SMPcurpcb[cpunumber()])
8625164Speter#else /* !SMP */
87719Swollmanextern struct pcb *curpcb;		/* our current running pcb */
8825164Speter#endif /* SMP */
8925164Speter
9015501Sbdevoid	savectx __P((struct pcb*));
914Srgrimes#endif
92557Srgrimes
93557Srgrimes#endif /* _I386_PCB_H_ */
94