1f9bac91bSBenno Rice /*- 251369649SPedro F. Giffuni * SPDX-License-Identifier: BSD-4-Clause 351369649SPedro 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 { 49*4e8872c8SLeandro Lupori /* Avoid empty structs, that have undefined behavior in C99 and 50*4e8872c8SLeandro Lupori * make compilers complain about it 51*4e8872c8SLeandro Lupori * (empty struct has size 0 in C, size 1 in C++). 52*4e8872c8SLeandro Lupori */ 53*4e8872c8SLeandro Lupori long md_spare; 54f9bac91bSBenno Rice }; 55aee9d277SJohn Baldwin 56c3e289e1SNathan Whitehorn #ifdef __powerpc64__ 57c3e289e1SNathan Whitehorn #define KINFO_PROC_SIZE 1088 58fbcf7bcdSJustin Hibbits #define KINFO_PROC32_SIZE 816 59c3e289e1SNathan Whitehorn #else 60fbcf7bcdSJustin Hibbits #define KINFO_PROC_SIZE 816 61c3e289e1SNathan Whitehorn #endif 62ed780687SKonstantin Belousov 6343f41dd3SKonstantin Belousov struct syscall_args { 6443f41dd3SKonstantin Belousov u_int code; 6543f41dd3SKonstantin Belousov struct sysent *callp; 6643f41dd3SKonstantin Belousov register_t args[10]; 6743f41dd3SKonstantin Belousov int narg; 6843f41dd3SKonstantin Belousov }; 6943f41dd3SKonstantin Belousov 70afe1a688SKonstantin Belousov #ifdef _KERNEL 71a5ff1d66SNathan Whitehorn 72a5ff1d66SNathan Whitehorn #include <machine/pcb.h> 73a5ff1d66SNathan Whitehorn 74a5ff1d66SNathan Whitehorn /* Get the current kernel thread stack usage. */ 75a5ff1d66SNathan Whitehorn #define GET_STACK_USAGE(total, used) do { \ 76a5ff1d66SNathan Whitehorn struct thread *td = curthread; \ 77a5ff1d66SNathan Whitehorn (total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \ 78a5ff1d66SNathan Whitehorn (used) = (char *)td->td_kstack + \ 79a5ff1d66SNathan Whitehorn td->td_kstack_pages * PAGE_SIZE - \ 80a5ff1d66SNathan Whitehorn (char *)&td; \ 81a5ff1d66SNathan Whitehorn } while (0) 82afe1a688SKonstantin Belousov #endif 83afe1a688SKonstantin Belousov 84aee9d277SJohn Baldwin #endif /* !_MACHINE_PROC_H_ */ 85