Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/agent/src/os/linux/glibc_procfs.h
38833 views
/* Copyright (C) 2001, 2004 Free Software Foundation, Inc.1This file is part of the GNU C Library.2The GNU C Library is free software; you can redistribute it and/or3modify it under the terms of the GNU Lesser General Public4License as published by the Free Software Foundation; either5version 2.1 of the License, or (at your option) any later version.6The GNU C Library is distributed in the hope that it will be useful,7but WITHOUT ANY WARRANTY; without even the implied warranty of8MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU9Lesser General Public License for more details.10You should have received a copy of the GNU Lesser General Public11License along with the GNU C Library; if not, write to the Free12Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA1302111-1307 USA. */1415#ifndef _SYS_PROCFS_H16#define _SYS_PROCFS_H 11718#define USE_LOCAL_PROCFS 11920/* This is somewhat modelled after the file of the same name on SVR421systems. It provides a definition of the core file format for ELF22used on Linux. It doesn't have anything to do with the /proc file23system, even though Linux has one.24Anyway, the whole purpose of this file is for GDB and GDB only.25Don't read too much into it. Don't use it for anything other than26GDB unless you know what you are doing. */2728#include <features.h>29#include <sys/time.h>30#include <sys/types.h>31#include <sys/user.h>3233#ifndef USE_LOCAL_PROCFS34# include <sys/procfs.h>35#else36# include <sys/cdefs.h>37# include <sys/ucontext.h>38#endif3940__BEGIN_DECLS4142#ifdef USE_LOCAL_PROCFS4344#if defined(__arm__)45typedef struct user_fpregs fpregset_t;46#elif defined(__aarch64__)47/*48struct user_regs_struct {49uint64_t regs[31];50uint64_t sp;51uint64_t pc;52uint64_t pstate;53};54*/55struct user_fpsimd_struct {56__uint128_t vregs[32];57uint32_t fpsr;58uint32_t fpcr;59};60typedef struct user_fpsimd_struct fpregset_t;61/*62#elif defined(__i386__)63struct _libc_fpreg {64unsigned short significand[4];65unsigned short exponent;66};6768struct _libc_fpstate {69unsigned long cw;70unsigned long sw;71unsigned long tag;72unsigned long ipoff;73unsigned long cssel;74unsigned long dataoff;75unsigned long datasel;76struct _libc_fpreg _st[8];77unsigned long status;78};7980typedef struct _libc_fpstate* fpregset_t;81#elif defined(__x86_64__)82struct _libc_fpxreg {83unsigned short significand[4];84unsigned short exponent;85unsigned short padding[3];86};8788struct _libc_xmmreg {89uint32_t element[4];90};9192struct _libc_fpstate {93uint16_t cwd;94uint16_t swd;95uint16_t ftw;96uint16_t fop;97uint64_t rip;98uint64_t rdp;99uint32_t mxcsr;100uint32_t mxcr_mask;101struct _libc_fpxreg _st[8];102struct _libc_xmmreg _xmm[16];103uint32_t padding[24];104};105106typedef struct _libc_fpstate* fpregset_t;107*/108#endif109110typedef unsigned long elf_greg_t;111typedef elf_greg_t elf_gregset_t[NGREG];112113typedef fpregset_t elf_fpregset_t;114115#if defined(__i386__)116typedef struct user_fpxregs_struct elf_fpxregset_t;117#endif118119typedef elf_gregset_t prgregset_t;120typedef elf_fpregset_t prfpregset_t;121122typedef pid_t lwpid_t;123typedef void* psaddr_t;124125struct elf_siginfo {126int si_signo;127int si_code;128int si_errno;129};130131#endif // USE_LOCAL_PROCFS132133/* And the whole bunch of them. We could have used `struct134user_regs_struct' directly in the typedef, but tradition says that135the register set is an array, which does have some peculiar136semantics, so leave it that way. */137#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))138139#if !defined(__x86_64__) && !defined(__i386__)140/* Definitions to generate Intel SVR4-like core files. These mostly141have the same names as the SVR4 types with "elf_" tacked on the142front to prevent clashes with Linux definitions, and the typedef143forms have been avoided. This is mostly like the SVR4 structure,144but more Linuxy, with things that Linux does not support and which145GDB doesn't really use excluded. */146struct elf_prstatus147{148struct elf_siginfo pr_info; /* Info associated with signal. */149short int pr_cursig; /* Current signal. */150unsigned long int pr_sigpend; /* Set of pending signals. */151unsigned long int pr_sighold; /* Set of held signals. */152__pid_t pr_pid;153__pid_t pr_ppid;154__pid_t pr_pgrp;155__pid_t pr_sid;156struct timeval pr_utime; /* User time. */157struct timeval pr_stime; /* System time. */158struct timeval pr_cutime; /* Cumulative user time. */159struct timeval pr_cstime; /* Cumulative system time. */160elf_gregset_t pr_reg; /* GP registers. */161int pr_fpvalid; /* True if math copro being used. */162};163164#define ELF_PRARGSZ (80) /* Number of chars for args. */165struct elf_prpsinfo166{167char pr_state; /* Numeric process state. */168char pr_sname; /* Char for pr_state. */169char pr_zomb; /* Zombie. */170char pr_nice; /* Nice val. */171unsigned long int pr_flag; /* Flags. */172#if __WORDSIZE == 32173unsigned short int pr_uid;174unsigned short int pr_gid;175#else176unsigned int pr_uid;177unsigned int pr_gid;178#endif179int pr_pid, pr_ppid, pr_pgrp, pr_sid;180/* Lots missing */181char pr_fname[16]; /* Filename of executable. */182char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */183};184185/* The rest of this file provides the types for emulation of the186Solaris <proc_service.h> interfaces that should be implemented by187users of libthread_db. */188189/* Addresses. */190typedef void *psaddr_t;191192/* We don't have any differences between processes and threads,193therefore have only one PID type. */194typedef __pid_t lwpid_t;195196/* Register sets. Linux has different names. */197typedef elf_gregset_t prgregset_t;198typedef elf_fpregset_t prfpregset_t;199200#endif // !__x86_64__ && !__i386__201202/* Process status and info. In the end we do provide typedefs for them. */203typedef struct elf_prstatus prstatus_t;204typedef struct elf_prpsinfo prpsinfo_t;205206__END_DECLS207208#endif /* sys/procfs.h */209210211