xref: /freebsd/sys/powerpc/include/proc.h (revision 51369649b03ece2aed3eb61b0c8214b9aa5b2fa2)
1f9bac91bSBenno Rice /*-
2*51369649SPedro F. Giffuni  * SPDX-License-Identifier: BSD-4-Clause
3*51369649SPedro F. Giffuni  *
4f9bac91bSBenno Rice  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
5f9bac91bSBenno Rice  * Copyright (C) 1995, 1996 TooLs GmbH.
6f9bac91bSBenno Rice  * All rights reserved.
7f9bac91bSBenno Rice  *
8f9bac91bSBenno Rice  * Redistribution and use in source and binary forms, with or without
9f9bac91bSBenno Rice  * modification, are permitted provided that the following conditions
10f9bac91bSBenno Rice  * are met:
11f9bac91bSBenno Rice  * 1. Redistributions of source code must retain the above copyright
12f9bac91bSBenno Rice  *    notice, this list of conditions and the following disclaimer.
13f9bac91bSBenno Rice  * 2. Redistributions in binary form must reproduce the above copyright
14f9bac91bSBenno Rice  *    notice, this list of conditions and the following disclaimer in the
15f9bac91bSBenno Rice  *    documentation and/or other materials provided with the distribution.
16f9bac91bSBenno Rice  * 3. All advertising materials mentioning features or use of this software
17f9bac91bSBenno Rice  *    must display the following acknowledgement:
18f9bac91bSBenno Rice  *	This product includes software developed by TooLs GmbH.
19f9bac91bSBenno Rice  * 4. The name of TooLs GmbH may not be used to endorse or promote products
20f9bac91bSBenno Rice  *    derived from this software without specific prior written permission.
21f9bac91bSBenno Rice  *
22f9bac91bSBenno Rice  * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
23f9bac91bSBenno Rice  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24f9bac91bSBenno Rice  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25f9bac91bSBenno Rice  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26f9bac91bSBenno Rice  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27f9bac91bSBenno Rice  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28f9bac91bSBenno Rice  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29f9bac91bSBenno Rice  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30f9bac91bSBenno Rice  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31f9bac91bSBenno Rice  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32f9bac91bSBenno Rice  *
33f9bac91bSBenno Rice  *	$NetBSD: proc.h,v 1.2 1997/04/16 22:57:48 thorpej Exp $
34f9bac91bSBenno Rice  * $FreeBSD$
35f9bac91bSBenno Rice  */
36f9bac91bSBenno Rice 
37aee9d277SJohn Baldwin #ifndef _MACHINE_PROC_H_
38aee9d277SJohn Baldwin #define	_MACHINE_PROC_H_
39aee9d277SJohn Baldwin 
40f9bac91bSBenno Rice /*
41f9bac91bSBenno Rice  * Machine-dependent part of the proc structure
42f9bac91bSBenno Rice  */
43b40ce416SJulian Elischer struct mdthread {
44c6a37e84SJohn Baldwin 	int	md_spinlock_count;	/* (k) */
45c6a37e84SJohn Baldwin 	register_t md_saved_msr;	/* (k) */
46b40ce416SJulian Elischer };
47b40ce416SJulian Elischer 
48f9bac91bSBenno Rice struct mdproc {
49f9bac91bSBenno Rice };
50aee9d277SJohn Baldwin 
51c3e289e1SNathan Whitehorn #ifdef __powerpc64__
52c3e289e1SNathan Whitehorn #define	KINFO_PROC_SIZE 1088
53fbcf7bcdSJustin Hibbits #define	KINFO_PROC32_SIZE 816
54c3e289e1SNathan Whitehorn #else
55fbcf7bcdSJustin Hibbits #define	KINFO_PROC_SIZE 816
56c3e289e1SNathan Whitehorn #endif
57ed780687SKonstantin Belousov 
5843f41dd3SKonstantin Belousov struct syscall_args {
5943f41dd3SKonstantin Belousov 	u_int code;
6043f41dd3SKonstantin Belousov 	struct sysent *callp;
6143f41dd3SKonstantin Belousov 	register_t args[10];
6243f41dd3SKonstantin Belousov 	int narg;
6343f41dd3SKonstantin Belousov };
6443f41dd3SKonstantin Belousov 
65afe1a688SKonstantin Belousov #ifdef _KERNEL
66a5ff1d66SNathan Whitehorn 
67a5ff1d66SNathan Whitehorn #include <machine/pcb.h>
68a5ff1d66SNathan Whitehorn 
69a5ff1d66SNathan Whitehorn /* Get the current kernel thread stack usage. */
70a5ff1d66SNathan Whitehorn #define	GET_STACK_USAGE(total, used) do {				\
71a5ff1d66SNathan Whitehorn 	struct thread *td = curthread;					\
72a5ff1d66SNathan Whitehorn 	(total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb);	\
73a5ff1d66SNathan Whitehorn 	(used) = (char *)td->td_kstack +				\
74a5ff1d66SNathan Whitehorn 	    td->td_kstack_pages * PAGE_SIZE -				\
75a5ff1d66SNathan Whitehorn 	    (char *)&td;						\
76a5ff1d66SNathan Whitehorn } while (0)
77afe1a688SKonstantin Belousov #endif
78afe1a688SKonstantin Belousov 
79aee9d277SJohn Baldwin #endif /* !_MACHINE_PROC_H_ */
80