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