* regs.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/arch_regs.h: New file.
* linux/alpha/arch_regs.h: Likewise.
* linux/arm/arch_regs.h: Likewise.
* linux/hppa/arch_regs.h: Likewise.
* linux/i386/arch_regs.h: Likewise.
* linux/ia64/arch_regs.h: Likewise.
* linux/mips/arch_regs.h: Likewise.
* linux/powerpc/arch_regs.h: Likewise.
* linux/sh64/arch_regs.h: Likewise.
* linux/sparc/arch_regs.h: Likewise.
* linux/sparc64/arch_regs.h: Likewise.
* linux/tile/arch_regs.h: Likewise.
* linux/x86_64/arch_regs.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
* defs.h: Remove definitions of PTRACE_*, REG_*, PT_*, U_REG_*,
and ARM_* macros.
Remove declarations of struct pt_regs variables.
[SPARC]: Do not include <asm/psr.h>.
[SPARC64]: Do not include <asm/psrcompat.h>.
* bjm.c: Do not include <sys/user.h>.
* process.c: Include "regs.h".
Do not include <sys/user.h> and <sys/reg.h>.
[IA64]: Do not include <asm/ptrace_offsets.h> and <asm/rse.h>.
* util.c: Likewise.
* syscall.c: Likewise.
[AARCH64]: Define struct arm_pt_regs and ARM_* macros.
[SPARC]: Include <asm/psr.h>.
[SPARC64]: Include <asm/psrcompat.h>.
* signal.c: Include "regs.h".
Do not include <sys/user.h> and <sys/reg.h>.
[IA64]: Do not include <asm/ptrace_offsets.h>.
* strace.c [IA64]: Do not include <asm/ptrace_offsets.h>.
readahead.c \
readlink.c \
reboot.c \
+ regs.h \
renameat.c \
resource.c \
sched.c \
linux/aarch64/signalent1.h \
linux/aarch64/syscallent.h \
linux/aarch64/syscallent1.h \
+ linux/alpha/arch_regs.h \
linux/alpha/errnoent.h \
linux/alpha/ioctls_arch0.h \
linux/alpha/ioctls_inc0.h \
linux/arc/ioctls_arch0.h \
linux/arc/ioctls_inc0.h \
linux/arc/syscallent.h \
+ linux/arch_regs.h \
+ linux/arm/arch_regs.h \
linux/arm/ioctls_arch0.h \
linux/arm/ioctls_inc0.h \
linux/arm/syscallent.h \
linux/dummy.h \
linux/errnoent.h \
linux/fanotify.h \
+ linux/hppa/arch_regs.h \
linux/hppa/errnoent.h \
linux/hppa/ioctls_arch0.h \
linux/hppa/ioctls_inc0.h \
linux/hppa/signalent.h \
linux/hppa/syscallent.h \
+ linux/i386/arch_regs.h \
linux/i386/ioctls_arch0.h \
linux/i386/ioctls_inc0.h \
linux/i386/syscallent.h \
linux/i386/userent.h \
linux/i386/userent0.h \
+ linux/ia64/arch_regs.h \
linux/ia64/ioctls_arch0.h \
linux/ia64/ioctls_inc0.h \
linux/ia64/signalent.h \
linux/microblaze/ioctls_inc0.h \
linux/microblaze/syscallent.h \
linux/microblaze/userent.h \
+ linux/mips/arch_regs.h \
linux/mips/errnoent.h \
linux/mips/genstub.sh \
linux/mips/ioctls_arch0.h \
linux/or1k/syscallent.h \
linux/or1k/userent.h \
linux/personality.h \
+ linux/powerpc/arch_regs.h \
linux/powerpc/ioctls_arch0.h \
linux/powerpc/ioctls_inc0.h \
linux/powerpc/syscallent.h \
linux/sh/syscallent.h \
linux/sh/userent.h \
linux/sh/userent0.h \
+ linux/sh64/arch_regs.h \
linux/sh64/ioctls_arch0.h \
linux/sh64/ioctls_inc0.h \
linux/sh64/syscallent.h \
linux/sh64/userent.h \
linux/signalent.h \
linux/sock_diag.h \
+ linux/sparc/arch_regs.h \
linux/sparc/dummy2.h \
linux/sparc/errnoent.h \
linux/sparc/errnoent1.h \
linux/sparc/syscallent.h \
linux/sparc/syscallent1.h \
linux/sparc/userent.h \
+ linux/sparc64/arch_regs.h \
linux/sparc64/dummy2.h \
linux/sparc64/errnoent.h \
linux/sparc64/errnoent1.h \
linux/sparc64/userent.h \
linux/subcall.h \
linux/syscall.h \
+ linux/tile/arch_regs.h \
linux/tile/errnoent1.h \
linux/tile/ioctls_arch0.h \
linux/tile/ioctls_arch1.h \
linux/x32/syscallent.h \
linux/x32/syscallent1.h \
linux/x32/userent.h \
+ linux/x86_64/arch_regs.h \
linux/x86_64/errnoent1.h \
linux/x86_64/errnoent2.h \
linux/x86_64/gentab.pl \
#include <sys/wait.h>
#include <sys/resource.h>
#include <sys/utsname.h>
-#include <sys/user.h>
/* Bits of module.flags. */
# define ERESTART_RESTARTBLOCK 516
#endif
-#ifdef ALPHA
-# define REG_R0 0
-# define REG_A0 16
-# define REG_A3 19
-# define REG_FP 30
-# define REG_PC 64
-#endif /* ALPHA */
-#ifdef MIPS
-# define REG_V0 2
-# define REG_A0 4
-# define REG_A3 7
-# define REG_SP 29
-# define REG_EPC 64
-#endif /* MIPS */
-#ifdef HPPA
-# define PT_GR20 (20*4)
-# define PT_GR26 (26*4)
-# define PT_GR28 (28*4)
-# define PT_IAOQ0 (106*4)
-# define PT_IAOQ1 (107*4)
-#endif /* HPPA */
-#ifdef SH64
- /* SH64 Linux - this code assumes the following kernel API for system calls:
- PC Offset 0
- System Call Offset 16 (actually, (syscall no.) | (0x1n << 16),
- where n = no. of parameters.
- Other regs Offset 24+
-
- On entry: R2-7 = parameters 1-6 (as many as necessary)
- On return: R9 = result. */
-
- /* Offset for peeks of registers */
-# define REG_OFFSET (24)
-# define REG_GENERAL(x) (8*(x)+REG_OFFSET)
-# define REG_PC (0*8)
-# define REG_SYSCALL (2*8)
-#endif /* SH64 */
-#ifdef AARCH64
-struct arm_pt_regs {
- int uregs[18];
-};
-# define ARM_cpsr uregs[16]
-# define ARM_pc uregs[15]
-# define ARM_lr uregs[14]
-# define ARM_sp uregs[13]
-# define ARM_ip uregs[12]
-# define ARM_fp uregs[11]
-# define ARM_r10 uregs[10]
-# define ARM_r9 uregs[9]
-# define ARM_r8 uregs[8]
-# define ARM_r7 uregs[7]
-# define ARM_r6 uregs[6]
-# define ARM_r5 uregs[5]
-# define ARM_r4 uregs[4]
-# define ARM_r3 uregs[3]
-# define ARM_r2 uregs[2]
-# define ARM_r1 uregs[1]
-# define ARM_r0 uregs[0]
-# define ARM_ORIG_r0 uregs[17]
-#endif /* AARCH64 */
-
#if defined(SPARC) || defined(SPARC64)
-/* Indexes into the pt_regs.u_reg[] array -- UREG_XX from kernel are all off
- * by 1 and use Ix instead of Ox. These work for both 32 and 64 bit Linux. */
-# define U_REG_G1 0
-# define U_REG_O0 7
-# define U_REG_O1 8
# define PERSONALITY0_WORDSIZE 4
# define PERSONALITY1_WORDSIZE 4
# if defined(SPARC64)
-# include <asm/psrcompat.h>
# define SUPPORTED_PERSONALITIES 3
# define PERSONALITY2_WORDSIZE 8
# else
-# include <asm/psr.h>
# define SUPPORTED_PERSONALITIES 2
# endif /* SPARC64 */
#endif /* SPARC[64] */
# define PERSONALITY0_WORDSIZE SIZEOF_LONG
#endif
-#if defined(I386) || defined(X86_64)
-extern uint32_t *const i386_esp_ptr;
-#elif defined(IA64)
-extern bool ia64_ia32mode;
-#elif defined(SPARC) || defined(SPARC64)
-extern struct pt_regs sparc_regs;
-#elif defined(ARM)
-extern struct pt_regs arm_regs;
-#elif defined(TILE)
-extern struct pt_regs tile_regs;
-#elif defined(POWERPC)
-extern struct pt_regs ppc_regs;
-#endif
-
typedef struct sysent {
unsigned nargs;
int sys_flags;
--- /dev/null
+#define REG_R0 0
+#define REG_A0 16
+#define REG_A3 19
+#define REG_FP 30
+#define REG_PC 64
--- /dev/null
+/* nothing */
--- /dev/null
+extern struct pt_regs arm_regs;
--- /dev/null
+#define PT_GR20 (20*4)
+#define PT_GR26 (26*4)
+#define PT_GR28 (28*4)
+#define PT_IAOQ0 (106*4)
+#define PT_IAOQ1 (107*4)
--- /dev/null
+extern uint32_t *const i386_esp_ptr;
--- /dev/null
+#include <asm/ptrace_offsets.h>
+#include <asm/rse.h>
+
+extern bool ia64_ia32mode;
--- /dev/null
+#define REG_V0 2
+#define REG_A0 4
+#define REG_A3 7
+#define REG_SP 29
+#define REG_EPC 64
--- /dev/null
+extern struct pt_regs ppc_regs;
--- /dev/null
+/* SH64 Linux - this code assumes the following kernel API for system calls:
+ PC Offset 0
+ System Call Offset 16 (actually, (syscall no.) | (0x1n << 16),
+ where n = no. of parameters.
+ Other regs Offset 24+
+
+ On entry: R2-7 = parameters 1-6 (as many as necessary)
+ On return: R9 = result.
+*/
+
+/* Offset for peeks of registers */
+#define REG_OFFSET (24)
+#define REG_GENERAL(x) (8*(x)+REG_OFFSET)
+#define REG_PC (0*8)
+#define REG_SYSCALL (2*8)
--- /dev/null
+extern struct pt_regs sparc_regs;
+/* Indexes into the pt_regs.u_reg[] array -- UREG_XX from kernel are all off
+ * by 1 and use Ix instead of Ox. These work for both 32 and 64 bit Linux. */
+#define U_REG_G1 0
+#define U_REG_O0 7
+#define U_REG_O1 8
--- /dev/null
+#include "sparc/arch_regs.h"
--- /dev/null
+extern struct pt_regs tile_regs;
--- /dev/null
+#include "i386/arch_regs.h"
#include "xlat/nt_descriptor_types.h"
-#include <sys/user.h>
-#ifdef HAVE_SYS_REG_H
-# include <sys/reg.h>
-#endif
-
#include "ptrace.h"
-
-#if defined(SPARC64)
-# define r_pc r_tpc
-# undef PTRACE_GETREGS
-# define PTRACE_GETREGS PTRACE_GETREGS64
-# undef PTRACE_SETREGS
-# define PTRACE_SETREGS PTRACE_SETREGS64
-#endif
-
#include "xlat/ptrace_cmds.h"
#include "xlat/ptrace_setoptions_flags.h"
-#if defined(IA64)
-# include <asm/ptrace_offsets.h>
-# include <asm/rse.h>
-#endif
+#include "regs.h"
#define uoff(member) offsetof(struct user, member)
#define XLAT_UOFF(member) { uoff(member), "offsetof(struct user, " #member ")" }
--- /dev/null
+#include <sys/user.h>
+
+#ifdef HAVE_SYS_REG_H
+# include <sys/reg.h>
+#endif
+
+#include "arch_regs.h"
#include "defs.h"
#include <fcntl.h>
-#include <sys/user.h>
-
-#ifdef HAVE_SYS_REG_H
-# include <sys/reg.h>
-#endif
#include "ptrace.h"
-
-#ifdef IA64
-# include <asm/ptrace_offsets.h>
-#endif
+#include "regs.h"
#if defined(SPARC) || defined(SPARC64) || defined(MIPS)
typedef struct {
#ifdef HAVE_PRCTL
# include <sys/prctl.h>
#endif
-#if defined(IA64)
-# include <asm/ptrace_offsets.h>
-#endif
#include "ptrace.h"
*/
#include "defs.h"
-#include <sys/user.h>
#include <sys/param.h>
-#ifdef HAVE_SYS_REG_H
-# include <sys/reg.h>
+/* for struct iovec */
+#include <sys/uio.h>
+/* for NT_PRSTATUS */
+#ifdef HAVE_ELF_H
+# include <elf.h>
#endif
#include "ptrace.h"
# define PTRACE_SETREGS PTRACE_SETREGS64
#endif
-#if defined(IA64)
-# include <asm/ptrace_offsets.h>
-# include <asm/rse.h>
-#endif
+#include "regs.h"
-/* for struct iovec */
-#include <sys/uio.h>
-/* for NT_PRSTATUS */
-#ifdef HAVE_ELF_H
-# include <elf.h>
+#if defined SPARC64
+# include <asm/psrcompat.h>
+#elif defined SPARC
+# include <asm/psr.h>
#endif
#ifndef NSIG
struct pt_regs arm_regs; /* not static */
# define ARCH_REGS_FOR_GETREGSET arm_regs
#elif defined(AARCH64)
+struct arm_pt_regs {
+ int uregs[18];
+};
+# define ARM_cpsr uregs[16]
+# define ARM_pc uregs[15]
+# define ARM_lr uregs[14]
+# define ARM_sp uregs[13]
+# define ARM_ip uregs[12]
+# define ARM_fp uregs[11]
+# define ARM_r10 uregs[10]
+# define ARM_r9 uregs[9]
+# define ARM_r8 uregs[8]
+# define ARM_r7 uregs[7]
+# define ARM_r6 uregs[6]
+# define ARM_r5 uregs[5]
+# define ARM_r4 uregs[4]
+# define ARM_r3 uregs[3]
+# define ARM_r2 uregs[2]
+# define ARM_r1 uregs[1]
+# define ARM_r0 uregs[0]
+# define ARM_ORIG_r0 uregs[17]
static union {
struct user_pt_regs aarch64_r;
struct arm_pt_regs arm_r;
*/
#include "defs.h"
-#include <sys/user.h>
#include <sys/param.h>
#include <fcntl.h>
#if HAVE_SYS_XATTR_H
#endif
#include <sys/uio.h>
-#if defined(IA64)
-# include <asm/ptrace_offsets.h>
-# include <asm/rse.h>
-#endif
-
-#ifdef HAVE_SYS_REG_H
-# include <sys/reg.h>
-#endif
-
#include "ptrace.h"
+#include "regs.h"
int
string_to_uint(const char *str)