1139825Simp/*-
282899Sjake * Copyright (c) 1991 Regents of the University of California.
380708Sjake * All rights reserved.
480708Sjake *
580708Sjake * Redistribution and use in source and binary forms, with or without
680708Sjake * modification, are permitted provided that the following conditions
780708Sjake * are met:
880708Sjake * 1. Redistributions of source code must retain the above copyright
980708Sjake *    notice, this list of conditions and the following disclaimer.
1080708Sjake * 2. Redistributions in binary form must reproduce the above copyright
1180708Sjake *    notice, this list of conditions and the following disclaimer in the
1280708Sjake *    documentation and/or other materials provided with the distribution.
1382899Sjake * 4. Neither the name of the University nor the names of its contributors
1482899Sjake *    may be used to endorse or promote products derived from this software
1582899Sjake *    without specific prior written permission.
1680708Sjake *
1782899Sjake * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1880708Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1980708Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2082899Sjake * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2180708Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2280708Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2380708Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2480708Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2580708Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2680708Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2780708Sjake * SUCH DAMAGE.
2880708Sjake *
2982899Sjake *      from: @(#)proc.h        7.1 (Berkeley) 5/15/91
3082899Sjake *	from: FreeBSD: src/sys/i386/include/proc.h,v 1.11 2001/06/29
3180708Sjake * $FreeBSD: stable/11/sys/sparc64/include/proc.h 321324 2017-07-21 06:56:06Z kib $
3280708Sjake */
3380708Sjake
3480708Sjake#ifndef	_MACHINE_PROC_H_
3580708Sjake#define	_MACHINE_PROC_H_
3680708Sjake
3788782Sjake#include <machine/utrap.h>
3880708Sjake
3988782Sjakestruct md_utrap {
4088782Sjake	utrap_entry_t *ut_precise[UT_MAX];	/* must be first */
4188782Sjake	int	ut_refcnt;
4288782Sjake};
4388782Sjake
4483366Sjulianstruct mdthread {
45144637Sjhb	int	md_spinlock_count;	/* (k) */
46144637Sjhb	register_t md_saved_pil;	/* (k) */
4783366Sjulian};
4883366Sjulian
4983053Sobrienstruct mdproc {
5088782Sjake	struct	md_utrap *md_utrap;
5195744Sjake	void	*md_sigtramp;
5280708Sjake};
5380708Sjake
54207269Skib#define	KINFO_PROC_SIZE 1088
55207152Skib
56321324Skibstruct syscall_args {
57321324Skib	u_int code;
58321324Skib	struct sysent *callp;
59321324Skib	register_t args[8];
60321324Skib	int narg;
61321324Skib};
62321324Skib
63208453Skib#ifdef _KERNEL
64208453Skib
65255937Smarius#include <machine/pcb.h>
66255937Smarius
67255937Smarius/* Get the current kernel thread stack usage. */
68255937Smarius#define	GET_STACK_USAGE(total, used) do {				\
69255937Smarius	struct thread *td = curthread;					\
70255937Smarius	(total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb);	\
71255937Smarius	(used) = (char *)td->td_kstack +				\
72255937Smarius	    td->td_kstack_pages * PAGE_SIZE -				\
73255937Smarius	    (char *)&td;						\
74255937Smarius} while (0)
75255937Smarius
76208453Skib#endif
77208453Skib
7880708Sjake#endif /* !_MACHINE_PROC_H_ */
79