139923942SSimon Schubert /*- 239923942SSimon Schubert * Copyright (c) 1990 The Regents of the University of California. 3c8fe38aeSMatthew Dillon * Copyright (c) 2003 Peter Wemm. 4c8fe38aeSMatthew Dillon * Copyright (c) 2008 The DragonFly Project. 539923942SSimon Schubert * All rights reserved. 639923942SSimon Schubert * 739923942SSimon Schubert * This code is derived from software contributed to Berkeley by 839923942SSimon Schubert * William Jolitz. 939923942SSimon Schubert * 1039923942SSimon Schubert * Redistribution and use in source and binary forms, with or without 1139923942SSimon Schubert * modification, are permitted provided that the following conditions 1239923942SSimon Schubert * are met: 1339923942SSimon Schubert * 1. Redistributions of source code must retain the above copyright 1439923942SSimon Schubert * notice, this list of conditions and the following disclaimer. 1539923942SSimon Schubert * 2. Redistributions in binary form must reproduce the above copyright 1639923942SSimon Schubert * notice, this list of conditions and the following disclaimer in the 1739923942SSimon Schubert * documentation and/or other materials provided with the distribution. 182c64e990Szrj * 3. Neither the name of the University nor the names of its contributors 1939923942SSimon Schubert * may be used to endorse or promote products derived from this software 2039923942SSimon Schubert * without specific prior written permission. 2139923942SSimon Schubert * 2239923942SSimon Schubert * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2339923942SSimon Schubert * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2439923942SSimon Schubert * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2539923942SSimon Schubert * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2639923942SSimon Schubert * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2739923942SSimon Schubert * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2839923942SSimon Schubert * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2939923942SSimon Schubert * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3039923942SSimon Schubert * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3139923942SSimon Schubert * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3239923942SSimon Schubert * SUCH DAMAGE. 3339923942SSimon Schubert * 3439923942SSimon Schubert * from: @(#)pcb.h 5.10 (Berkeley) 5/12/91 3539923942SSimon Schubert * $FreeBSD: src/sys/amd64/include/pcb.h,v 1.57 2004/01/28 23:54:31 peter Exp $ 36c8fe38aeSMatthew Dillon * $DragonFly: src/sys/platform/pc64/include/pcb.h,v 1.3 2008/08/29 17:07:17 dillon Exp $ 3739923942SSimon Schubert */ 3839923942SSimon Schubert 3939923942SSimon Schubert #ifndef _MACHINE_PCB_H_ 4039923942SSimon Schubert #define _MACHINE_PCB_H_ 4139923942SSimon Schubert 4239923942SSimon Schubert /* 43b2b3ffcdSSimon Schubert * x86_64 process control block 44c7e46c4aSMatthew Dillon * 45c7e46c4aSMatthew Dillon * WARNING! union savefpu has a 64-byte alignment requirement built-in 46c7e46c4aSMatthew Dillon * which will adjust the size of this structure. 4739923942SSimon Schubert */ 4839923942SSimon Schubert #include <machine/npx.h> 4939923942SSimon Schubert 5039923942SSimon Schubert struct pcb { 514611d87fSMatthew Dillon register_t padxx[7]; 524611d87fSMatthew Dillon register_t pcb_cr3_iso; /* isolated U (+minimal K) PML4e */ 534611d87fSMatthew Dillon register_t pcb_cr3; /* U+K PML4e */ 5439923942SSimon Schubert register_t pcb_r15; 5539923942SSimon Schubert register_t pcb_r14; 5639923942SSimon Schubert register_t pcb_r13; 5739923942SSimon Schubert register_t pcb_r12; 5839923942SSimon Schubert register_t pcb_rbp; 5939923942SSimon Schubert register_t pcb_rsp; 6039923942SSimon Schubert register_t pcb_rbx; 6139923942SSimon Schubert register_t pcb_rip; 62d7f50089SYonghong Yan register_t pcb_rsi; 63d7f50089SYonghong Yan register_t pcb_rdi; 6439923942SSimon Schubert register_t pcb_rflags; 6539923942SSimon Schubert register_t pcb_fsbase; 6639923942SSimon Schubert register_t pcb_gsbase; 67c8fe38aeSMatthew Dillon u_long pcb_flags; 6839923942SSimon Schubert u_int32_t pcb_ds; 6939923942SSimon Schubert u_int32_t pcb_es; 7039923942SSimon Schubert u_int32_t pcb_fs; 7139923942SSimon Schubert u_int32_t pcb_gs; 7239923942SSimon Schubert u_int64_t pcb_dr0; 7339923942SSimon Schubert u_int64_t pcb_dr1; 7439923942SSimon Schubert u_int64_t pcb_dr2; 7539923942SSimon Schubert u_int64_t pcb_dr3; 7639923942SSimon Schubert u_int64_t pcb_dr6; 7739923942SSimon Schubert u_int64_t pcb_dr7; 7839923942SSimon Schubert 79d7f50089SYonghong Yan struct pcb_ldt *pcb_ldt; 8039923942SSimon Schubert union savefpu pcb_save; 8193ad6da2SMatthew Dillon caddr_t pcb_onfault; /* copyin/out fault recovery */ 8293ad6da2SMatthew Dillon register_t pcb_onfault_sp; /* validate onfault */ 8393ad6da2SMatthew Dillon register_t pcb_unused[4]; /* kgdb compatibility expansion */ 8493ad6da2SMatthew Dillon struct pcb_ext *pcb_ext; /* optional pcb extension */ 8593ad6da2SMatthew Dillon }; 8693ad6da2SMatthew Dillon 874611d87fSMatthew Dillon #define PCB_DBREGS 0x00000002 /* process using debug registers */ 884611d87fSMatthew Dillon #define PCB_FPUINITDONE 0x00000008 /* fpu state is initialized */ 89375bb03eSMatthew Dillon #define PCB_ISOMMU 0x00000010 /* MMU isolation */ 90375bb03eSMatthew Dillon 914611d87fSMatthew Dillon #define FP_SOFTFP 0x01 /* process using soft flt emulator */ 924611d87fSMatthew Dillon #define FP_VIRTFP 0x04 /* vkernel wants exception */ 9339923942SSimon Schubert 94375bb03eSMatthew Dillon #define SPEC_CTRL_DUMMY_IBPB SPEC_CTRL_DUMMY1 95375bb03eSMatthew Dillon #define SPEC_CTRL_DUMMY_ENABLE SPEC_CTRL_DUMMY2 96*cd89a7ceSMatthew Dillon #define SPEC_CTRL_MDS_ENABLE SPEC_CTRL_DUMMY3 97375bb03eSMatthew Dillon 9839923942SSimon Schubert #ifdef _KERNEL 9939923942SSimon Schubert void savectx(struct pcb *); 10039923942SSimon Schubert #endif 10139923942SSimon Schubert 10239923942SSimon Schubert #endif /* _MACHINE_PCB_H_ */ 103