15b81b6b3SRodney W. Grimes /*- 251369649SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 351369649SPedro F. Giffuni * 45b81b6b3SRodney W. Grimes * Copyright (c) 1990 The Regents of the University of California. 55b81b6b3SRodney W. Grimes * All rights reserved. 65b81b6b3SRodney W. Grimes * 75b81b6b3SRodney W. Grimes * This code is derived from software contributed to Berkeley by 85b81b6b3SRodney W. Grimes * William Jolitz. 95b81b6b3SRodney W. Grimes * 105b81b6b3SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 115b81b6b3SRodney W. Grimes * modification, are permitted provided that the following conditions 125b81b6b3SRodney W. Grimes * are met: 135b81b6b3SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 145b81b6b3SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 155b81b6b3SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 165b81b6b3SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 175b81b6b3SRodney W. Grimes * documentation and/or other materials provided with the distribution. 18fbbd9655SWarner Losh * 3. Neither the name of the University nor the names of its contributors 195b81b6b3SRodney W. Grimes * may be used to endorse or promote products derived from this software 205b81b6b3SRodney W. Grimes * without specific prior written permission. 215b81b6b3SRodney W. Grimes * 225b81b6b3SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 235b81b6b3SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 245b81b6b3SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 255b81b6b3SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 265b81b6b3SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 275b81b6b3SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 285b81b6b3SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 295b81b6b3SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 305b81b6b3SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 315b81b6b3SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 325b81b6b3SRodney W. Grimes * SUCH DAMAGE. 335b81b6b3SRodney W. Grimes */ 345b81b6b3SRodney W. Grimes 3509f07fb0SRodney W. Grimes #ifndef _I386_PCB_H_ 3609f07fb0SRodney W. Grimes #define _I386_PCB_H_ 3709f07fb0SRodney W. Grimes 385b81b6b3SRodney W. Grimes /* 395b81b6b3SRodney W. Grimes * Intel 386 process control block 405b81b6b3SRodney W. Grimes */ 41d1734badSPeter Wemm #ifndef _KERNEL 42d1734badSPeter Wemm #include <machine/segments.h> 43d1734badSPeter Wemm #endif 44f540b106SGarrett Wollman #include <machine/npx.h> 455b81b6b3SRodney W. Grimes 46645743eaSJohn Baldwin /* 47645743eaSJohn Baldwin * NB: The fields marked with (*) are used by kernel debuggers. Their 48645743eaSJohn Baldwin * ABI should be preserved. 49645743eaSJohn Baldwin */ 505b81b6b3SRodney W. Grimes struct pcb { 51645743eaSJohn Baldwin int pcb_edi; /* (*) */ 52645743eaSJohn Baldwin int pcb_esi; /* (*) */ 53645743eaSJohn Baldwin int pcb_ebp; /* (*) */ 54645743eaSJohn Baldwin int pcb_esp; /* (*) */ 55645743eaSJohn Baldwin int pcb_ebx; /* (*) */ 56645743eaSJohn Baldwin int pcb_eip; /* (*) */ 57824fc460SJohn Baldwin struct segment_descriptor pcb_fsd; 58824fc460SJohn Baldwin struct segment_descriptor pcb_gsd; 59824fc460SJohn Baldwin int pcb_ds; 60824fc460SJohn Baldwin int pcb_es; 61824fc460SJohn Baldwin int pcb_fs; 62824fc460SJohn Baldwin int pcb_gs; 63824fc460SJohn Baldwin int pcb_ss; 64824fc460SJohn Baldwin int pcb_cr0; 65824fc460SJohn Baldwin int pcb_cr2; 66824fc460SJohn Baldwin int pcb_cr3; 67824fc460SJohn Baldwin int pcb_cr4; 68ab001a72SJonathan Lemon int pcb_dr0; 69ab001a72SJonathan Lemon int pcb_dr1; 70ab001a72SJonathan Lemon int pcb_dr2; 71ab001a72SJonathan Lemon int pcb_dr3; 72ab001a72SJonathan Lemon int pcb_dr6; 73ab001a72SJonathan Lemon int pcb_dr7; 74ab001a72SJonathan Lemon 75824fc460SJohn Baldwin struct region_descriptor pcb_gdt; 76824fc460SJohn Baldwin struct region_descriptor pcb_idt; 77824fc460SJohn Baldwin uint16_t pcb_ldt; 78824fc460SJohn Baldwin uint16_t pcb_tr; 79824fc460SJohn Baldwin 80e744f309SBruce Evans u_int pcb_flags; 81ab001a72SJonathan Lemon #define PCB_DBREGS 0x02 /* process using debug registers */ 82e4062350SKonstantin Belousov #define PCB_KERNNPX_THR 0x04 /* fpu_kern_thread() */ 839ba15479SJonathan Mini #define PCB_NPXINITDONE 0x08 /* fpu state is initialized */ 848c132e9fSDavid Xu #define PCB_VM86CALL 0x10 /* in vm86 call */ 856cf9a08dSKonstantin Belousov #define PCB_NPXUSERINITDONE 0x20 /* user fpu state is initialized */ 866cf9a08dSKonstantin Belousov #define PCB_KERNNPX 0x40 /* kernel uses npx */ 871775215fSJohn Baldwin #define PCB_NPXNOSAVE 0x80 /* no save area for current FPU ctx */ 888c132e9fSDavid Xu 89824fc460SJohn Baldwin uint16_t pcb_initial_npxcw; 90824fc460SJohn Baldwin 915b81b6b3SRodney W. Grimes caddr_t pcb_onfault; /* copyin/out fault recovery */ 9248a09cf2SJohn Dyson struct pcb_ext *pcb_ext; /* optional pcb extension */ 931d3c0fa7SBruce Evans int pcb_waspsl; /* unused padding for ABI and API compat */ 9485b23d11SPeter Wemm u_long pcb_vm86[2]; /* vm86bios scratch space */ 956cf9a08dSKonstantin Belousov union savefpu *pcb_save; 96e3fd0bc1SMitsuru IWASAKI 97824fc460SJohn Baldwin uint32_t pcb_pad[10]; 98b1d735baSJohn Baldwin }; 990f68c183SJohn Baldwin 100824fc460SJohn Baldwin /* Per-CPU state saved during suspend and resume. */ 101b1d735baSJohn Baldwin struct susppcb { 102b1d735baSJohn Baldwin struct pcb sp_pcb; 103824fc460SJohn Baldwin 104824fc460SJohn Baldwin /* fpu context for suspend/resume */ 105824fc460SJohn Baldwin void *sp_fpususpend; 1065b81b6b3SRodney W. Grimes }; 1075b81b6b3SRodney W. Grimes 108664a31e4SPeter Wemm #ifdef _KERNEL 1095a39cbafSMarcel Moolenaar struct trapframe; 1105a39cbafSMarcel Moolenaar 1115a39cbafSMarcel Moolenaar void makectx(struct trapframe *, struct pcb *); 112fb864578SMitsuru IWASAKI int savectx(struct pcb *) __returns_twice; 113acd7df97SJung-uk Kim void resumectx(struct pcb *) __fastcall; 1145b81b6b3SRodney W. Grimes #endif 11509f07fb0SRodney W. Grimes 11609f07fb0SRodney W. Grimes #endif /* _I386_PCB_H_ */ 117