/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 1990 The Regents of the University of California.4* All rights reserved.5*6* This code is derived from software contributed to Berkeley by7* William Jolitz.8*9* Redistribution and use in source and binary forms, with or without10* modification, are permitted provided that the following conditions11* are met:12* 1. Redistributions of source code must retain the above copyright13* notice, this list of conditions and the following disclaimer.14* 2. Redistributions in binary form must reproduce the above copyright15* notice, this list of conditions and the following disclaimer in the16* documentation and/or other materials provided with the distribution.17* 3. Neither the name of the University nor the names of its contributors18* may be used to endorse or promote products derived from this software19* without specific prior written permission.20*21* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND22* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE23* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE24* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE25* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL26* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS27* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)28* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT29* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY30* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF31* SUCH DAMAGE.32*/3334#ifndef _I386_PCB_H_35#define _I386_PCB_H_3637/*38* Intel 386 process control block39*/40#ifndef _KERNEL41#include <machine/segments.h>42#endif43#include <machine/npx.h>4445/*46* NB: The fields marked with (*) are used by kernel debuggers. Their47* ABI should be preserved.48*/49struct pcb {50int pcb_edi; /* (*) */51int pcb_esi; /* (*) */52int pcb_ebp; /* (*) */53int pcb_esp; /* (*) */54int pcb_ebx; /* (*) */55int pcb_eip; /* (*) */56struct segment_descriptor pcb_fsd;57struct segment_descriptor pcb_gsd;58int pcb_ds;59int pcb_es;60int pcb_fs;61int pcb_gs;62int pcb_ss;63int pcb_cr0;64int pcb_cr2;65int pcb_cr3;66int pcb_cr4;67int pcb_dr0;68int pcb_dr1;69int pcb_dr2;70int pcb_dr3;71int pcb_dr6;72int pcb_dr7;7374struct region_descriptor pcb_gdt;75struct region_descriptor pcb_idt;76uint16_t pcb_ldt;77uint16_t pcb_tr;7879u_int pcb_flags;80#define PCB_DBREGS 0x02 /* process using debug registers */81#define PCB_KERNNPX_THR 0x04 /* fpu_kern_thread() */82#define PCB_NPXINITDONE 0x08 /* fpu state is initialized */83#define PCB_VM86CALL 0x10 /* in vm86 call */84#define PCB_NPXUSERINITDONE 0x20 /* user fpu state is initialized */85#define PCB_KERNNPX 0x40 /* kernel uses npx */86#define PCB_NPXNOSAVE 0x80 /* no save area for current FPU ctx */8788uint16_t pcb_initial_npxcw;8990caddr_t pcb_onfault; /* copyin/out fault recovery */91struct pcb_ext *pcb_ext; /* optional pcb extension */92int pcb_waspsl; /* unused padding for ABI and API compat */93u_long pcb_vm86[2]; /* vm86bios scratch space */94union savefpu *pcb_save;9596uint32_t pcb_pad[10];97};9899/* Per-CPU state saved during suspend and resume. */100struct susppcb {101struct pcb sp_pcb;102103/* fpu context for suspend/resume */104void *sp_fpususpend;105};106107#ifdef _KERNEL108struct trapframe;109110void makectx(struct trapframe *, struct pcb *);111int savectx(struct pcb *) __returns_twice;112void resumectx(struct pcb *) __fastcall;113#endif114115#endif /* _I386_PCB_H_ */116117118