xref: /minix3/sys/arch/i386/include/pcb.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: pcb.h,v 1.54 2014/04/21 19:13:22 christos Exp $	*/
26c8f7fc3SBen Gras 
36c8f7fc3SBen Gras /*-
46c8f7fc3SBen Gras  * Copyright (c) 1998, 2009 The NetBSD Foundation, Inc.
56c8f7fc3SBen Gras  * All rights reserved.
66c8f7fc3SBen Gras  *
76c8f7fc3SBen Gras  * This code is derived from software contributed to The NetBSD Foundation
86c8f7fc3SBen Gras  * by Charles M. Hannum, and by Andrew Doran.
96c8f7fc3SBen Gras  *
106c8f7fc3SBen Gras  * Redistribution and use in source and binary forms, with or without
116c8f7fc3SBen Gras  * modification, are permitted provided that the following conditions
126c8f7fc3SBen Gras  * are met:
136c8f7fc3SBen Gras  * 1. Redistributions of source code must retain the above copyright
146c8f7fc3SBen Gras  *    notice, this list of conditions and the following disclaimer.
156c8f7fc3SBen Gras  * 2. Redistributions in binary form must reproduce the above copyright
166c8f7fc3SBen Gras  *    notice, this list of conditions and the following disclaimer in the
176c8f7fc3SBen Gras  *    documentation and/or other materials provided with the distribution.
186c8f7fc3SBen Gras  *
196c8f7fc3SBen Gras  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
206c8f7fc3SBen Gras  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
216c8f7fc3SBen Gras  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
226c8f7fc3SBen Gras  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
236c8f7fc3SBen Gras  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
246c8f7fc3SBen Gras  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
256c8f7fc3SBen Gras  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
266c8f7fc3SBen Gras  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
276c8f7fc3SBen Gras  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
286c8f7fc3SBen Gras  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
296c8f7fc3SBen Gras  * POSSIBILITY OF SUCH DAMAGE.
306c8f7fc3SBen Gras  */
316c8f7fc3SBen Gras 
326c8f7fc3SBen Gras /*-
336c8f7fc3SBen Gras  * Copyright (c) 1990 The Regents of the University of California.
346c8f7fc3SBen Gras  * All rights reserved.
356c8f7fc3SBen Gras  *
366c8f7fc3SBen Gras  * This code is derived from software contributed to Berkeley by
376c8f7fc3SBen Gras  * William Jolitz.
386c8f7fc3SBen Gras  *
396c8f7fc3SBen Gras  * Redistribution and use in source and binary forms, with or without
406c8f7fc3SBen Gras  * modification, are permitted provided that the following conditions
416c8f7fc3SBen Gras  * are met:
426c8f7fc3SBen Gras  * 1. Redistributions of source code must retain the above copyright
436c8f7fc3SBen Gras  *    notice, this list of conditions and the following disclaimer.
446c8f7fc3SBen Gras  * 2. Redistributions in binary form must reproduce the above copyright
456c8f7fc3SBen Gras  *    notice, this list of conditions and the following disclaimer in the
466c8f7fc3SBen Gras  *    documentation and/or other materials provided with the distribution.
476c8f7fc3SBen Gras  * 3. Neither the name of the University nor the names of its contributors
486c8f7fc3SBen Gras  *    may be used to endorse or promote products derived from this software
496c8f7fc3SBen Gras  *    without specific prior written permission.
506c8f7fc3SBen Gras  *
516c8f7fc3SBen Gras  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
526c8f7fc3SBen Gras  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
536c8f7fc3SBen Gras  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
546c8f7fc3SBen Gras  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
556c8f7fc3SBen Gras  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
566c8f7fc3SBen Gras  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
576c8f7fc3SBen Gras  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
586c8f7fc3SBen Gras  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
596c8f7fc3SBen Gras  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
606c8f7fc3SBen Gras  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
616c8f7fc3SBen Gras  * SUCH DAMAGE.
626c8f7fc3SBen Gras  *
636c8f7fc3SBen Gras  *	@(#)pcb.h	5.10 (Berkeley) 5/12/91
646c8f7fc3SBen Gras  */
656c8f7fc3SBen Gras 
666c8f7fc3SBen Gras /*
676c8f7fc3SBen Gras  * Intel 386 process control block
686c8f7fc3SBen Gras  */
696c8f7fc3SBen Gras 
706c8f7fc3SBen Gras #ifndef _I386_PCB_H_
716c8f7fc3SBen Gras #define _I386_PCB_H_
726c8f7fc3SBen Gras 
736c8f7fc3SBen Gras #if defined(_KERNEL_OPT)
746c8f7fc3SBen Gras #include "opt_multiprocessor.h"
756c8f7fc3SBen Gras #endif
766c8f7fc3SBen Gras 
776c8f7fc3SBen Gras #include <machine/segments.h>
78*0a6a1f1dSLionel Sambuc #include <x86/cpu_extended_state.h>
796c8f7fc3SBen Gras 
806c8f7fc3SBen Gras struct pcb {
816c8f7fc3SBen Gras 	int	pcb_esp0;		/* ring0 esp */
826c8f7fc3SBen Gras 	int	pcb_esp;		/* kernel esp */
836c8f7fc3SBen Gras 	int	pcb_ebp;		/* kernel ebp */
846c8f7fc3SBen Gras 	int	pcb_cr0;		/* saved image of CR0 */
856c8f7fc3SBen Gras 	int	pcb_cr2;		/* page fault address (CR2) */
866c8f7fc3SBen Gras 	int	pcb_cr3;		/* page directory pointer */
876c8f7fc3SBen Gras 	int	pcb_iopl;		/* i/o privilege level */
886c8f7fc3SBen Gras 
896c8f7fc3SBen Gras 	struct segment_descriptor pcb_fsd;	/* %fs descriptor */
906c8f7fc3SBen Gras 	struct segment_descriptor pcb_gsd; 	/* %gs descriptor */
916c8f7fc3SBen Gras 	void 	*pcb_onfault;		/* copyin/out fault recovery */
926c8f7fc3SBen Gras 	int	vm86_eflags;		/* virtual eflags for vm86 mode */
936c8f7fc3SBen Gras 	int	vm86_flagmask;		/* flag mask for vm86 mode */
946c8f7fc3SBen Gras 	void	*vm86_userp;		/* XXX performance hack */
956c8f7fc3SBen Gras 	char	*pcb_iomap;		/* I/O permission bitmap */
966c8f7fc3SBen Gras 
97*0a6a1f1dSLionel Sambuc 	int	not_used[15];
98*0a6a1f1dSLionel Sambuc 
99*0a6a1f1dSLionel Sambuc 	/* floating point state */
100*0a6a1f1dSLionel Sambuc 	struct cpu_info	*pcb_fpcpu;	/* cpu holding our fp state. */
101*0a6a1f1dSLionel Sambuc 	union savefpu	pcb_savefpu __aligned(64);
102*0a6a1f1dSLionel Sambuc 	/* **** DO NOT ADD ANYTHING HERE **** */
103*0a6a1f1dSLionel Sambuc 
1046c8f7fc3SBen Gras };
105*0a6a1f1dSLionel Sambuc #ifndef __lint__
106*0a6a1f1dSLionel Sambuc /* This doesn't really matter, but there is a lot of implied padding */
107*0a6a1f1dSLionel Sambuc __CTASSERT(sizeof(struct pcb) - sizeof (union savefpu) == 128);
108*0a6a1f1dSLionel Sambuc #endif
1096c8f7fc3SBen Gras 
1106c8f7fc3SBen Gras #endif /* _I386_PCB_H_ */
111