summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/sparc64/sys
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/sparc64/sys')
-rw-r--r--libc/sysdeps/linux/sparc64/sys/procfs.h121
-rw-r--r--libc/sysdeps/linux/sparc64/sys/ptrace.h235
-rw-r--r--libc/sysdeps/linux/sparc64/sys/ucontext.h198
-rw-r--r--libc/sysdeps/linux/sparc64/sys/user.h83
4 files changed, 637 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/sparc64/sys/procfs.h b/libc/sysdeps/linux/sparc64/sys/procfs.h
new file mode 100644
index 000000000..c1dfb1980
--- /dev/null
+++ b/libc/sysdeps/linux/sparc64/sys/procfs.h
@@ -0,0 +1,121 @@
+/* Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_PROCFS_H
+#define _SYS_PROCFS_H 1
+
+/* This is somehow modelled after the file of the same name on SysVr4
+ systems. It provides a definition of the core file format for ELF
+ used on Linux. */
+
+#include <features.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/ucontext.h>
+#include <sys/user.h>
+#include <bits/wordsize.h>
+
+__BEGIN_DECLS
+
+#define ELF_NGREG 38
+
+typedef struct
+ {
+ union
+ {
+ unsigned long pr_regs[32];
+ double pr_dregs[16];
+ } pr_fr;
+ unsigned long __unused;
+ unsigned long pr_fsr;
+ unsigned char pr_qcnt;
+ unsigned char pr_q_entrysize;
+ unsigned char pr_en;
+ unsigned int pr_q[64];
+ } elf_fpregset_t;
+
+typedef unsigned long elf_greg_t;
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+struct elf_siginfo
+ {
+ int si_signo; /* Signal number. */
+ int si_code; /* Extra code. */
+ int si_errno; /* Errno. */
+ };
+
+/* Definitions to generate Intel SVR4-like core files. These mostly
+ have the same names as the SVR4 types with "elf_" tacked on the
+ front to prevent clashes with linux definitions, and the typedef
+ forms have been avoided. This is mostly like the SVR4 structure,
+ but more Linuxy, with things that Linux does not support and which
+ gdb doesn't really use excluded. Fields present but not used are
+ marked with "XXX". */
+struct elf_prstatus
+ {
+ struct elf_siginfo pr_info; /* Info associated with signal. */
+ short int pr_cursig; /* Current signal. */
+ unsigned long int pr_sigpend; /* Set of pending signals. */
+ unsigned long int pr_sighold; /* Set of held signals. */
+ __pid_t pr_pid;
+ __pid_t pr_ppid;
+ __pid_t pr_pgrp;
+ __pid_t pr_sid;
+ struct timeval pr_utime; /* User time. */
+ struct timeval pr_stime; /* System time. */
+ struct timeval pr_cutime; /* Cumulative user time. */
+ struct timeval pr_cstime; /* Cumulative system time. */
+ elf_gregset_t pr_reg; /* GP registers. */
+ int pr_fpvalid; /* True if math copro being used. */
+ };
+
+
+#define ELF_PRARGSZ (80) /* Number of chars for args */
+
+struct elf_prpsinfo
+ {
+ char pr_state; /* Numeric process state. */
+ char pr_sname; /* Char for pr_state. */
+ char pr_zomb; /* Zombie. */
+ char pr_nice; /* Nice val. */
+ unsigned long int pr_flag; /* Flags. */
+ unsigned short int pr_uid;
+ unsigned short int pr_gid;
+ int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+ /* Lots missing */
+ char pr_fname[16]; /* Filename of executable. */
+ char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
+ };
+
+/* Addresses. */
+typedef void *psaddr_t;
+
+/* Register sets. Linux has different names. */
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
+
+/* We don't have any differences between processes and threads,
+ therefore have only one PID type. */
+typedef __pid_t lwpid_t;
+
+
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+__END_DECLS
+
+#endif /* sys/procfs.h */
diff --git a/libc/sysdeps/linux/sparc64/sys/ptrace.h b/libc/sysdeps/linux/sparc64/sys/ptrace.h
new file mode 100644
index 000000000..cd6675d22
--- /dev/null
+++ b/libc/sysdeps/linux/sparc64/sys/ptrace.h
@@ -0,0 +1,235 @@
+/* `ptrace' debugger support interface. Linux/SPARC version.
+ Copyright (C) 1996-2014 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_PTRACE_H
+#define _SYS_PTRACE_H 1
+
+#include <features.h>
+#include <bits/types.h>
+
+/* Linux/SPARC kernels up to 2.3.18 do not care much
+ about what namespace polution, so use a kludge now. */
+#undef PTRACE_GETREGS
+#undef PTRACE_SETREGS
+#undef PTRACE_GETFPREGS
+#undef PTRACE_SETFPREGS
+#undef PTRACE_READDATA
+#undef PTRACE_WRITEDATA
+#undef PTRACE_READTEXT
+#undef PTRACE_WRITETEXT
+#undef PTRACE_SUNDETACH
+
+__BEGIN_DECLS
+
+/* Type of the REQUEST argument to `ptrace.' */
+enum __ptrace_request
+{
+ /* Indicate that the process making this request should be traced.
+ All signals received by this process can be intercepted by its
+ parent, and its parent can use the other `ptrace' requests. */
+ PTRACE_TRACEME = 0,
+#define PT_TRACE_ME PTRACE_TRACEME
+
+ /* Return the word in the process's text space at address ADDR. */
+ PTRACE_PEEKTEXT = 1,
+#define PT_READ_I PTRACE_PEEKTEXT
+
+ /* Return the word in the process's data space at address ADDR. */
+ PTRACE_PEEKDATA = 2,
+#define PT_READ_D PTRACE_PEEKDATA
+
+ /* Return the word in the process's user area at offset ADDR. */
+ PTRACE_PEEKUSER = 3,
+#define PT_READ_U PTRACE_PEEKUSER
+
+ /* Write the word DATA into the process's text space at address ADDR. */
+ PTRACE_POKETEXT = 4,
+#define PT_WRITE_I PTRACE_POKETEXT
+
+ /* Write the word DATA into the process's data space at address ADDR. */
+ PTRACE_POKEDATA = 5,
+#define PT_WRITE_D PTRACE_POKEDATA
+
+ /* Write the word DATA into the process's user area at offset ADDR. */
+ PTRACE_POKEUSER = 6,
+#define PT_WRITE_U PTRACE_POKEUSER
+
+ /* Continue the process. */
+ PTRACE_CONT = 7,
+#define PT_CONTINUE PTRACE_CONT
+
+ /* Kill the process. */
+ PTRACE_KILL = 8,
+#define PT_KILL PTRACE_KILL
+
+ /* Single step the process.
+ This is not supported on all machines. */
+ PTRACE_SINGLESTEP = 9,
+#define PT_STEP PTRACE_SINGLESTEP
+
+ /* Detach from a process attached to with PTRACE_ATTACH. */
+ PTRACE_DETACH = 11,
+#define PT_DETACH PTRACE_DETACH
+
+ /* This define is needed for older programs which were
+ trying to work around sparc-linux ptrace nastiness. */
+#define PTRACE_SUNDETACH PTRACE_DETACH
+
+ /* Attach to a process that is already running. */
+ PTRACE_ATTACH = 16,
+#define PT_ATTACH PTRACE_ATTACH
+
+ /* Write several bytes at a time. */
+ PTRACE_WRITEDATA = 17,
+#define PTRACE_WRITEDATA PTRACE_WRITEDATA
+
+ /* Read several bytes at a time. */
+ PTRACE_READTEXT = 18,
+#define PTRACE_READTEXT PTRACE_READTEXT
+#define PTRACE_READDATA PTRACE_READTEXT
+
+ /* Write several bytes at a time. */
+ PTRACE_WRITETEXT = 19,
+#define PTRACE_WRITETEXT PTRACE_WRITETEXT
+
+ /* Get all general purpose registers used by a processes.
+ This is not supported on all machines. */
+ PTRACE_GETREGS = 22,
+#define PT_GETREGS PTRACE_GETREGS
+
+ /* Set all general purpose registers used by a processes.
+ This is not supported on all machines. */
+ PTRACE_SETREGS = 23,
+#define PT_SETREGS PTRACE_SETREGS
+
+ /* Continue and stop at the next (return from) syscall. */
+ PTRACE_SYSCALL = 24,
+#define PTRACE_SYSCALL PTRACE_SYSCALL
+
+ /* Get all floating point registers used by a processes.
+ This is not supported on all machines. */
+ PTRACE_GETFPREGS = 25,
+#define PT_GETFPREGS PTRACE_GETFPREGS
+
+ /* Set all floating point registers used by a processes.
+ This is not supported on all machines. */
+ PTRACE_SETFPREGS = 26,
+#define PT_SETFPREGS PTRACE_SETFPREGS
+
+ /* Set ptrace filter options. */
+ PTRACE_SETOPTIONS = 0x4200,
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+
+ /* Get last ptrace message. */
+ PTRACE_GETEVENTMSG = 0x4201,
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+
+ /* Get siginfo for process. */
+ PTRACE_GETSIGINFO = 0x4202,
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+
+ /* Set new siginfo for process. */
+ PTRACE_SETSIGINFO = 0x4203,
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
+
+ /* Get register content. */
+ PTRACE_GETREGSET = 0x4204,
+#define PTRACE_GETREGSET PTRACE_GETREGSET
+
+ /* Set register content. */
+ PTRACE_SETREGSET = 0x4205,
+#define PTRACE_SETREGSET PTRACE_SETREGSET
+
+ /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect
+ signal or group stop state. */
+ PTRACE_SEIZE = 0x4206,
+#define PTRACE_SEIZE PTRACE_SEIZE
+
+ /* Trap seized tracee. */
+ PTRACE_INTERRUPT = 0x4207,
+#define PTRACE_INTERRUPT PTRACE_INTERRUPT
+
+ /* Wait for next group event. */
+ PTRACE_LISTEN = 0x4208,
+#define PTRACE_LISTEN PTRACE_LISTEN
+
+ PTRACE_PEEKSIGINFO = 0x4209
+#define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO
+};
+
+
+/* Flag for PTRACE_LISTEN. */
+enum __ptrace_flags
+{
+ PTRACE_SEIZE_DEVEL = 0x80000000
+};
+
+/* Options set using PTRACE_SETOPTIONS. */
+enum __ptrace_setoptions
+{
+ PTRACE_O_TRACESYSGOOD = 0x00000001,
+ PTRACE_O_TRACEFORK = 0x00000002,
+ PTRACE_O_TRACEVFORK = 0x00000004,
+ PTRACE_O_TRACECLONE = 0x00000008,
+ PTRACE_O_TRACEEXEC = 0x00000010,
+ PTRACE_O_TRACEVFORKDONE = 0x00000020,
+ PTRACE_O_TRACEEXIT = 0x00000040,
+ PTRACE_O_TRACESECCOMP = 0x00000080,
+ PTRACE_O_EXITKILL = 0x00100000,
+ PTRACE_O_MASK = 0x001000ff
+};
+
+/* Wait extended result codes for the above trace options. */
+enum __ptrace_eventcodes
+{
+ PTRACE_EVENT_FORK = 1,
+ PTRACE_EVENT_VFORK = 2,
+ PTRACE_EVENT_CLONE = 3,
+ PTRACE_EVENT_EXEC = 4,
+ PTRACE_EVENT_VFORK_DONE = 5,
+ PTRACE_EVENT_EXIT = 6,
+ PTRACE_EVENT_SECCOMP = 7
+};
+
+/* Arguments for PTRACE_PEEKSIGINFO. */
+struct __ptrace_peeksiginfo_args
+{
+ __uint64_t off; /* From which siginfo to start. */
+ __uint32_t flags; /* Flags for peeksiginfo. */
+ __int32_t nr; /* How many siginfos to take. */
+};
+
+enum __ptrace_peeksiginfo_flags
+{
+ /* Read signals from a shared (process wide) queue. */
+ PTRACE_PEEKSIGINFO_SHARED = (1 << 0)
+};
+
+/* Perform process tracing functions. REQUEST is one of the values
+ above, and determines the action to be taken.
+ For all requests except PTRACE_TRACEME, PID specifies the process to be
+ traced.
+
+ PID and the other arguments described above for the various requests should
+ appear (those that are used for the particular request) as:
+ pid_t PID, void *ADDR, int DATA, void *ADDR2
+ after REQUEST. */
+extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
+
+__END_DECLS
+
+#endif /* _SYS_PTRACE_H */
diff --git a/libc/sysdeps/linux/sparc64/sys/ucontext.h b/libc/sysdeps/linux/sparc64/sys/ucontext.h
new file mode 100644
index 000000000..879bd7c58
--- /dev/null
+++ b/libc/sysdeps/linux/sparc64/sys/ucontext.h
@@ -0,0 +1,198 @@
+/* Copyright (C) 1998-2017 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H 1
+
+#include <features.h>
+#include <signal.h>
+
+#define MC_TSTATE 0
+#define MC_PC 1
+#define MC_NPC 2
+#define MC_Y 3
+#define MC_G1 4
+#define MC_G2 5
+#define MC_G3 6
+#define MC_G4 7
+#define MC_G5 8
+#define MC_G6 9
+#define MC_G7 10
+#define MC_O0 11
+#define MC_O1 12
+#define MC_O2 13
+#define MC_O3 14
+#define MC_O4 15
+#define MC_O5 16
+#define MC_O6 17
+#define MC_O7 18
+#define MC_NGREG 19
+
+typedef unsigned long mc_greg_t;
+typedef mc_greg_t mc_gregset_t[MC_NGREG];
+
+#define MC_MAXFPQ 16
+struct mc_fq {
+ unsigned long *mcfq_addr;
+ unsigned int mcfq_insn;
+};
+
+struct mc_fpu {
+ union {
+ unsigned int sregs[32];
+ unsigned long dregs[32];
+ long double qregs[16];
+ } mcfpu_fregs;
+ unsigned long mcfpu_fsr;
+ unsigned long mcfpu_fprs;
+ unsigned long mcfpu_gsr;
+ struct mc_fq *mcfpu_fq;
+ unsigned char mcfpu_qcnt;
+ unsigned char mcfpu_qentsz;
+ unsigned char mcfpu_enab;
+};
+typedef struct mc_fpu mc_fpu_t;
+
+typedef struct {
+ mc_gregset_t mc_gregs;
+ mc_greg_t mc_fp;
+ mc_greg_t mc_i7;
+ mc_fpu_t mc_fpregs;
+} mcontext_t;
+
+typedef struct ucontext {
+ struct ucontext *uc_link;
+ unsigned long uc_flags;
+ unsigned long __uc_sigmask;
+ mcontext_t uc_mcontext;
+ stack_t uc_stack;
+ __sigset_t uc_sigmask;
+} ucontext_t;
+
+/*
+ * Location of the users' stored registers relative to R0.
+ * Usage is as an index into a gregset_t array or as u.u_ar0[XX].
+ */
+#define REG_PSR (0)
+#define REG_PC (1)
+#define REG_nPC (2)
+#define REG_Y (3)
+#define REG_G1 (4)
+#define REG_G2 (5)
+#define REG_G3 (6)
+#define REG_G4 (7)
+#define REG_G5 (8)
+#define REG_G6 (9)
+#define REG_G7 (10)
+#define REG_O0 (11)
+#define REG_O1 (12)
+#define REG_O2 (13)
+#define REG_O3 (14)
+#define REG_O4 (15)
+#define REG_O5 (16)
+#define REG_O6 (17)
+#define REG_O7 (18)
+
+/*
+ * A gregset_t is defined as an array type for compatibility with the reference
+ * source. This is important due to differences in the way the C language
+ * treats arrays and structures as parameters.
+ *
+ * Note that NGREG is really (sizeof (struct regs) / sizeof (greg_t)),
+ * but that the ABI defines it absolutely to be 21 (resp. 19).
+ */
+
+
+#define REG_ASI (19)
+#define REG_FPRS (20)
+
+#define NGREG 21
+typedef long greg_t;
+typedef greg_t gregset_t[NGREG];
+
+/*
+ * The following structures define how a register window can appear on the
+ * stack. This structure is available (when required) through the `gwins'
+ * field of an mcontext (nested within ucontext). SPARC_MAXWINDOW is the
+ * maximum number of outstanding regiters window defined in the SPARC
+ * architecture (*not* implementation).
+ */
+#define SPARC_MAXREGWINDOW 31 /* max windows in SPARC arch. */
+struct rwindow
+ {
+ greg_t rw_local[8]; /* locals */
+ greg_t rw_in[8]; /* ins */
+ };
+
+#define rw_fp rw_in[6] /* frame pointer */
+#define rw_rtn rw_in[7] /* return address */
+
+typedef struct gwindows
+ {
+ int wbcnt;
+ int *spbuf[SPARC_MAXREGWINDOW];
+ struct rwindow wbuf[SPARC_MAXREGWINDOW];
+ } gwindows_t;
+
+/*
+ * Floating point definitions.
+ */
+
+#define MAXFPQ 16 /* max # of fpu queue entries currently supported */
+
+/*
+ * struct fq defines the minimal format of a floating point instruction queue
+ * entry. The size of entries in the floating point queue are implementation
+ * dependent. The union FQu is guarenteed to be the first field in any ABI
+ * conformant system implementation. Any additional fields provided by an
+ * implementation should not be used applications designed to be ABI conformant. */
+
+struct fpq
+ {
+ unsigned long *fpq_addr; /* address */
+ unsigned long fpq_instr; /* instruction */
+ };
+
+struct fq
+ {
+ union /* FPU inst/addr queue */
+ {
+ double whole;
+ struct fpq fpq;
+ } FQu;
+ };
+
+#define FPU_REGS_TYPE unsigned
+#define FPU_DREGS_TYPE unsigned long long
+#define V7_FPU_FSR_TYPE unsigned
+#define V9_FPU_FSR_TYPE unsigned long long
+#define V9_FPU_FPRS_TYPE unsigned
+
+typedef struct fpu
+ {
+ union { /* FPU floating point regs */
+ unsigned fpu_regs[32]; /* 32 singles */
+ double fpu_dregs[32]; /* 32 doubles */
+ long double fpu_qregs[16]; /* 16 quads */
+ } fpu_fr;
+ struct fq *fpu_q; /* ptr to array of FQ entries */
+ unsigned long fpu_fsr; /* FPU status register */
+ unsigned char fpu_qcnt; /* # of entries in saved FQ */
+ unsigned char fpu_q_entrysize; /* # of bytes per FQ entry */
+ unsigned char fpu_en; /* flag signifying fpu in use */
+ } fpregset_t;
+
+#endif /* sys/ucontext.h */
diff --git a/libc/sysdeps/linux/sparc64/sys/user.h b/libc/sysdeps/linux/sparc64/sys/user.h
new file mode 100644
index 000000000..905f43b75
--- /dev/null
+++ b/libc/sysdeps/linux/sparc64/sys/user.h
@@ -0,0 +1,83 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_USER_H
+#define _SYS_USER_H 1
+
+struct sunos_regs
+{
+ unsigned int psr, pc, npc, y;
+ unsigned int regs[15];
+};
+
+struct sunos_fpqueue
+{
+ unsigned int *addr;
+ unsigned int inst;
+};
+
+struct sunos_fp
+{
+ union
+ {
+ unsigned int regs[32];
+ double reg_dbls[16];
+ } fregs;
+ unsigned int fsr;
+ unsigned int flags;
+ unsigned int extra;
+ unsigned int fpq_count;
+ struct sunos_fpqueue fpq[16];
+};
+
+struct sunos_fpu
+{
+ struct sunos_fp fpstatus;
+};
+
+/* The SunOS core file header layout. */
+struct user {
+ unsigned int magic;
+ unsigned int len;
+ struct sunos_regs regs;
+ struct
+ {
+ unsigned char a_dynamic :1;
+ unsigned char a_toolversion :7;
+ unsigned char a_machtype;
+ unsigned short a_info;
+ unsigned int a_text;
+ unsigned int a_data;
+ unsigned int a_bss;
+ unsigned int a_syms;
+ unsigned int a_entry;
+ unsigned int a_trsize;
+ unsigned int a_drsize;
+ } uexec;
+ int signal;
+ size_t u_tsize;
+ size_t u_dsize;
+ size_t u_ssize;
+ char u_comm[17];
+ struct sunos_fpu fpu;
+ unsigned int sigcode;
+};
+
+#define NBPG 0x2000
+#define UPAGES 1
+#define SUNOS_CORE_MAGIC 0x080456
+
+#endif