146280ae7SWarner Losh /*- 251369649SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 351369649SPedro F. Giffuni * 45b81b6b3SRodney W. Grimes * Copyright (c) 1991 Regents of the University of California. 55b81b6b3SRodney W. Grimes * All rights reserved. 65b81b6b3SRodney W. Grimes * 75b81b6b3SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 85b81b6b3SRodney W. Grimes * modification, are permitted provided that the following conditions 95b81b6b3SRodney W. Grimes * are met: 105b81b6b3SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 115b81b6b3SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 125b81b6b3SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 135b81b6b3SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 145b81b6b3SRodney W. Grimes * documentation and/or other materials provided with the distribution. 15fbbd9655SWarner Losh * 3. Neither the name of the University nor the names of its contributors 165b81b6b3SRodney W. Grimes * may be used to endorse or promote products derived from this software 175b81b6b3SRodney W. Grimes * without specific prior written permission. 185b81b6b3SRodney W. Grimes * 195b81b6b3SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 205b81b6b3SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 215b81b6b3SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 225b81b6b3SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 235b81b6b3SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 245b81b6b3SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 255b81b6b3SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 265b81b6b3SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 275b81b6b3SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 285b81b6b3SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 295b81b6b3SRodney W. Grimes * SUCH DAMAGE. 305b81b6b3SRodney W. Grimes */ 315b81b6b3SRodney W. Grimes 32*b3120c0aSBrooks Davis #ifdef __i386__ 33*b3120c0aSBrooks Davis #include <i386/proc.h> 34*b3120c0aSBrooks Davis #else /* !__i386__ */ 35*b3120c0aSBrooks Davis 366e393973SGarrett Wollman #ifndef _MACHINE_PROC_H_ 376f486a55SPeter Wemm #define _MACHINE_PROC_H_ 386e393973SGarrett Wollman 3956e61f57SKonstantin Belousov #include <sys/queue.h> 405e921ff4SKonstantin Belousov #include <machine/pcb.h> 412c66cccaSKonstantin Belousov #include <machine/segments.h> 422c66cccaSKonstantin Belousov 4356e61f57SKonstantin Belousov /* 4456e61f57SKonstantin Belousov * List of locks 456f1fe330SKonstantin Belousov * c - proc lock 4656e61f57SKonstantin Belousov * k - only accessed by curthread 4756e61f57SKonstantin Belousov * pp - pmap.c:invl_gen_mtx 4856e61f57SKonstantin Belousov */ 4956e61f57SKonstantin Belousov 502c66cccaSKonstantin Belousov struct proc_ldt { 512c66cccaSKonstantin Belousov caddr_t ldt_base; 522c66cccaSKonstantin Belousov int ldt_refcnt; 532c66cccaSKonstantin Belousov }; 542c66cccaSKonstantin Belousov 554d3b28bcSKonstantin Belousov #define PMAP_INVL_GEN_NEXT_INVALID 0x1ULL 5656e61f57SKonstantin Belousov struct pmap_invl_gen { 5756e61f57SKonstantin Belousov u_long gen; /* (k) */ 584d3b28bcSKonstantin Belousov union { 5956e61f57SKonstantin Belousov LIST_ENTRY(pmap_invl_gen) link; /* (pp) */ 604d3b28bcSKonstantin Belousov struct { 614d3b28bcSKonstantin Belousov struct pmap_invl_gen *next; 624d3b28bcSKonstantin Belousov u_char saved_pri; 6356e61f57SKonstantin Belousov }; 644d3b28bcSKonstantin Belousov }; 654d3b28bcSKonstantin Belousov } __aligned(16); 6656e61f57SKonstantin Belousov 675b81b6b3SRodney W. Grimes /* 68afa88623SPeter Wemm * Machine-dependent part of the proc structure for AMD64. 695b81b6b3SRodney W. Grimes */ 70b40ce416SJulian Elischer struct mdthread { 71c6a37e84SJohn Baldwin int md_spinlock_count; /* (k) */ 72c6a37e84SJohn Baldwin register_t md_saved_flags; /* (k) */ 735730afc9SAlan Cox register_t md_spurflt_addr; /* (k) Spurious page fault address. */ 7456e61f57SKonstantin Belousov struct pmap_invl_gen md_invl_gen; 751565fb29SKonstantin Belousov register_t md_efirt_tmp; /* (k) */ 761565fb29SKonstantin Belousov int md_efirt_dis_pf; /* (k) */ 775e921ff4SKonstantin Belousov struct pcb md_pcb; 785e921ff4SKonstantin Belousov vm_offset_t md_stack_base; 79e36d0e86SKonstantin Belousov void *md_usr_fpu_save; 80b40ce416SJulian Elischer }; 81b40ce416SJulian Elischer 825b81b6b3SRodney W. Grimes struct mdproc { 832c66cccaSKonstantin Belousov struct proc_ldt *md_ldt; /* (t) per-process ldt */ 842c66cccaSKonstantin Belousov struct system_segment_descriptor md_ldt_sd; 856f1fe330SKonstantin Belousov u_int md_flags; /* (c) md process flags P_MD */ 865b81b6b3SRodney W. Grimes }; 875b81b6b3SRodney W. Grimes 886f1fe330SKonstantin Belousov #define P_MD_KPTI 0x00000001 /* Enable KPTI on exec */ 899ce875d9SKonstantin Belousov #define P_MD_LA48 0x00000002 /* Request LA48 after exec */ 909ce875d9SKonstantin Belousov #define P_MD_LA57 0x00000004 /* Request LA57 after exec */ 916f1fe330SKonstantin Belousov 92ed780687SKonstantin Belousov #define KINFO_PROC_SIZE 1088 93ed780687SKonstantin Belousov #define KINFO_PROC32_SIZE 768 94ed780687SKonstantin Belousov 952a57ca33SAlexander Motin #ifdef _KERNEL 962a57ca33SAlexander Motin 972c66cccaSKonstantin Belousov struct proc_ldt *user_ldt_alloc(struct proc *, int); 982c66cccaSKonstantin Belousov void user_ldt_free(struct thread *); 992c66cccaSKonstantin Belousov struct sysarch_args; 1002c66cccaSKonstantin Belousov int sysarch_ldt(struct thread *td, struct sysarch_args *uap, int uap_space); 1012c66cccaSKonstantin Belousov int amd64_set_ldt_data(struct thread *td, int start, int num, 1022c66cccaSKonstantin Belousov struct user_segment_descriptor *descs); 1032c66cccaSKonstantin Belousov 1042c66cccaSKonstantin Belousov extern struct mtx dt_lock; 1052c66cccaSKonstantin Belousov extern int max_ldt_segment; 1066816c884SMateusz Guzik 1076816c884SMateusz Guzik #define NARGREGS 6 1086816c884SMateusz Guzik 1092a57ca33SAlexander Motin #endif /* _KERNEL */ 1102a57ca33SAlexander Motin 1116f486a55SPeter Wemm #endif /* !_MACHINE_PROC_H_ */ 112*b3120c0aSBrooks Davis 113*b3120c0aSBrooks Davis #endif /* __i386__ */ 114