summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/tile/sys
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2018-02-04 15:34:18 +0000
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2018-03-12 20:11:14 +0100
commit490e84f5e146485a26dea2f41279a4ff13aaca05 (patch)
tree03b9eab7297c5ad571b548b5ed916f17be78bf48 /libc/sysdeps/linux/tile/sys
parent6e627523ee4b3fc00c30dcff74c2adf93e2b6840 (diff)
tile: add basic support for tilegx
This adds basic support for tile architecture. Only static binaries, no ld.so or threading support. Tested with qemu-tilegx only.
Diffstat (limited to 'libc/sysdeps/linux/tile/sys')
-rw-r--r--libc/sysdeps/linux/tile/sys/cachectl.h34
-rw-r--r--libc/sysdeps/linux/tile/sys/procfs.h126
-rw-r--r--libc/sysdeps/linux/tile/sys/ptrace.h198
-rw-r--r--libc/sysdeps/linux/tile/sys/reg.h2
-rw-r--r--libc/sysdeps/linux/tile/sys/ucontext.h96
-rw-r--r--libc/sysdeps/linux/tile/sys/user.h1
6 files changed, 457 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/tile/sys/cachectl.h b/libc/sysdeps/linux/tile/sys/cachectl.h
new file mode 100644
index 000000000..14ce52f47
--- /dev/null
+++ b/libc/sysdeps/linux/tile/sys/cachectl.h
@@ -0,0 +1,34 @@
+/* Copyright (C) 2011-2018 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_CACHECTL_H
+#define _SYS_CACHECTL_H 1
+
+#include <features.h>
+
+/* Get the kernel definition for the op bits. */
+#include <asm/cachectl.h>
+
+__BEGIN_DECLS
+
+#ifdef __USE_MISC
+extern int cacheflush (void *__addr, const int __nbytes, const int __op) __THROW;
+#endif
+extern int _flush_cache (char *__addr, const int __nbytes, const int __op) __THROW;
+
+__END_DECLS
+
+#endif /* sys/cachectl.h */
diff --git a/libc/sysdeps/linux/tile/sys/procfs.h b/libc/sysdeps/linux/tile/sys/procfs.h
new file mode 100644
index 000000000..8af94bab7
--- /dev/null
+++ b/libc/sysdeps/linux/tile/sys/procfs.h
@@ -0,0 +1,126 @@
+/* Copyright (C) 2011-2018 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 somewhat modelled after the file of the same name on SVR4
+ systems. It provides a definition of the core file format for ELF
+ used on Linux. It doesn't have anything to do with the /proc file
+ system, even though Linux has one.
+
+ Anyway, the whole purpose of this file is for GDB and GDB only.
+ Don't read too much into it. Don't use it for anything other than
+ GDB unless you know what you are doing. */
+
+#include <features.h>
+#include <sys/time.h>
+#include <sys/types.h>
+
+#define __need_int_reg_t
+#include <arch/abi.h>
+
+__BEGIN_DECLS
+
+/* Type for a general-purpose register. */
+typedef __uint_reg_t elf_greg_t;
+
+/* And the whole bunch of them. We could have used `struct pt_regs'
+ from <asm/ptrace.h> directly in the typedef, but tradition says that
+ the register set is an array, which does have some peculiar
+ semantics, so leave it that way. */
+#define ELF_NGREG 64
+#define ELF_NFPREG 0
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+typedef elf_greg_t elf_fpregset_t[ELF_NFPREG];
+
+/* Signal info. */
+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. */
+
+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 int pr_uid;
+ unsigned 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. */
+ };
+
+
+/* The rest of this file provides the types for emulation of the
+ Solaris <proc_service.h> interfaces that should be implemented by
+ users of libthread_db. */
+
+/* Addresses. */
+typedef void *psaddr_t;
+
+/* Register sets. Linux has different names. */
+typedef elf_gregset_t prgregset_t;
+
+/* Provide dummy declaration here; we don't have FP registers. */
+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;
+
+/* Process status and info. In the end we do provide typedefs for them. */
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+__END_DECLS
+
+#endif /* sys/procfs.h */
diff --git a/libc/sysdeps/linux/tile/sys/ptrace.h b/libc/sysdeps/linux/tile/sys/ptrace.h
new file mode 100644
index 000000000..94fe60f6f
--- /dev/null
+++ b/libc/sysdeps/linux/tile/sys/ptrace.h
@@ -0,0 +1,198 @@
+/* `ptrace' debugger support interface. Linux/Tile version.
+ Copyright (C) 2011-2018 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>
+
+__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. */
+ PTRACE_SINGLESTEP = 9,
+#define PT_STEP PTRACE_SINGLESTEP
+
+ /* Get all general purpose registers used by a processes. */
+ PTRACE_GETREGS = 12,
+#define PT_GETREGS PTRACE_GETREGS
+
+ /* Set all general purpose registers used by a processes. */
+ PTRACE_SETREGS = 13,
+#define PT_SETREGS PTRACE_SETREGS
+
+ /* Attach to a process that is already running. */
+ PTRACE_ATTACH = 16,
+#define PT_ATTACH PTRACE_ATTACH
+
+ /* Detach from a process attached to with PTRACE_ATTACH. */
+ PTRACE_DETACH = 17,
+#define PT_DETACH PTRACE_DETACH
+
+ /* Continue and stop at the next entry to or return from syscall. */
+ PTRACE_SYSCALL = 24,
+#define PT_SYSCALL PTRACE_SYSCALL
+
+ /* 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
+
+ /* 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
+
+ /* Retrieve siginfo_t structures without removing signals from a queue. */
+ PTRACE_PEEKSIGINFO = 0x4209,
+#define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO
+
+ /* Get the mask of blocked signals. */
+ PTRACE_GETSIGMASK = 0x420a,
+#define PTRACE_GETSIGMASK PTRACE_GETSIGMASK
+
+ /* Change the mask of blocked signals. */
+ PTRACE_SETSIGMASK = 0x420b,
+#define PTRACE_SETSIGMASK PTRACE_SETSIGMASK
+
+ /* Get seccomp BPF filters. */
+ PTRACE_SECCOMP_GET_FILTER = 0x420c
+#define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
+};
+
+/* 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_SUSPEND_SECCOMP = 0x00200000,
+ PTRACE_O_MASK = 0x003000ff
+};
+
+enum __ptrace_eventcodes
+{
+/* Wait extended result codes for the above trace options. */
+ 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,
+/* Extended result codes enabled by means other than options. */
+ PTRACE_EVENT_STOP = 128
+};
+
+/* 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/tile/sys/reg.h b/libc/sysdeps/linux/tile/sys/reg.h
new file mode 100644
index 000000000..1ab17ce82
--- /dev/null
+++ b/libc/sysdeps/linux/tile/sys/reg.h
@@ -0,0 +1,2 @@
+/* The traditional purpose of "sys/reg.h" is satisfied by "arch/abi.h". */
+#include <arch/abi.h>
diff --git a/libc/sysdeps/linux/tile/sys/ucontext.h b/libc/sysdeps/linux/tile/sys/ucontext.h
new file mode 100644
index 000000000..ed2c27b58
--- /dev/null
+++ b/libc/sysdeps/linux/tile/sys/ucontext.h
@@ -0,0 +1,96 @@
+/* Copyright (C) 2011-2018 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>
+#include <bits/sigcontext.h>
+
+#ifdef __USE_MISC
+# define __ctx(fld) fld
+#else
+# define __ctx(fld) __ ## fld
+#endif
+
+#ifdef __USE_MISC
+/* Get register type and register names. */
+# include <arch/abi.h>
+
+
+/* Type for general register. */
+typedef uint_reg_t greg_t;
+
+/* Number of general registers. Must agree with <asm/ptrace.h>. */
+# define NGREG 64
+
+/* Container for all general registers. */
+typedef greg_t gregset_t[NGREG];
+#endif
+
+#ifdef __USE_GNU
+/* Names for interesting registers in the `gregset_t' array. */
+enum
+{
+ /* ... r0 through r51 are just 0 through 51 ... */
+ REG_FP = TREG_FP,
+# define REG_FP REG_FP
+ REG_TP = TREG_TP,
+# define REG_TP REG_TP
+ REG_SP = TREG_SP,
+# define REG_SP REG_SP
+ REG_LR = TREG_LR,
+# define REG_LR REG_LR
+};
+#endif
+
+#define __need_int_reg_t
+#include <arch/abi.h>
+
+/* A machine context is exactly a sigcontext. */
+typedef struct
+ {
+ __extension__ union
+ {
+ __uint_reg_t __ctx(gregs)[56];
+ __extension__ struct
+ {
+ __uint_reg_t __ctx(__gregs)[53];
+ __uint_reg_t __ctx(tp);
+ __uint_reg_t __ctx(sp);
+ __uint_reg_t __ctx(lr);
+ };
+ };
+ __uint_reg_t __ctx(pc);
+ __uint_reg_t __ctx(ics);
+ __uint_reg_t __ctx(faultnum);
+ __uint_reg_t __glibc_reserved1[5];
+ } mcontext_t;
+
+/* Userlevel context. */
+typedef struct ucontext_t
+ {
+ unsigned long int __ctx(uc_flags);
+ struct ucontext_t *uc_link;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ sigset_t uc_sigmask;
+ } ucontext_t;
+
+#undef __ctx
+
+#endif /* sys/ucontext.h */
diff --git a/libc/sysdeps/linux/tile/sys/user.h b/libc/sysdeps/linux/tile/sys/user.h
new file mode 100644
index 000000000..c871f1a03
--- /dev/null
+++ b/libc/sysdeps/linux/tile/sys/user.h
@@ -0,0 +1 @@
+/* This file is not needed, but in practice gdb might try to include it. */