Move regs-related macros and declarations from defs.h to regs.h
* 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>.
This commit is contained in:
parent
fadf379b8e
commit
5503dd28c6
14
Makefile.am
14
Makefile.am
@ -83,6 +83,7 @@ strace_SOURCES = \
|
||||
readahead.c \
|
||||
readlink.c \
|
||||
reboot.c \
|
||||
regs.h \
|
||||
renameat.c \
|
||||
resource.c \
|
||||
sched.c \
|
||||
@ -168,6 +169,7 @@ EXTRA_DIST = \
|
||||
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 \
|
||||
@ -177,6 +179,8 @@ EXTRA_DIST = \
|
||||
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 \
|
||||
@ -194,16 +198,19 @@ EXTRA_DIST = \
|
||||
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 \
|
||||
@ -224,6 +231,7 @@ EXTRA_DIST = \
|
||||
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 \
|
||||
@ -241,6 +249,7 @@ EXTRA_DIST = \
|
||||
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 \
|
||||
@ -271,12 +280,14 @@ EXTRA_DIST = \
|
||||
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 \
|
||||
@ -290,6 +301,7 @@ EXTRA_DIST = \
|
||||
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 \
|
||||
@ -309,6 +321,7 @@ EXTRA_DIST = \
|
||||
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 \
|
||||
@ -333,6 +346,7 @@ EXTRA_DIST = \
|
||||
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 \
|
||||
|
1
bjm.c
1
bjm.c
@ -34,7 +34,6 @@
|
||||
#include <sys/wait.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
/* Bits of module.flags. */
|
||||
|
||||
|
82
defs.h
82
defs.h
@ -163,81 +163,13 @@ extern char *stpcpy(char *dst, const char *src);
|
||||
# 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] */
|
||||
@ -292,20 +224,6 @@ struct arm_pt_regs {
|
||||
# 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;
|
||||
|
5
linux/alpha/arch_regs.h
Normal file
5
linux/alpha/arch_regs.h
Normal file
@ -0,0 +1,5 @@
|
||||
#define REG_R0 0
|
||||
#define REG_A0 16
|
||||
#define REG_A3 19
|
||||
#define REG_FP 30
|
||||
#define REG_PC 64
|
1
linux/arch_regs.h
Normal file
1
linux/arch_regs.h
Normal file
@ -0,0 +1 @@
|
||||
/* nothing */
|
1
linux/arm/arch_regs.h
Normal file
1
linux/arm/arch_regs.h
Normal file
@ -0,0 +1 @@
|
||||
extern struct pt_regs arm_regs;
|
5
linux/hppa/arch_regs.h
Normal file
5
linux/hppa/arch_regs.h
Normal file
@ -0,0 +1,5 @@
|
||||
#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)
|
1
linux/i386/arch_regs.h
Normal file
1
linux/i386/arch_regs.h
Normal file
@ -0,0 +1 @@
|
||||
extern uint32_t *const i386_esp_ptr;
|
4
linux/ia64/arch_regs.h
Normal file
4
linux/ia64/arch_regs.h
Normal file
@ -0,0 +1,4 @@
|
||||
#include <asm/ptrace_offsets.h>
|
||||
#include <asm/rse.h>
|
||||
|
||||
extern bool ia64_ia32mode;
|
5
linux/mips/arch_regs.h
Normal file
5
linux/mips/arch_regs.h
Normal file
@ -0,0 +1,5 @@
|
||||
#define REG_V0 2
|
||||
#define REG_A0 4
|
||||
#define REG_A3 7
|
||||
#define REG_SP 29
|
||||
#define REG_EPC 64
|
1
linux/powerpc/arch_regs.h
Normal file
1
linux/powerpc/arch_regs.h
Normal file
@ -0,0 +1 @@
|
||||
extern struct pt_regs ppc_regs;
|
15
linux/sh64/arch_regs.h
Normal file
15
linux/sh64/arch_regs.h
Normal file
@ -0,0 +1,15 @@
|
||||
/* 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)
|
6
linux/sparc/arch_regs.h
Normal file
6
linux/sparc/arch_regs.h
Normal file
@ -0,0 +1,6 @@
|
||||
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
|
1
linux/sparc64/arch_regs.h
Normal file
1
linux/sparc64/arch_regs.h
Normal file
@ -0,0 +1 @@
|
||||
#include "sparc/arch_regs.h"
|
1
linux/tile/arch_regs.h
Normal file
1
linux/tile/arch_regs.h
Normal file
@ -0,0 +1 @@
|
||||
extern struct pt_regs tile_regs;
|
1
linux/x86_64/arch_regs.h
Normal file
1
linux/x86_64/arch_regs.h
Normal file
@ -0,0 +1 @@
|
||||
#include "i386/arch_regs.h"
|
19
process.c
19
process.c
@ -42,28 +42,11 @@
|
||||
|
||||
#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 ")" }
|
||||
|
7
regs.h
Normal file
7
regs.h
Normal file
@ -0,0 +1,7 @@
|
||||
#include <sys/user.h>
|
||||
|
||||
#ifdef HAVE_SYS_REG_H
|
||||
# include <sys/reg.h>
|
||||
#endif
|
||||
|
||||
#include "arch_regs.h"
|
10
signal.c
10
signal.c
@ -33,17 +33,9 @@
|
||||
|
||||
#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 {
|
||||
|
3
strace.c
3
strace.c
@ -42,9 +42,6 @@
|
||||
#ifdef HAVE_PRCTL
|
||||
# include <sys/prctl.h>
|
||||
#endif
|
||||
#if defined(IA64)
|
||||
# include <asm/ptrace_offsets.h>
|
||||
#endif
|
||||
|
||||
#include "ptrace.h"
|
||||
|
||||
|
43
syscall.c
43
syscall.c
@ -32,11 +32,13 @@
|
||||
*/
|
||||
|
||||
#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"
|
||||
@ -48,16 +50,12 @@
|
||||
# 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
|
||||
@ -715,6 +713,27 @@ static long bfin_r0;
|
||||
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;
|
||||
|
11
util.c
11
util.c
@ -32,7 +32,6 @@
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include <sys/user.h>
|
||||
#include <sys/param.h>
|
||||
#include <fcntl.h>
|
||||
#if HAVE_SYS_XATTR_H
|
||||
@ -40,16 +39,8 @@
|
||||
#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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user