xref: /f-stack/freebsd/arm64/include/proc.h (revision 22ce4aff)
1a9643ea8Slogwang /*-
2a9643ea8Slogwang  * Copyright (c) 1991 Regents of the University of California.
3a9643ea8Slogwang  * All rights reserved.
4a9643ea8Slogwang  *
5a9643ea8Slogwang  * Redistribution and use in source and binary forms, with or without
6a9643ea8Slogwang  * modification, are permitted provided that the following conditions
7a9643ea8Slogwang  * are met:
8a9643ea8Slogwang  * 1. Redistributions of source code must retain the above copyright
9a9643ea8Slogwang  *    notice, this list of conditions and the following disclaimer.
10a9643ea8Slogwang  * 2. Redistributions in binary form must reproduce the above copyright
11a9643ea8Slogwang  *    notice, this list of conditions and the following disclaimer in the
12a9643ea8Slogwang  *    documentation and/or other materials provided with the distribution.
13a9643ea8Slogwang  * 3. Neither the name of the University nor the names of its contributors
14a9643ea8Slogwang  *    may be used to endorse or promote products derived from this software
15a9643ea8Slogwang  *    without specific prior written permission.
16a9643ea8Slogwang  *
17a9643ea8Slogwang  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18a9643ea8Slogwang  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19a9643ea8Slogwang  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20a9643ea8Slogwang  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21a9643ea8Slogwang  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22a9643ea8Slogwang  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23a9643ea8Slogwang  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24a9643ea8Slogwang  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25a9643ea8Slogwang  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26a9643ea8Slogwang  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27a9643ea8Slogwang  * SUCH DAMAGE.
28a9643ea8Slogwang  *
29a9643ea8Slogwang  *      from: @(#)proc.h        7.1 (Berkeley) 5/15/91
30a9643ea8Slogwang  *	from: FreeBSD: src/sys/i386/include/proc.h,v 1.11 2001/06/29
31a9643ea8Slogwang  * $FreeBSD$
32a9643ea8Slogwang  */
33a9643ea8Slogwang 
34a9643ea8Slogwang #ifndef	_MACHINE_PROC_H_
35a9643ea8Slogwang #define	_MACHINE_PROC_H_
36a9643ea8Slogwang 
37a9643ea8Slogwang struct mdthread {
38a9643ea8Slogwang 	int	md_spinlock_count;	/* (k) */
39a9643ea8Slogwang 	register_t md_saved_daif;	/* (k) */
40a9643ea8Slogwang };
41a9643ea8Slogwang 
42a9643ea8Slogwang struct mdproc {
43*22ce4affSfengbojiang 	long	md_dummy;
44a9643ea8Slogwang };
45a9643ea8Slogwang 
46a9643ea8Slogwang #define	KINFO_PROC_SIZE	1088
47*22ce4affSfengbojiang #define	KINFO_PROC32_SIZE 816
48a9643ea8Slogwang 
49a9643ea8Slogwang #define	MAXARGS		8
50a9643ea8Slogwang struct syscall_args {
51a9643ea8Slogwang 	u_int code;
52a9643ea8Slogwang 	struct sysent *callp;
53a9643ea8Slogwang 	register_t args[MAXARGS];
54a9643ea8Slogwang };
55a9643ea8Slogwang 
56*22ce4affSfengbojiang #ifdef _KERNEL
57*22ce4affSfengbojiang 
58*22ce4affSfengbojiang #include <machine/pcb.h>
59*22ce4affSfengbojiang 
60*22ce4affSfengbojiang #define	GET_STACK_USAGE(total, used) do {				\
61*22ce4affSfengbojiang 	struct thread *td = curthread;					\
62*22ce4affSfengbojiang 	(total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb);	\
63*22ce4affSfengbojiang 	(used) = (char *)td->td_kstack +				\
64*22ce4affSfengbojiang 	    td->td_kstack_pages * PAGE_SIZE -				\
65*22ce4affSfengbojiang 	    (char *)&td;						\
66*22ce4affSfengbojiang } while (0)
67*22ce4affSfengbojiang 
68a9643ea8Slogwang #endif
69a9643ea8Slogwang 
70a9643ea8Slogwang #endif /* !_MACHINE_PROC_H_ */
71