18c64af4fSJohn Polstra /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3c4e20cadSPedro F. Giffuni * 48c64af4fSJohn Polstra * Copyright (c) 1998 John D. Polstra. 58c64af4fSJohn Polstra * All rights reserved. 68c64af4fSJohn Polstra * 78c64af4fSJohn Polstra * Redistribution and use in source and binary forms, with or without 88c64af4fSJohn Polstra * modification, are permitted provided that the following conditions 98c64af4fSJohn Polstra * are met: 108c64af4fSJohn Polstra * 1. Redistributions of source code must retain the above copyright 118c64af4fSJohn Polstra * notice, this list of conditions and the following disclaimer. 128c64af4fSJohn Polstra * 2. Redistributions in binary form must reproduce the above copyright 138c64af4fSJohn Polstra * notice, this list of conditions and the following disclaimer in the 148c64af4fSJohn Polstra * documentation and/or other materials provided with the distribution. 158c64af4fSJohn Polstra * 168c64af4fSJohn Polstra * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 178c64af4fSJohn Polstra * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 188c64af4fSJohn Polstra * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 198c64af4fSJohn Polstra * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 208c64af4fSJohn Polstra * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 218c64af4fSJohn Polstra * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 228c64af4fSJohn Polstra * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 238c64af4fSJohn Polstra * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 248c64af4fSJohn Polstra * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 258c64af4fSJohn Polstra * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 268c64af4fSJohn Polstra * SUCH DAMAGE. 278c64af4fSJohn Polstra * 28c3aac50fSPeter Wemm * $FreeBSD$ 298c64af4fSJohn Polstra */ 308c64af4fSJohn Polstra 318c64af4fSJohn Polstra #ifndef _SYS_PROCFS_H_ 328c64af4fSJohn Polstra #define _SYS_PROCFS_H_ 338c64af4fSJohn Polstra 348c64af4fSJohn Polstra #include <sys/param.h> 358c64af4fSJohn Polstra #include <machine/reg.h> 368c64af4fSJohn Polstra 378c64af4fSJohn Polstra typedef struct reg gregset_t; 388c64af4fSJohn Polstra typedef struct fpreg fpregset_t; 398c64af4fSJohn Polstra 408c64af4fSJohn Polstra /* 418c64af4fSJohn Polstra * These structures define an interface between core files and the debugger. 428c64af4fSJohn Polstra * Never change or delete any elements. If you add elements, add them to 438c64af4fSJohn Polstra * the end of the structure, and increment the value of its version field. 448c64af4fSJohn Polstra * This will help to ensure that today's core dump will still be usable 458c64af4fSJohn Polstra * with next year's debugger. 468c64af4fSJohn Polstra * 478c64af4fSJohn Polstra * A lot more things should be added to these structures. At present, 488c64af4fSJohn Polstra * they contain the absolute bare minimum required to allow GDB to work 498c64af4fSJohn Polstra * with ELF core dumps. 508c64af4fSJohn Polstra */ 518c64af4fSJohn Polstra 528c64af4fSJohn Polstra /* 538c64af4fSJohn Polstra * The parenthsized numbers like (1) indicate the minimum version number 54ccb83afdSJohn Baldwin * for which each element exists in the structure. The version number is 55ccb83afdSJohn Baldwin * not bumped when adding new fields to the end, only if the meaning of 56ccb83afdSJohn Baldwin * an existing field changes. Additional fields are annotated as (1a), 57ccb83afdSJohn Baldwin * (1b), etc. to indicate the groupings of additions. 588c64af4fSJohn Polstra */ 598c64af4fSJohn Polstra 608c64af4fSJohn Polstra #define PRSTATUS_VERSION 1 /* Current version of prstatus_t */ 618c64af4fSJohn Polstra 628c64af4fSJohn Polstra typedef struct prstatus { 638c64af4fSJohn Polstra int pr_version; /* Version number of struct (1) */ 648c64af4fSJohn Polstra size_t pr_statussz; /* sizeof(prstatus_t) (1) */ 658c64af4fSJohn Polstra size_t pr_gregsetsz; /* sizeof(gregset_t) (1) */ 668c64af4fSJohn Polstra size_t pr_fpregsetsz; /* sizeof(fpregset_t) (1) */ 678c64af4fSJohn Polstra int pr_osreldate; /* Kernel version (1) */ 688c64af4fSJohn Polstra int pr_cursig; /* Current signal (1) */ 69ccb83afdSJohn Baldwin pid_t pr_pid; /* LWP (Thread) ID (1) */ 708c64af4fSJohn Polstra gregset_t pr_reg; /* General purpose registers (1) */ 718c64af4fSJohn Polstra } prstatus_t; 728c64af4fSJohn Polstra 73b8732336SDavid Xu typedef gregset_t prgregset_t[1]; 748c64af4fSJohn Polstra typedef fpregset_t prfpregset_t; 758c64af4fSJohn Polstra 766eef6816SPeter Wemm #define PRFNAMESZ 16 /* Maximum command length saved */ 778c64af4fSJohn Polstra #define PRARGSZ 80 /* Maximum argument bytes saved */ 788c64af4fSJohn Polstra 798c64af4fSJohn Polstra #define PRPSINFO_VERSION 1 /* Current version of prpsinfo_t */ 808c64af4fSJohn Polstra 818c64af4fSJohn Polstra typedef struct prpsinfo { 828c64af4fSJohn Polstra int pr_version; /* Version number of struct (1) */ 838c64af4fSJohn Polstra size_t pr_psinfosz; /* sizeof(prpsinfo_t) (1) */ 846eef6816SPeter Wemm char pr_fname[PRFNAMESZ+1]; /* Command name, null terminated (1) */ 858c64af4fSJohn Polstra char pr_psargs[PRARGSZ+1]; /* Arguments, null terminated (1) */ 86ccb83afdSJohn Baldwin pid_t pr_pid; /* Process ID (1a) */ 878c64af4fSJohn Polstra } prpsinfo_t; 888c64af4fSJohn Polstra 897f08176eSAttilio Rao typedef struct thrmisc { 907f08176eSAttilio Rao char pr_tname[MAXCOMLEN+1]; /* Thread name, null terminated (1) */ 917f08176eSAttilio Rao u_int _pad; /* Convenience pad, 0-filled (1) */ 927f08176eSAttilio Rao } thrmisc_t; 937f08176eSAttilio Rao 9493898f2bSMarcel Moolenaar typedef uint64_t psaddr_t; /* An address in the target process. */ 95cfdb160eSMarcel Moolenaar 96dbee5c67SJohn Baldwin #ifdef __HAVE_REG32 97dbee5c67SJohn Baldwin typedef struct prstatus32 { 98dbee5c67SJohn Baldwin int32_t pr_version; 99dbee5c67SJohn Baldwin uint32_t pr_statussz; 100dbee5c67SJohn Baldwin uint32_t pr_gregsetsz; 101dbee5c67SJohn Baldwin uint32_t pr_fpregsetsz; 102dbee5c67SJohn Baldwin int32_t pr_osreldate; 103dbee5c67SJohn Baldwin int32_t pr_cursig; 104dbee5c67SJohn Baldwin int32_t pr_pid; 105dbee5c67SJohn Baldwin struct reg32 pr_reg; 106dbee5c67SJohn Baldwin } prstatus32_t; 107dbee5c67SJohn Baldwin 108dbee5c67SJohn Baldwin typedef struct prpsinfo32 { 109dbee5c67SJohn Baldwin int32_t pr_version; 110dbee5c67SJohn Baldwin uint32_t pr_psinfosz; 111dbee5c67SJohn Baldwin char pr_fname[PRFNAMESZ+1]; 112dbee5c67SJohn Baldwin char pr_psargs[PRARGSZ+1]; 113ccb83afdSJohn Baldwin int32_t pr_pid; 114dbee5c67SJohn Baldwin } prpsinfo32_t; 115dbee5c67SJohn Baldwin 116dbee5c67SJohn Baldwin struct thrmisc32 { 117dbee5c67SJohn Baldwin char pr_tname[MAXCOMLEN+1]; 118dbee5c67SJohn Baldwin uint32_t _pad; 119dbee5c67SJohn Baldwin }; 120dbee5c67SJohn Baldwin #endif /* __HAVE_REG32 */ 121dbee5c67SJohn Baldwin 1228c64af4fSJohn Polstra #endif /* _SYS_PROCFS_H_ */ 123