diff options
| author | bhgv <bhgv.empire@gmail.com> | 2018-03-01 16:54:45 +0200 |
|---|---|---|
| committer | bhgv <bhgv.empire@gmail.com> | 2018-03-01 16:54:45 +0200 |
| commit | b786f20bbab5a59046aa78a2c6c2a11536497202 (patch) | |
| tree | 0851ecdec889eb9b7ba3751cc04d4f0b474e4a9e /libbfd/hosts | |
inferno-os tree was separated from the inferno-os-android (separated from the Android driver)
Diffstat (limited to 'libbfd/hosts')
| -rw-r--r-- | libbfd/hosts/i386linux.h | 27 | ||||
| -rw-r--r-- | libbfd/hosts/pc532mach.h | 43 | ||||
| -rw-r--r-- | libbfd/hosts/tahoe.h | 31 | ||||
| -rw-r--r-- | libbfd/hosts/x86-64linux.h | 232 |
4 files changed, 333 insertions, 0 deletions
diff --git a/libbfd/hosts/i386linux.h b/libbfd/hosts/i386linux.h new file mode 100644 index 0000000..0c8536e --- /dev/null +++ b/libbfd/hosts/i386linux.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2007-2014 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +/* Linux writes the task structure at the end of the core file. Currently it + is 2912 bytes. It is possible that this should be a pickier check, but + we should probably not be too picky (the size of the task structure might + vary, and if it's not the length we expect it to be, it doesn't affect + our ability to process the core file). So allow 0-4096 extra bytes at + the end. */ + +#define TRAD_CORE_EXTRA_SIZE_ALLOWED 4096 diff --git a/libbfd/hosts/pc532mach.h b/libbfd/hosts/pc532mach.h new file mode 100644 index 0000000..981ee95 --- /dev/null +++ b/libbfd/hosts/pc532mach.h @@ -0,0 +1,43 @@ +/* Copyright (C) 2007-2014 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#include <machine/vmparam.h> +#include <sys/param.h> + +/* This is an ugly way to hack around the incorrect + * definition of UPAGES in ns532/machparam.h. + * + * The definition should specify the size reserved + * for "struct user" in core files in PAGES, + * but instead it gives it in 512-byte core-clicks + * for ns532, i386 and i860. UPAGES is used only in trad-core.c. + */ +#if UPAGES == 16 +#undef UPAGES +#define UPAGES 2 +#endif + +#if UPAGES != 2 +#error UPAGES is neither 2 nor 16 +#endif + +#define HOST_PAGE_SIZE 1 +#define HOST_SEGMENT_SIZE NBPG +#define HOST_TEXT_START_ADDR USRTEXT +#define HOST_STACK_END_ADDR USRSTACK diff --git a/libbfd/hosts/tahoe.h b/libbfd/hosts/tahoe.h new file mode 100644 index 0000000..f41d6c4 --- /dev/null +++ b/libbfd/hosts/tahoe.h @@ -0,0 +1,31 @@ +/* Copyright (C) 2007-2014 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#define NO_CORE_COMMAND + +#undef ALIGN /* They use it, we use it too */ +#include <machine/param.h> +#undef ALIGN /* They use it, we use it too */ + +#define HOST_PAGE_SIZE NBPG +#define HOST_MACHINE_ARCH bfd_arch_tahoe + +#define HOST_TEXT_START_ADDR 0 +#define HOST_STACK_END_ADDR (KERNBASE - (UPAGES * NBPG)) +#define HOST_BIG_ENDIAN_P diff --git a/libbfd/hosts/x86-64linux.h b/libbfd/hosts/x86-64linux.h new file mode 100644 index 0000000..27fd176 --- /dev/null +++ b/libbfd/hosts/x86-64linux.h @@ -0,0 +1,232 @@ +/* Copyright (C) 2006-2014 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. */ + +/* 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> + +/* We define here only the symbols differing from their 64-bit variant. */ +#include <sys/procfs.h> + +#ifdef HAVE_STDINT_H +#include <stdint.h> +#else +typedef unsigned int uint32_t; +typedef unsigned long long int uint64_t; +#endif + +/* Unsigned 64-bit integer aligned to 8 bytes. */ +typedef uint64_t __attribute__ ((__aligned__ (8))) a8_uint64_t; + +#undef HAVE_PRPSINFO32_T +#define HAVE_PRPSINFO32_T +#undef HAVE_PRPSINFO32_T_PR_PID +#define HAVE_PRPSINFO32_T_PR_PID + +#undef HAVE_PRSTATUS32_T +#define HAVE_PRSTATUS32_T + +/* These are the 32-bit x86 structures. */ + +struct user_regs32_struct +{ + int32_t ebx; + int32_t ecx; + int32_t edx; + int32_t esi; + int32_t edi; + int32_t ebp; + int32_t eax; + int32_t xds; + int32_t xes; + int32_t xfs; + int32_t xgs; + int32_t orig_eax; + int32_t eip; + int32_t xcs; + int32_t eflags; + int32_t esp; + int32_t xss; +}; + +struct user_regs64_struct +{ + a8_uint64_t r15; + a8_uint64_t r14; + a8_uint64_t r13; + a8_uint64_t r12; + a8_uint64_t rbp; + a8_uint64_t rbx; + a8_uint64_t r11; + a8_uint64_t r10; + a8_uint64_t r9; + a8_uint64_t r8; + a8_uint64_t rax; + a8_uint64_t rcx; + a8_uint64_t rdx; + a8_uint64_t rsi; + a8_uint64_t rdi; + a8_uint64_t orig_rax; + a8_uint64_t rip; + a8_uint64_t cs; + a8_uint64_t eflags; + a8_uint64_t rsp; + a8_uint64_t ss; + a8_uint64_t fs_base; + a8_uint64_t gs_base; + a8_uint64_t ds; + a8_uint64_t es; + a8_uint64_t fs; + a8_uint64_t gs; +}; + +/* Type for a general-purpose register. */ +typedef uint32_t elf_greg32_t; +typedef a8_uint64_t elf_greg64_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_NGREG32 (sizeof (struct user_regs32_struct) / sizeof(elf_greg32_t)) +typedef elf_greg32_t elf_gregset32_t[ELF_NGREG32]; +#define ELF_NGREG64 (sizeof (struct user_regs64_struct) / sizeof(elf_greg64_t)) +typedef elf_greg64_t elf_gregset64_t[ELF_NGREG64]; + +/* 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 prstatus32_timeval + { + int tv_sec; + int tv_usec; + }; + +struct prstatus64_timeval + { + a8_uint64_t tv_sec; + a8_uint64_t tv_usec; + }; + +struct elf_prstatus32 + { + struct elf_siginfo pr_info; /* Info associated with signal. */ + short int pr_cursig; /* Current signal. */ + unsigned int pr_sigpend; /* Set of pending signals. */ + unsigned int pr_sighold; /* Set of held signals. */ + pid_t pr_pid; + pid_t pr_ppid; + pid_t pr_pgrp; + pid_t pr_sid; + struct prstatus32_timeval pr_utime; /* User time. */ + struct prstatus32_timeval pr_stime; /* System time. */ + struct prstatus32_timeval pr_cutime; /* Cumulative user time. */ + struct prstatus32_timeval pr_cstime; /* Cumulative system time. */ + elf_gregset32_t pr_reg; /* GP registers. */ + int pr_fpvalid; /* True if math copro being used. */ + }; + +struct elf_prstatusx32 + { + struct elf_siginfo pr_info; /* Info associated with signal. */ + short int pr_cursig; /* Current signal. */ + unsigned int pr_sigpend; /* Set of pending signals. */ + unsigned int pr_sighold; /* Set of held signals. */ + pid_t pr_pid; + pid_t pr_ppid; + pid_t pr_pgrp; + pid_t pr_sid; + struct prstatus32_timeval pr_utime; /* User time. */ + struct prstatus32_timeval pr_stime; /* System time. */ + struct prstatus32_timeval pr_cutime; /* Cumulative user time. */ + struct prstatus32_timeval pr_cstime; /* Cumulative system time. */ + elf_gregset64_t pr_reg; /* GP registers. */ + int pr_fpvalid; /* True if math copro being used. */ + }; + +struct elf_prstatus64 + { + struct elf_siginfo pr_info; /* Info associated with signal. */ + short int pr_cursig; /* Current signal. */ + a8_uint64_t pr_sigpend; /* Set of pending signals. */ + a8_uint64_t pr_sighold; /* Set of held signals. */ + pid_t pr_pid; + pid_t pr_ppid; + pid_t pr_pgrp; + pid_t pr_sid; + struct prstatus64_timeval pr_utime; /* User time. */ + struct prstatus64_timeval pr_stime; /* System time. */ + struct prstatus64_timeval pr_cutime; /* Cumulative user time. */ + struct prstatus64_timeval pr_cstime; /* Cumulative system time. */ + elf_gregset64_t pr_reg; /* GP registers. */ + int pr_fpvalid; /* True if math copro being used. */ + }; + +struct elf_prpsinfo32 + { + char pr_state; /* Numeric process state. */ + char pr_sname; /* Char for pr_state. */ + char pr_zomb; /* Zombie. */ + char pr_nice; /* Nice val. */ + unsigned 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. */ + }; + +struct elf_prpsinfo64 + { + char pr_state; /* Numeric process state. */ + char pr_sname; /* Char for pr_state. */ + char pr_zomb; /* Zombie. */ + char pr_nice; /* Nice val. */ + a8_uint64_t 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. */ + +/* Process status and info. In the end we do provide typedefs for them. */ +typedef struct elf_prstatus32 prstatus32_t; +typedef struct elf_prstatusx32 prstatusx32_t; +typedef struct elf_prstatus64 prstatus64_t; +typedef struct elf_prpsinfo32 prpsinfo32_t; +typedef struct elf_prpsinfo64 prpsinfo64_t; |
