Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+91 -107
-1
MAINTAINERS
··· 12930 12930 F: include/linux/tracehook.h 12931 12931 F: include/uapi/linux/ptrace.h 12932 12932 F: include/uapi/linux/ptrace.h 12933 - F: include/asm-generic/ptrace.h 12934 12933 F: kernel/ptrace.c 12935 12934 F: arch/*/ptrace*.c 12936 12935 F: arch/*/*/ptrace*.c
+19 -12
arch/arm64/include/asm/ptrace.h
··· 223 223 #define fast_interrupts_enabled(regs) \ 224 224 (!((regs)->pstate & PSR_F_BIT)) 225 225 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 + } 231 232 232 233 extern int regs_query_register_offset(const char *name); 233 234 extern unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, ··· 327 326 struct task_struct; 328 327 int valid_user_regs(struct user_pt_regs *regs, struct task_struct *task); 329 328 330 - #define GET_IP(regs) ((unsigned long)(regs)->pc) 331 - #define SET_IP(regs, value) ((regs)->pc = ((u64) (value))) 329 + static inline unsigned long instruction_pointer(struct pt_regs *regs) 330 + { 331 + return regs->pc; 332 + } 333 + static inline void instruction_pointer_set(struct pt_regs *regs, 334 + unsigned long val) 335 + { 336 + regs->pc = val; 337 + } 332 338 333 - #define GET_FP(ptregs) ((unsigned long)(ptregs)->regs[29]) 334 - #define SET_FP(ptregs, value) ((ptregs)->regs[29] = ((u64) (value))) 335 - 336 - #include <asm-generic/ptrace.h> 339 + static inline unsigned long frame_pointer(struct pt_regs *regs) 340 + { 341 + return regs->regs[29]; 342 + } 337 343 338 344 #define procedure_link_pointer(regs) ((regs)->regs[30]) 339 345 ··· 350 342 procedure_link_pointer(regs) = val; 351 343 } 352 344 353 - #undef profile_pc 354 345 extern unsigned long profile_pc(struct pt_regs *regs); 355 346 356 347 #endif /* __ASSEMBLY__ */
-5
arch/mips/include/asm/ptrace.h
··· 56 56 return regs->regs[31]; 57 57 } 58 58 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 - 64 59 static inline void instruction_pointer_set(struct pt_regs *regs, 65 60 unsigned long val) 66 61 {
+22 -7
arch/powerpc/include/asm/ptrace.h
··· 111 111 112 112 #ifndef __ASSEMBLY__ 113 113 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 + } 118 134 119 135 #ifdef CONFIG_SMP 120 136 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) 122 139 #endif 123 - 124 - #include <asm-generic/ptrace.h> 125 140 126 141 #define kernel_stack_pointer(regs) ((regs)->gpr[1]) 127 142 static inline int is_syscall_success(struct pt_regs *regs)
+25 -4
arch/sh/include/asm/ptrace.h
··· 16 16 #define user_mode(regs) (((regs)->sr & 0x40000000)==0) 17 17 #define kernel_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15]) 18 18 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 + } 21 44 22 45 #define arch_has_single_step() (1) 23 46 ··· 135 112 136 113 return pc; 137 114 } 138 - #define profile_pc profile_pc 139 115 140 - #include <asm-generic/ptrace.h> 141 116 #endif /* __ASM_SH_PTRACE_H */
+25 -5
arch/x86/include/asm/ptrace.h
··· 98 98 struct task_struct; 99 99 100 100 extern unsigned long profile_pc(struct pt_regs *regs); 101 - #define profile_pc profile_pc 102 101 103 102 extern unsigned long 104 103 convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs); ··· 169 170 return regs->sp; 170 171 } 171 172 172 - #define GET_IP(regs) ((regs)->ip) 173 - #define GET_FP(regs) ((regs)->bp) 174 - #define GET_USP(regs) ((regs)->sp) 173 + static inline unsigned long instruction_pointer(struct pt_regs *regs) 174 + { 175 + return regs->ip; 176 + } 175 177 176 - #include <asm-generic/ptrace.h> 178 + static inline void instruction_pointer_set(struct pt_regs *regs, 179 + unsigned long val) 180 + { 181 + regs->ip = val; 182 + } 183 + 184 + static inline unsigned long frame_pointer(struct pt_regs *regs) 185 + { 186 + return regs->bp; 187 + } 188 + 189 + static inline unsigned long user_stack_pointer(struct pt_regs *regs) 190 + { 191 + return regs->sp; 192 + } 193 + 194 + static inline void user_stack_pointer_set(struct pt_regs *regs, 195 + unsigned long val) 196 + { 197 + regs->sp = val; 198 + } 177 199 178 200 /* Query offset/name of register from its name/offset */ 179 201 extern int regs_query_register_offset(const char *name);
-73
include/asm-generic/ptrace.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 - /* 3 - * Common low level (register) ptrace helpers 4 - * 5 - * Copyright 2004-2011 Analog Devices Inc. 6 - */ 7 - 8 - #ifndef __ASM_GENERIC_PTRACE_H__ 9 - #define __ASM_GENERIC_PTRACE_H__ 10 - 11 - #ifndef __ASSEMBLY__ 12 - 13 - /* Helpers for working with the instruction pointer */ 14 - #ifndef GET_IP 15 - #define GET_IP(regs) ((regs)->pc) 16 - #endif 17 - #ifndef SET_IP 18 - #define SET_IP(regs, val) (GET_IP(regs) = (val)) 19 - #endif 20 - 21 - static inline unsigned long instruction_pointer(struct pt_regs *regs) 22 - { 23 - return GET_IP(regs); 24 - } 25 - static inline void instruction_pointer_set(struct pt_regs *regs, 26 - unsigned long val) 27 - { 28 - SET_IP(regs, val); 29 - } 30 - 31 - #ifndef profile_pc 32 - #define profile_pc(regs) instruction_pointer(regs) 33 - #endif 34 - 35 - /* Helpers for working with the user stack pointer */ 36 - #ifndef GET_USP 37 - #define GET_USP(regs) ((regs)->usp) 38 - #endif 39 - #ifndef SET_USP 40 - #define SET_USP(regs, val) (GET_USP(regs) = (val)) 41 - #endif 42 - 43 - static inline unsigned long user_stack_pointer(struct pt_regs *regs) 44 - { 45 - return GET_USP(regs); 46 - } 47 - static inline void user_stack_pointer_set(struct pt_regs *regs, 48 - unsigned long val) 49 - { 50 - SET_USP(regs, val); 51 - } 52 - 53 - /* Helpers for working with the frame pointer */ 54 - #ifndef GET_FP 55 - #define GET_FP(regs) ((regs)->fp) 56 - #endif 57 - #ifndef SET_FP 58 - #define SET_FP(regs, val) (GET_FP(regs) = (val)) 59 - #endif 60 - 61 - static inline unsigned long frame_pointer(struct pt_regs *regs) 62 - { 63 - return GET_FP(regs); 64 - } 65 - static inline void frame_pointer_set(struct pt_regs *regs, 66 - unsigned long val) 67 - { 68 - SET_FP(regs, val); 69 - } 70 - 71 - #endif /* __ASSEMBLY__ */ 72 - 73 - #endif