Skip to content

Commit 5503dd2

Browse files
committed
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>.
1 parent fadf379 commit 5503dd2

File tree

22 files changed

+102
-135
lines changed

22 files changed

+102
-135
lines changed

Makefile.am

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ strace_SOURCES = \
8383
readahead.c \
8484
readlink.c \
8585
reboot.c \
86+
regs.h \
8687
renameat.c \
8788
resource.c \
8889
sched.c \
@@ -168,6 +169,7 @@ EXTRA_DIST = \
168169
linux/aarch64/signalent1.h \
169170
linux/aarch64/syscallent.h \
170171
linux/aarch64/syscallent1.h \
172+
linux/alpha/arch_regs.h \
171173
linux/alpha/errnoent.h \
172174
linux/alpha/ioctls_arch0.h \
173175
linux/alpha/ioctls_inc0.h \
@@ -177,6 +179,8 @@ EXTRA_DIST = \
177179
linux/arc/ioctls_arch0.h \
178180
linux/arc/ioctls_inc0.h \
179181
linux/arc/syscallent.h \
182+
linux/arch_regs.h \
183+
linux/arm/arch_regs.h \
180184
linux/arm/ioctls_arch0.h \
181185
linux/arm/ioctls_inc0.h \
182186
linux/arm/syscallent.h \
@@ -194,16 +198,19 @@ EXTRA_DIST = \
194198
linux/dummy.h \
195199
linux/errnoent.h \
196200
linux/fanotify.h \
201+
linux/hppa/arch_regs.h \
197202
linux/hppa/errnoent.h \
198203
linux/hppa/ioctls_arch0.h \
199204
linux/hppa/ioctls_inc0.h \
200205
linux/hppa/signalent.h \
201206
linux/hppa/syscallent.h \
207+
linux/i386/arch_regs.h \
202208
linux/i386/ioctls_arch0.h \
203209
linux/i386/ioctls_inc0.h \
204210
linux/i386/syscallent.h \
205211
linux/i386/userent.h \
206212
linux/i386/userent0.h \
213+
linux/ia64/arch_regs.h \
207214
linux/ia64/ioctls_arch0.h \
208215
linux/ia64/ioctls_inc0.h \
209216
linux/ia64/signalent.h \
@@ -224,6 +231,7 @@ EXTRA_DIST = \
224231
linux/microblaze/ioctls_inc0.h \
225232
linux/microblaze/syscallent.h \
226233
linux/microblaze/userent.h \
234+
linux/mips/arch_regs.h \
227235
linux/mips/errnoent.h \
228236
linux/mips/genstub.sh \
229237
linux/mips/ioctls_arch0.h \
@@ -241,6 +249,7 @@ EXTRA_DIST = \
241249
linux/or1k/syscallent.h \
242250
linux/or1k/userent.h \
243251
linux/personality.h \
252+
linux/powerpc/arch_regs.h \
244253
linux/powerpc/ioctls_arch0.h \
245254
linux/powerpc/ioctls_inc0.h \
246255
linux/powerpc/syscallent.h \
@@ -271,12 +280,14 @@ EXTRA_DIST = \
271280
linux/sh/syscallent.h \
272281
linux/sh/userent.h \
273282
linux/sh/userent0.h \
283+
linux/sh64/arch_regs.h \
274284
linux/sh64/ioctls_arch0.h \
275285
linux/sh64/ioctls_inc0.h \
276286
linux/sh64/syscallent.h \
277287
linux/sh64/userent.h \
278288
linux/signalent.h \
279289
linux/sock_diag.h \
290+
linux/sparc/arch_regs.h \
280291
linux/sparc/dummy2.h \
281292
linux/sparc/errnoent.h \
282293
linux/sparc/errnoent1.h \
@@ -290,6 +301,7 @@ EXTRA_DIST = \
290301
linux/sparc/syscallent.h \
291302
linux/sparc/syscallent1.h \
292303
linux/sparc/userent.h \
304+
linux/sparc64/arch_regs.h \
293305
linux/sparc64/dummy2.h \
294306
linux/sparc64/errnoent.h \
295307
linux/sparc64/errnoent1.h \
@@ -309,6 +321,7 @@ EXTRA_DIST = \
309321
linux/sparc64/userent.h \
310322
linux/subcall.h \
311323
linux/syscall.h \
324+
linux/tile/arch_regs.h \
312325
linux/tile/errnoent1.h \
313326
linux/tile/ioctls_arch0.h \
314327
linux/tile/ioctls_arch1.h \
@@ -333,6 +346,7 @@ EXTRA_DIST = \
333346
linux/x32/syscallent.h \
334347
linux/x32/syscallent1.h \
335348
linux/x32/userent.h \
349+
linux/x86_64/arch_regs.h \
336350
linux/x86_64/errnoent1.h \
337351
linux/x86_64/errnoent2.h \
338352
linux/x86_64/gentab.pl \

bjm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include <sys/wait.h>
3535
#include <sys/resource.h>
3636
#include <sys/utsname.h>
37-
#include <sys/user.h>
3837

3938
/* Bits of module.flags. */
4039

defs.h

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -163,81 +163,13 @@ extern char *stpcpy(char *dst, const char *src);
163163
# define ERESTART_RESTARTBLOCK 516
164164
#endif
165165

166-
#ifdef ALPHA
167-
# define REG_R0 0
168-
# define REG_A0 16
169-
# define REG_A3 19
170-
# define REG_FP 30
171-
# define REG_PC 64
172-
#endif /* ALPHA */
173-
#ifdef MIPS
174-
# define REG_V0 2
175-
# define REG_A0 4
176-
# define REG_A3 7
177-
# define REG_SP 29
178-
# define REG_EPC 64
179-
#endif /* MIPS */
180-
#ifdef HPPA
181-
# define PT_GR20 (20*4)
182-
# define PT_GR26 (26*4)
183-
# define PT_GR28 (28*4)
184-
# define PT_IAOQ0 (106*4)
185-
# define PT_IAOQ1 (107*4)
186-
#endif /* HPPA */
187-
#ifdef SH64
188-
/* SH64 Linux - this code assumes the following kernel API for system calls:
189-
PC Offset 0
190-
System Call Offset 16 (actually, (syscall no.) | (0x1n << 16),
191-
where n = no. of parameters.
192-
Other regs Offset 24+
193-
194-
On entry: R2-7 = parameters 1-6 (as many as necessary)
195-
On return: R9 = result. */
196-
197-
/* Offset for peeks of registers */
198-
# define REG_OFFSET (24)
199-
# define REG_GENERAL(x) (8*(x)+REG_OFFSET)
200-
# define REG_PC (0*8)
201-
# define REG_SYSCALL (2*8)
202-
#endif /* SH64 */
203-
#ifdef AARCH64
204-
struct arm_pt_regs {
205-
int uregs[18];
206-
};
207-
# define ARM_cpsr uregs[16]
208-
# define ARM_pc uregs[15]
209-
# define ARM_lr uregs[14]
210-
# define ARM_sp uregs[13]
211-
# define ARM_ip uregs[12]
212-
# define ARM_fp uregs[11]
213-
# define ARM_r10 uregs[10]
214-
# define ARM_r9 uregs[9]
215-
# define ARM_r8 uregs[8]
216-
# define ARM_r7 uregs[7]
217-
# define ARM_r6 uregs[6]
218-
# define ARM_r5 uregs[5]
219-
# define ARM_r4 uregs[4]
220-
# define ARM_r3 uregs[3]
221-
# define ARM_r2 uregs[2]
222-
# define ARM_r1 uregs[1]
223-
# define ARM_r0 uregs[0]
224-
# define ARM_ORIG_r0 uregs[17]
225-
#endif /* AARCH64 */
226-
227166
#if defined(SPARC) || defined(SPARC64)
228-
/* Indexes into the pt_regs.u_reg[] array -- UREG_XX from kernel are all off
229-
* by 1 and use Ix instead of Ox. These work for both 32 and 64 bit Linux. */
230-
# define U_REG_G1 0
231-
# define U_REG_O0 7
232-
# define U_REG_O1 8
233167
# define PERSONALITY0_WORDSIZE 4
234168
# define PERSONALITY1_WORDSIZE 4
235169
# if defined(SPARC64)
236-
# include <asm/psrcompat.h>
237170
# define SUPPORTED_PERSONALITIES 3
238171
# define PERSONALITY2_WORDSIZE 8
239172
# else
240-
# include <asm/psr.h>
241173
# define SUPPORTED_PERSONALITIES 2
242174
# endif /* SPARC64 */
243175
#endif /* SPARC[64] */
@@ -292,20 +224,6 @@ struct arm_pt_regs {
292224
# define PERSONALITY0_WORDSIZE SIZEOF_LONG
293225
#endif
294226

295-
#if defined(I386) || defined(X86_64)
296-
extern uint32_t *const i386_esp_ptr;
297-
#elif defined(IA64)
298-
extern bool ia64_ia32mode;
299-
#elif defined(SPARC) || defined(SPARC64)
300-
extern struct pt_regs sparc_regs;
301-
#elif defined(ARM)
302-
extern struct pt_regs arm_regs;
303-
#elif defined(TILE)
304-
extern struct pt_regs tile_regs;
305-
#elif defined(POWERPC)
306-
extern struct pt_regs ppc_regs;
307-
#endif
308-
309227
typedef struct sysent {
310228
unsigned nargs;
311229
int sys_flags;

linux/alpha/arch_regs.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#define REG_R0 0
2+
#define REG_A0 16
3+
#define REG_A3 19
4+
#define REG_FP 30
5+
#define REG_PC 64

linux/arch_regs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* nothing */

linux/arm/arch_regs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extern struct pt_regs arm_regs;

linux/hppa/arch_regs.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#define PT_GR20 (20*4)
2+
#define PT_GR26 (26*4)
3+
#define PT_GR28 (28*4)
4+
#define PT_IAOQ0 (106*4)
5+
#define PT_IAOQ1 (107*4)

linux/i386/arch_regs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extern uint32_t *const i386_esp_ptr;

linux/ia64/arch_regs.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#include <asm/ptrace_offsets.h>
2+
#include <asm/rse.h>
3+
4+
extern bool ia64_ia32mode;

linux/mips/arch_regs.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#define REG_V0 2
2+
#define REG_A0 4
3+
#define REG_A3 7
4+
#define REG_SP 29
5+
#define REG_EPC 64

0 commit comments

Comments
 (0)