xref: /freebsd/sys/i386/include/proc.h (revision 29363fb446372cb3f10bc98664e9767c53fbb457)
186cb007fSWarner 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 
326e393973SGarrett Wollman #ifndef _MACHINE_PROC_H_
336f486a55SPeter Wemm #define	_MACHINE_PROC_H_
346e393973SGarrett Wollman 
3524db0459SJohn Baldwin #include <machine/segments.h>
3624db0459SJohn Baldwin 
3724db0459SJohn Baldwin struct proc_ldt {
3824db0459SJohn Baldwin         caddr_t ldt_base;
3924db0459SJohn Baldwin         int     ldt_len;
4024db0459SJohn Baldwin         int     ldt_refcnt;
4124db0459SJohn Baldwin         u_long  ldt_active;
4224db0459SJohn Baldwin         struct  segment_descriptor ldt_sd;
4324db0459SJohn Baldwin };
445206bca1SLuoqi Chen 
455b81b6b3SRodney W. Grimes /*
469368fc20SNate Williams  * Machine-dependent part of the proc structure for i386.
470ad5e7f3SJeff Roberson  * Table of MD locks:
480ad5e7f3SJeff Roberson  *       t - Descriptor tables lock
495b81b6b3SRodney W. Grimes  */
50b40ce416SJulian Elischer struct mdthread {
51c6a37e84SJohn Baldwin 	int	md_spinlock_count;	/* (k) */
52c6a37e84SJohn Baldwin 	register_t md_saved_flags;	/* (k) */
535730afc9SAlan Cox 	register_t md_spurflt_addr;	/* (k) Spurious page fault address. */
54b40ce416SJulian Elischer };
55b40ce416SJulian Elischer 
565b81b6b3SRodney W. Grimes struct mdproc {
570ad5e7f3SJeff Roberson 	struct proc_ldt *md_ldt;	/* (t) per-process ldt */
585b81b6b3SRodney W. Grimes };
595b81b6b3SRodney W. Grimes 
60ed780687SKonstantin Belousov #define	KINFO_PROC_SIZE 768
61ed780687SKonstantin Belousov 
6224db0459SJohn Baldwin #ifdef	_KERNEL
6324db0459SJohn Baldwin 
64*8bc792b3SMitchell Horne #include <machine/md_var.h>
65*8bc792b3SMitchell Horne 
66b63dc6adSAlfred Perlstein void 	set_user_ldt(struct mdproc *);
67b63dc6adSAlfred Perlstein struct 	proc_ldt *user_ldt_alloc(struct mdproc *, int);
68b63dc6adSAlfred Perlstein void 	user_ldt_free(struct thread *);
699719da13SKonstantin Belousov void	user_ldt_deref(struct proc_ldt *pldt);
7024db0459SJohn Baldwin 
710ad5e7f3SJeff Roberson extern struct mtx dt_lock;
7224db0459SJohn Baldwin #endif	/* _KERNEL */
7324db0459SJohn Baldwin 
746f486a55SPeter Wemm #endif /* !_MACHINE_PROC_H_ */
75