Skip to content

Commit 5f26f11

Browse files
committed
Merge tag 'asm-generic-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic
Pull asm-generic updates from Arnd Bergmann: "The asm-generic changes for 5.3 consist of a cleanup series to remove ptrace.h from Christoph Hellwig, who explains: 'asm-generic/ptrace.h is a little weird in that it doesn't actually implement any functionality, but it provided multiple layers of macros that just implement trivial inline functions. We implement those directly in the few architectures and be off with a much simpler design.' at https://lore.kernel.org/lkml/20190624054728.30966-1-hch@lst.de/" * tag 'asm-generic-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: asm-generic: remove ptrace.h x86: don't use asm-generic/ptrace.h sh: don't use asm-generic/ptrace.h powerpc: don't use asm-generic/ptrace.h arm64: don't use asm-generic/ptrace.h
2 parents aabfea8 + 7f3a8df commit 5f26f11

7 files changed

Lines changed: 91 additions & 107 deletions

File tree

‎MAINTAINERS‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12930,7 +12930,6 @@ F: include/linux/regset.h
1293012930
F: include/linux/tracehook.h
1293112931
F: include/uapi/linux/ptrace.h
1293212932
F: include/uapi/linux/ptrace.h
12933-
F: include/asm-generic/ptrace.h
1293412933
F: kernel/ptrace.c
1293512934
F: arch/*/ptrace*.c
1293612935
F: arch/*/*/ptrace*.c

‎arch/arm64/include/asm/ptrace.h‎

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,12 @@ static inline void forget_syscall(struct pt_regs *regs)
223223
#define fast_interrupts_enabled(regs) \
224224
(!((regs)->pstate & PSR_F_BIT))
225225

226-
#define GET_USP(regs) \
227-
(!compat_user_mode(regs) ? (regs)->sp : (regs)->compat_sp)
228-
229-
#define SET_USP(ptregs, value) \
230-
(!compat_user_mode(regs) ? ((regs)->sp = value) : ((regs)->compat_sp = value))
226+
static inline unsigned long user_stack_pointer(struct pt_regs *regs)
227+
{
228+
if (compat_user_mode(regs))
229+
return regs->compat_sp;
230+
return regs->sp;
231+
}
231232

232233
extern int regs_query_register_offset(const char *name);
233234
extern unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
@@ -326,13 +327,20 @@ static inline unsigned long regs_get_kernel_argument(struct pt_regs *regs,
326327
struct task_struct;
327328
int valid_user_regs(struct user_pt_regs *regs, struct task_struct *task);
328329

329-
#define GET_IP(regs) ((unsigned long)(regs)->pc)
330-
#define SET_IP(regs, value) ((regs)->pc = ((u64) (value)))
331-
332-
#define GET_FP(ptregs) ((unsigned long)(ptregs)->regs[29])
333-
#define SET_FP(ptregs, value) ((ptregs)->regs[29] = ((u64) (value)))
330+
static inline unsigned long instruction_pointer(struct pt_regs *regs)
331+
{
332+
return regs->pc;
333+
}
334+
static inline void instruction_pointer_set(struct pt_regs *regs,
335+
unsigned long val)
336+
{
337+
regs->pc = val;
338+
}
334339

335-
#include <asm-generic/ptrace.h>
340+
static inline unsigned long frame_pointer(struct pt_regs *regs)
341+
{
342+
return regs->regs[29];
343+
}
336344

337345
#define procedure_link_pointer(regs) ((regs)->regs[30])
338346

@@ -342,7 +350,6 @@ static inline void procedure_link_pointer_set(struct pt_regs *regs,
342350
procedure_link_pointer(regs) = val;
343351
}
344352

345-
#undef profile_pc
346353
extern unsigned long profile_pc(struct pt_regs *regs);
347354

348355
#endif /* __ASSEMBLY__ */

‎arch/mips/include/asm/ptrace.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
5656
return regs->regs[31];
5757
}
5858

59-
/*
60-
* Don't use asm-generic/ptrace.h it defines FP accessors that don't make
61-
* sense on MIPS. We rather want an error if they get invoked.
62-
*/
63-
6459
static inline void instruction_pointer_set(struct pt_regs *regs,
6560
unsigned long val)
6661
{

‎arch/powerpc/include/asm/ptrace.h‎

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,33 @@ struct pt_regs
111111

112112
#ifndef __ASSEMBLY__
113113

114-
#define GET_IP(regs) ((regs)->nip)
115-
#define GET_USP(regs) ((regs)->gpr[1])
116-
#define GET_FP(regs) (0)
117-
#define SET_FP(regs, val)
114+
static inline unsigned long instruction_pointer(struct pt_regs *regs)
115+
{
116+
return regs->nip;
117+
}
118+
119+
static inline void instruction_pointer_set(struct pt_regs *regs,
120+
unsigned long val)
121+
{
122+
regs->nip = val;
123+
}
124+
125+
static inline unsigned long user_stack_pointer(struct pt_regs *regs)
126+
{
127+
return regs->gpr[1];
128+
}
129+
130+
static inline unsigned long frame_pointer(struct pt_regs *regs)
131+
{
132+
return 0;
133+
}
118134

119135
#ifdef CONFIG_SMP
120136
extern unsigned long profile_pc(struct pt_regs *regs);
121-
#define profile_pc profile_pc
137+
#else
138+
#define profile_pc(regs) instruction_pointer(regs)
122139
#endif
123140

124-
#include <asm-generic/ptrace.h>
125-
126141
#define kernel_stack_pointer(regs) ((regs)->gpr[1])
127142
static inline int is_syscall_success(struct pt_regs *regs)
128143
{

‎arch/sh/include/asm/ptrace.h‎

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,31 @@
1616
#define user_mode(regs) (((regs)->sr & 0x40000000)==0)
1717
#define kernel_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15])
1818

19-
#define GET_FP(regs) ((regs)->regs[14])
20-
#define GET_USP(regs) ((regs)->regs[15])
19+
static inline unsigned long instruction_pointer(struct pt_regs *regs)
20+
{
21+
return regs->pc;
22+
}
23+
static inline void instruction_pointer_set(struct pt_regs *regs,
24+
unsigned long val)
25+
{
26+
regs->pc = val;
27+
}
28+
29+
static inline unsigned long frame_pointer(struct pt_regs *regs)
30+
{
31+
return regs->regs[14];
32+
}
33+
34+
static inline unsigned long user_stack_pointer(struct pt_regs *regs)
35+
{
36+
return regs->regs[15];
37+
}
38+
39+
static inline void user_stack_pointer_set(struct pt_regs *regs,
40+
unsigned long val)
41+
{
42+
regs->regs[15] = val;
43+
}
2144

2245
#define arch_has_single_step() (1)
2346

@@ -112,7 +135,5 @@ static inline unsigned long profile_pc(struct pt_regs *regs)
112135

113136
return pc;
114137
}
115-
#define profile_pc profile_pc
116138

117-
#include <asm-generic/ptrace.h>
118139
#endif /* __ASM_SH_PTRACE_H */

‎arch/x86/include/asm/ptrace.h‎

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ struct cpuinfo_x86;
9898
struct task_struct;
9999

100100
extern unsigned long profile_pc(struct pt_regs *regs);
101-
#define profile_pc profile_pc
102101

103102
extern unsigned long
104103
convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs);
@@ -170,11 +169,32 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
170169
return regs->sp;
171170
}
172171

173-
#define GET_IP(regs) ((regs)->ip)
174-
#define GET_FP(regs) ((regs)->bp)
175-
#define GET_USP(regs) ((regs)->sp)
172+
static inline unsigned long instruction_pointer(struct pt_regs *regs)
173+
{
174+
return regs->ip;
175+
}
176+
177+
static inline void instruction_pointer_set(struct pt_regs *regs,
178+
unsigned long val)
179+
{
180+
regs->ip = val;
181+
}
182+
183+
static inline unsigned long frame_pointer(struct pt_regs *regs)
184+
{
185+
return regs->bp;
186+
}
176187

177-
#include <asm-generic/ptrace.h>
188+
static inline unsigned long user_stack_pointer(struct pt_regs *regs)
189+
{
190+
return regs->sp;
191+
}
192+
193+
static inline void user_stack_pointer_set(struct pt_regs *regs,
194+
unsigned long val)
195+
{
196+
regs->sp = val;
197+
}
178198

179199
/* Query offset/name of register from its name/offset */
180200
extern int regs_query_register_offset(const char *name);

‎include/asm-generic/ptrace.h‎

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)