From 05d9958f685e3f0c51be4f1128348645451e51fb Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Tue, 21 Dec 2004 08:35:58 +0000 Subject: Add support for the Analog Devices Blackfin mmuless processor --- libc/sysdeps/linux/bfin/sys/elf.h | 26 ++++++ libc/sysdeps/linux/bfin/sys/io.h | 48 +++++++++++ libc/sysdeps/linux/bfin/sys/procfs.h | 125 +++++++++++++++++++++++++++ libc/sysdeps/linux/bfin/sys/reg.h | 133 ++++++++++++++++++++++++++++ libc/sysdeps/linux/bfin/sys/ucontext.h | 153 +++++++++++++++++++++++++++++++++ 5 files changed, 485 insertions(+) create mode 100644 libc/sysdeps/linux/bfin/sys/elf.h create mode 100644 libc/sysdeps/linux/bfin/sys/io.h create mode 100644 libc/sysdeps/linux/bfin/sys/procfs.h create mode 100644 libc/sysdeps/linux/bfin/sys/reg.h create mode 100644 libc/sysdeps/linux/bfin/sys/ucontext.h (limited to 'libc/sysdeps/linux/bfin/sys') diff --git a/libc/sysdeps/linux/bfin/sys/elf.h b/libc/sysdeps/linux/bfin/sys/elf.h new file mode 100644 index 000000000..d959cdca1 --- /dev/null +++ b/libc/sysdeps/linux/bfin/sys/elf.h @@ -0,0 +1,26 @@ +/* Copyright (C) 1998, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_ELF_H +#define _SYS_ELF_H 1 + +#warning "This header is obsolete; use instead." + +#include + +#endif /* _SYS_ELF_H */ diff --git a/libc/sysdeps/linux/bfin/sys/io.h b/libc/sysdeps/linux/bfin/sys/io.h new file mode 100644 index 000000000..68639902c --- /dev/null +++ b/libc/sysdeps/linux/bfin/sys/io.h @@ -0,0 +1,48 @@ +/* Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_IO_H + +#define _SYS_IO_H 1 +#include + +__BEGIN_DECLS + +/* If TURN_ON is TRUE, request for permission to do direct i/o on the + port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O + permission off for that range. This call requires root privileges. */ +extern int ioperm (unsigned long int __from, unsigned long int __num, + int __turn_on) __THROW; + +/* Set the I/O privilege level to LEVEL. If LEVEL is nonzero, + permission to access any I/O port is granted. This call requires + root privileges. */ +extern int iopl (int __level) __THROW; + +/* The functions that actually perform reads and writes. */ +extern unsigned char inb (unsigned long int port) __THROW; +extern unsigned short int inw (unsigned long int port) __THROW; +extern unsigned long int inl (unsigned long int port) __THROW; + +extern void outb (unsigned char value, unsigned long int port) __THROW; +extern void outw (unsigned short value, unsigned long int port) __THROW; +extern void outl (unsigned long value, unsigned long int port) __THROW; + +__END_DECLS + +#endif /* _SYS_IO_H */ diff --git a/libc/sysdeps/linux/bfin/sys/procfs.h b/libc/sysdeps/linux/bfin/sys/procfs.h new file mode 100644 index 000000000..a656d86b2 --- /dev/null +++ b/libc/sysdeps/linux/bfin/sys/procfs.h @@ -0,0 +1,125 @@ +/* Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#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 +#include +#include +#include + +__BEGIN_DECLS + +/* Type for a general-purpose register. */ +typedef unsigned long elf_greg_t; + +/* And the whole bunch of them. We could have used `struct + user_regs_struct' 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 (sizeof (struct user_regs_struct) / sizeof(elf_greg_t)) +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +/* Register set for the floating-point registers. */ +typedef struct user_bfinfp_struct elf_fpregset_t; + +/* 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 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. */ + }; + + +/* The rest of this file provides the types for emulation of the + Solaris 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; +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/bfin/sys/reg.h b/libc/sysdeps/linux/bfin/sys/reg.h new file mode 100644 index 000000000..4ce6e15aa --- /dev/null +++ b/libc/sysdeps/linux/bfin/sys/reg.h @@ -0,0 +1,133 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_REG_H +#define _SYS_REG_H 1 + +/* Index into an array of 4 byte integers returned from ptrace for + location of the users' stored general purpose registers. */ + +enum +{ + PT_IPEND = 0, +#define PT_IPEND PT_IPEND + PT_SYSCFG = 4, +#define PT_SYSCFG PT_SYSCFG + PT_SR = 8, +#define PT_SR PT_SR + PT_RETE = 12, +#define PT_RETE PT_RETE + PT_RETN = 16, +#define PT_RETN PT_RETN + PT_RETX = 20, +#define PT_RETX PT_RETX + PT_PC = 24, +#define PT_PC PT_PC + PT_RETS = 28, +#define PT_RETS PT_RETS + PT_ASTAT = 32, +#define PT_ASTAT PT_ASTAT + PT_LB1 = 40, +#define PT_LB1 PT_LB1 + PT_LB0 = 44, +#define PT_LB0 PT_LB0 + PT_LT1 = 48, +#define PT_LT1 PT_LT1 + PT_LT0 = 52, +#define PT_LT0 PT_LT0 + PT_LC1 = 56, +#define PT_LC1 PT_LC1 + PT_LC0 = 60, +#define PT_LC0 PT_LC0 + PT_A1W = 64, +#define PT_A1W PT_A1W + PT_A1X = 68, +#define PT_A1X PT_A1X + PT_A0W = 72, +#define PT_A0W PT_A0W + PT_A0X = 76, +#define PT_A0X PT_A0X + PT_B3 = 80, +#define PT_B# PT_B3 + PT_B2 = 84, +#define PT_B2 PT_B2 + PT_B1 = 88, +#define PT_B1 PT_B1 + PT_B0 = 92, +#define PT_B0 PT_B0 + PT_L3 = 96, +#define PT_L3 PT_L3 + PT_L2 = 100, +#define PT_L2 PT_L2 + PT_L1 = 104, +#define PT_L1 PT_L1 + PT_L0 = 108, +#define PT_L0 PT_L0 + PT_M3 = 112, +#define PT_M3 PT_M3 + PT_M2 = 116, +#define PT_M2 PT_M2 + PT_M1 = 120, +#define PT_M1 PT_M1 + PT_M0 = 124, +#define PT_M0 PT_M0 + PT_I3 = 128, +#define PT_I3 PT_I3 + PT_I2 = 132, +#define PT_I2 PT_I2 + PT_I1 = 136, +#define PT_I1 PT_I1 + PT_I0 = 140, +#define PT_I0 PT_I0 + PT_USP = 144, +#define PT_USP PT_USP + PT_FP = 148, +#define PT_FP PT_FP + PT_P5 = 152, +#define PT_P5 PT_P5 + PT_P4 = 156, +#define PT_P4 PT_P4 + PT_P3 = 160, +#define PT_P3 PT_P3 + PT_P2 = 164, +#define PT_P2 PT_P2 + PT_P1 = 168, +#define PT_P1 PT_P1 + PT_P0 = 172, +#define PT_P0 PT_P0 + PT_R7 = 176, +#define PT_R7 PT_R7 + PT_R6 = 180, +#define PT_R6 PT_R6 + PT_R5 = 184, +#define PT_R5 PT_R5 + PT_R4 = 188, +#define PT_R4 PT_R4 + PT_R3 = 192, +#define PT_R3 PT_R3 + PT_R2 = 196, +#define PT_R2 PT_R2 + PT_R1 = 200, +#define PT_R1 PT_R1 + PT_R0 = 204, +#define PT_R0 PT_R0 + PT_ORIG_R0 = 208, +#define PT_ORIG_R0 PT_ORIG_R0 +}; + +#endif /* _SYS_REG_H */ diff --git a/libc/sysdeps/linux/bfin/sys/ucontext.h b/libc/sysdeps/linux/bfin/sys/ucontext.h new file mode 100644 index 000000000..ac469daac --- /dev/null +++ b/libc/sysdeps/linux/bfin/sys/ucontext.h @@ -0,0 +1,153 @@ +/* Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* System V/blackfin ABI compliant context switching support. */ + +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 + +#include +#include + +/* Type for general register. */ +typedef int greg_t; + +/* Number of general registers. */ +#define NGREG 47 + +/* Container for all general registers. */ +typedef greg_t gregset_t[NGREG]; + +/* Number of each register is the `gregset_t' array. */ +enum +{ + R0 = 0, +#define R0 R0 + R1 = 1, +#define R1 R1 + R2 = 2, +#define R2 R2 + R3 = 3, +#define R3 R3 + R4 = 4, +#define R4 R4 + R5 = 5, +#define R5 R5 + R6 = 6, +#define R6 R6 + R7 = 7, +#define R7 R7 + P0 = 8, +#define P0 P0 + P1 = 9, +#define P1 P1 + P2 = 10, +#define P2 P2 + P3 = 11, +#define P3 P3 + P4 = 12, +#define P4 P4 + P5 = 13, +#define P5 P5 + USP = 14, +#define USP USP + A0W = 15, +#define A0W A0W + A1W = 16, +#define A1W A1W + A0X = 17, +#define A0X A0X + A1X = 18, +#define A1X A1X + ASTAT = 19, +#define ASTAT ASTAT + RETS = 20, +#define RETS RETS + PC= 21, +#define PC PC + RETX = 22, +#define RETX RETX + FP = 23, +#define FP FP + I0 = 24, +#define I0 I0 + I1 = 25, +#define I1 I1 + I2 = 26, +#define I2 I2 + I3 = 27, +#define I3 I3 + M0 = 28, +#define M0 M0 + M1 = 29, +#define M1 M1 + M2 = 30, +#define M2 M2 + M3 = 31, +#define M3 M3 + L0 = 32, +#define L0 L0 + L1 = 33, +#define L1 L1 + L2 = 34, +#define L2 L2 + L3 = 35, +#define L3 L3 + B_0 = 36, +#define B_0 B_0 + B1 = 37, +#define B1 B1 + B2 = 38, +#define B2 B2 + B3 = 39, +#define B3 B3 + LC0 = 40, +#define LC0 LC0 + LC1 = 41, +#define LC1 LC1 + LT0 = 42, +#define LT0 LT0 + LT1 = 43, +#define LT1 LT1 + LB0 = 44, +#define LB0 LB0 + LB1 = 45, +#define LB1 LB1 + SEQSTAT = 46 +#define SEQSTAT SEQSTAT +}; + +/* Context to describe whole processor state. */ +typedef struct +{ + int version; + gregset_t gregs; +} mcontext_t; + + +/* Userlevel context. */ +typedef struct ucontext +{ + unsigned long int uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; +} ucontext_t; + +#endif /* sys/ucontext.h */ -- cgit v1.2.3