Print this page
15254 %ymm registers not restored after signal handler
15367 x86 getfpregs() summons corrupting %xmm ghosts
15333 want x86 /proc xregs support (libc_db, libproc, mdb, etc.)
15336 want libc functions for extended ucontext_t
15334 want ps_lwphandle-specific reg routines
15328 FPU_CW_INIT mistreats reserved bit
15335 i86pc fpu_subr.c isn't really platform-specific
15332 setcontext(2) isn't actually noreturn
15331 need <sys/stdalign.h>
Change-Id: I7060aa86042dfb989f77fc3323c065ea2eafa9ad
Conflicts:
    usr/src/uts/common/fs/proc/prcontrol.c
    usr/src/uts/intel/os/archdep.c
    usr/src/uts/intel/sys/ucontext.h
    usr/src/uts/intel/syscall/getcontext.c


  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 /*
  26  * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
  27  * Copyright (c) 2013 by Delphix. All rights reserved.
  28  * Copyright 2018 Joyent, Inc.
  29  * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
  30  * Copyright 2021 Oxide Computer Company
  31  */
  32 
  33 #ifndef _PCONTROL_H
  34 #define _PCONTROL_H
  35 
  36 /*
  37  * Implemention-specific include file for libproc process management.
  38  * This is not to be seen by the clients of libproc.
  39  */
  40 
  41 #include <stdio.h>
  42 #include <gelf.h>
  43 #include <synch.h>
  44 #include <procfs.h>
  45 #include <rtld_db.h>
  46 #include <libproc.h>
  47 #include <libctf.h>
  48 #include <limits.h>
  49 #include <libproc.h>
  50 #include <thread.h>


 127         char    *file_shstrs;   /* section header string table */
 128         size_t  file_shstrsz;   /* section header string table size */
 129         uintptr_t *file_saddrs; /* section header addresses */
 130         uint_t  file_nsaddrs;   /* number of section header addresses */
 131         boolean_t file_cvt;     /* Have we tried to convert this? */
 132 } file_info_t;
 133 
 134 typedef struct map_info {       /* description of an address space mapping */
 135         prmap_t map_pmap;       /* /proc description of this mapping */
 136         file_info_t *map_file;  /* pointer into list of mapped files */
 137         off64_t map_offset;     /* offset into core file (if core) */
 138         int map_relocate;       /* associated file_map needs to be relocated */
 139 } map_info_t;
 140 
 141 typedef struct lwp_info {       /* per-lwp information from core file */
 142         list_node_t lwp_list;   /* linked list */
 143         lwpid_t lwp_id;         /* lwp identifier */
 144         lwpsinfo_t lwp_psinfo;  /* /proc/<pid>/lwp/<lwpid>/lwpsinfo data */
 145         lwpstatus_t lwp_status; /* /proc/<pid>/lwp/<lwpid>/lwpstatus data */
 146         char lwp_name[THREAD_NAME_MAX];


 147 #if defined(sparc) || defined(__sparc)
 148         gwindows_t *lwp_gwins;  /* /proc/<pid>/lwp/<lwpid>/gwindows data */
 149         prxregset_t *lwp_xregs; /* /proc/<pid>/lwp/<lwpid>/xregs data */
 150         int64_t *lwp_asrs;      /* /proc/<pid>/lwp/<lwpid>/asrs data */
 151 #endif
 152 } lwp_info_t;
 153 
 154 typedef struct fd_info {
 155         list_node_t fd_list;    /* linked list */
 156         prfdinfo_t *fd_info;    /* fd info */
 157 } fd_info_t;
 158 
 159 typedef struct core_info {      /* information specific to core files */
 160         char core_dmodel;       /* data model for core file */
 161         char core_osabi;        /* ELF OS ABI */
 162         int core_errno;         /* error during initialization if != 0 */
 163         list_t core_lwp_head;   /* head of list of lwp info */
 164         lwp_info_t *core_lwp;   /* current lwp information */
 165         off64_t core_size;      /* size of core file in bytes */
 166         char *core_platform;    /* platform string from core file */
 167         struct utsname *core_uts;       /* uname(2) data from core file */
 168         prcred_t *core_cred;    /* process credential from core file */
 169         core_content_t core_content;    /* content dumped to core file */


 281 extern  void    Pbuild_file_symtab(struct ps_prochandle *, file_info_t *);
 282 extern  ctf_file_t *Pbuild_file_ctf(struct ps_prochandle *, file_info_t *);
 283 extern  map_info_t *Paddr2mptr(struct ps_prochandle *, uintptr_t);
 284 extern  char    *Pfindexec(struct ps_prochandle *, const char *,
 285         int (*)(const char *, void *), void *);
 286 extern  int     getlwpstatus(struct ps_prochandle *, lwpid_t, lwpstatus_t *);
 287 int     Pstopstatus(struct ps_prochandle *, long, uint32_t);
 288 extern  file_info_t *file_info_new(struct ps_prochandle *, map_info_t *);
 289 extern  char    *Plofspath(const char *, char *, size_t);
 290 extern  char    *Pzoneroot(struct ps_prochandle *, char *, size_t);
 291 extern  char    *Pzonepath(struct ps_prochandle *, const char *, char *,
 292         size_t);
 293 extern  fd_info_t *Pfd2info(struct ps_prochandle *, int);
 294 
 295 extern  char    *Pfindmap(struct ps_prochandle *, map_info_t *, char *,
 296         size_t);
 297 
 298 extern  int     Padd_mapping(struct ps_prochandle *, off64_t, file_info_t *,
 299     prmap_t *);
 300 extern  void    Psort_mappings(struct ps_prochandle *);


 301 
 302 extern char     procfs_path[PATH_MAX];
 303 
 304 /*
 305  * Architecture-dependent definition of the breakpoint instruction.
 306  */
 307 #if defined(sparc) || defined(__sparc)
 308 #define BPT     ((instr_t)0x91d02001)
 309 #elif defined(__i386) || defined(__amd64)
 310 #define BPT     ((instr_t)0xcc)
 311 #endif
 312 
 313 /*
 314  * Simple convenience.
 315  */
 316 #define TRUE    1
 317 #define FALSE   0
 318 
 319 #ifdef  __cplusplus
 320 }


  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 /*
  26  * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
  27  * Copyright (c) 2013 by Delphix. All rights reserved.
  28  * Copyright 2018 Joyent, Inc.
  29  * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
  30  * Copyright 2023 Oxide Computer Company
  31  */
  32 
  33 #ifndef _PCONTROL_H
  34 #define _PCONTROL_H
  35 
  36 /*
  37  * Implemention-specific include file for libproc process management.
  38  * This is not to be seen by the clients of libproc.
  39  */
  40 
  41 #include <stdio.h>
  42 #include <gelf.h>
  43 #include <synch.h>
  44 #include <procfs.h>
  45 #include <rtld_db.h>
  46 #include <libproc.h>
  47 #include <libctf.h>
  48 #include <limits.h>
  49 #include <libproc.h>
  50 #include <thread.h>


 127         char    *file_shstrs;   /* section header string table */
 128         size_t  file_shstrsz;   /* section header string table size */
 129         uintptr_t *file_saddrs; /* section header addresses */
 130         uint_t  file_nsaddrs;   /* number of section header addresses */
 131         boolean_t file_cvt;     /* Have we tried to convert this? */
 132 } file_info_t;
 133 
 134 typedef struct map_info {       /* description of an address space mapping */
 135         prmap_t map_pmap;       /* /proc description of this mapping */
 136         file_info_t *map_file;  /* pointer into list of mapped files */
 137         off64_t map_offset;     /* offset into core file (if core) */
 138         int map_relocate;       /* associated file_map needs to be relocated */
 139 } map_info_t;
 140 
 141 typedef struct lwp_info {       /* per-lwp information from core file */
 142         list_node_t lwp_list;   /* linked list */
 143         lwpid_t lwp_id;         /* lwp identifier */
 144         lwpsinfo_t lwp_psinfo;  /* /proc/<pid>/lwp/<lwpid>/lwpsinfo data */
 145         lwpstatus_t lwp_status; /* /proc/<pid>/lwp/<lwpid>/lwpstatus data */
 146         char lwp_name[THREAD_NAME_MAX];
 147         prxregset_t *lwp_xregs; /* /proc/<pid>/lwp/<lwpid>/xregs data */
 148         size_t lwp_xregsize;
 149 #if defined(sparc) || defined(__sparc)
 150         gwindows_t *lwp_gwins;  /* /proc/<pid>/lwp/<lwpid>/gwindows data */

 151         int64_t *lwp_asrs;      /* /proc/<pid>/lwp/<lwpid>/asrs data */
 152 #endif
 153 } lwp_info_t;
 154 
 155 typedef struct fd_info {
 156         list_node_t fd_list;    /* linked list */
 157         prfdinfo_t *fd_info;    /* fd info */
 158 } fd_info_t;
 159 
 160 typedef struct core_info {      /* information specific to core files */
 161         char core_dmodel;       /* data model for core file */
 162         char core_osabi;        /* ELF OS ABI */
 163         int core_errno;         /* error during initialization if != 0 */
 164         list_t core_lwp_head;   /* head of list of lwp info */
 165         lwp_info_t *core_lwp;   /* current lwp information */
 166         off64_t core_size;      /* size of core file in bytes */
 167         char *core_platform;    /* platform string from core file */
 168         struct utsname *core_uts;       /* uname(2) data from core file */
 169         prcred_t *core_cred;    /* process credential from core file */
 170         core_content_t core_content;    /* content dumped to core file */


 282 extern  void    Pbuild_file_symtab(struct ps_prochandle *, file_info_t *);
 283 extern  ctf_file_t *Pbuild_file_ctf(struct ps_prochandle *, file_info_t *);
 284 extern  map_info_t *Paddr2mptr(struct ps_prochandle *, uintptr_t);
 285 extern  char    *Pfindexec(struct ps_prochandle *, const char *,
 286         int (*)(const char *, void *), void *);
 287 extern  int     getlwpstatus(struct ps_prochandle *, lwpid_t, lwpstatus_t *);
 288 int     Pstopstatus(struct ps_prochandle *, long, uint32_t);
 289 extern  file_info_t *file_info_new(struct ps_prochandle *, map_info_t *);
 290 extern  char    *Plofspath(const char *, char *, size_t);
 291 extern  char    *Pzoneroot(struct ps_prochandle *, char *, size_t);
 292 extern  char    *Pzonepath(struct ps_prochandle *, const char *, char *,
 293         size_t);
 294 extern  fd_info_t *Pfd2info(struct ps_prochandle *, int);
 295 
 296 extern  char    *Pfindmap(struct ps_prochandle *, map_info_t *, char *,
 297         size_t);
 298 
 299 extern  int     Padd_mapping(struct ps_prochandle *, off64_t, file_info_t *,
 300     prmap_t *);
 301 extern  void    Psort_mappings(struct ps_prochandle *);
 302 extern  struct ps_lwphandle *Lfind(struct ps_prochandle *, lwpid_t);
 303 extern  int     Lstopstatus(struct ps_lwphandle *, long, uint_t);
 304 
 305 extern char     procfs_path[PATH_MAX];
 306 
 307 /*
 308  * Architecture-dependent definition of the breakpoint instruction.
 309  */
 310 #if defined(sparc) || defined(__sparc)
 311 #define BPT     ((instr_t)0x91d02001)
 312 #elif defined(__i386) || defined(__amd64)
 313 #define BPT     ((instr_t)0xcc)
 314 #endif
 315 
 316 /*
 317  * Simple convenience.
 318  */
 319 #define TRUE    1
 320 #define FALSE   0
 321 
 322 #ifdef  __cplusplus
 323 }