treewide: remove current_text_addr
Subsystems (19)
PATCH v2 1/1 treewide: remove current_text_addr
Prefer _THIS_IP_ defined in linux/kernel.h.
Most definitions of current_text_addr were the same as _THIS_IP_, but a few archs had inline assembly instead.
This patch removes the final call site of current_text_addr, making all of the definitions dead code.
Signed-off-by Nick Desaulniers <[email protected]>
---
No Changes in v2, just a rebase. Resending without cc'ing everyone suggested by scripts/get_maintainer.pl, which was a huge list.
Linus asked for a treewide change here:
https://lkml.org/lkml/2018/8/20/613
Linus suggested this conversion in:
https://lists.librecores.org/pipermail/openrisc/2018-August/001392.html
Peter has a good idea for a follow up:
https://lists.librecores.org/pipermail/openrisc/2018-August/001397.html
arch/alpha/include/asm/processor.h | 6 ------ arch/arc/include/asm/processor.h | 8 -------- arch/arm/include/asm/processor.h | 6 ------ arch/arm64/include/asm/processor.h | 7 ------- arch/c6x/include/asm/processor.h | 11 ----------- arch/h8300/include/asm/processor.h | 6 ------ arch/hexagon/include/asm/processor.h | 3 --- arch/ia64/include/asm/processor.h | 6 ------ arch/m68k/include/asm/processor.h | 6 ------ arch/microblaze/include/asm/processor.h | 12 ------------ arch/mips/include/asm/processor.h | 5 ----- arch/nds32/include/asm/processor.h | 6 ------ arch/nios2/include/asm/processor.h | 6 ------ arch/openrisc/include/asm/processor.h | 5 ----- arch/parisc/include/asm/processor.h | 11 ----------- arch/powerpc/include/asm/processor.h | 6 ------ arch/riscv/include/asm/processor.h | 6 ------ arch/s390/include/asm/processor.h | 6 ------ arch/sh/include/asm/processor_32.h | 6 ------ arch/sh/include/asm/processor_64.h | 15 --------------- arch/sparc/include/asm/processor_32.h | 6 ------ arch/sparc/include/asm/processor_64.h | 6 ------ arch/unicore32/include/asm/processor.h | 6 ------ arch/x86/include/asm/kexec.h | 3 ++- arch/x86/include/asm/processor.h | 12 ------------ arch/x86/um/asm/processor_32.h | 8 -------- arch/x86/um/asm/processor_64.h | 3 --- arch/xtensa/include/asm/processor.h | 8 -------- 28 files changed, 2 insertions(+), 193 deletions(-)
arch/alpha/include/asm/processor.h +0 -6
@@ -10,12 +10,6 @@#include <linux/personality.h> /* for ADDR_LIMIT_32BIT */ -/* -* Returns current instruction pointer ("program counter"). -*/ -#define current_text_addr () \ - ({ void *__pc; __asm__ ("br %0,.+4" : "=r"(__pc)); __pc; }) -/* * We have a 42-bit user address space: 4TB user VM... */
arch/arc/include/asm/processor.h +0 -8
@@ -98,14 +98,6 @@ extern void start_thread(struct pt_regs * regs, unsigned long pc,extern unsigned int get_wchan (struct task_struct *p); -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -* Should the PC register be read instead ? This macro does not seem to -* be used in many places so this wont be all that bad. -*/ -#define current_text_addr () ({ __label__ _l; _l: &&_l; }) -#endif /* !__ASSEMBLY__ */ /*
arch/arm/include/asm/processor.h +0 -6
@@ -11,12 +11,6 @@#ifndef __ASM_ARM_PROCESSOR_H#define __ASM_ARM_PROCESSOR_H -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -#define current_text_addr () ({ __label__ _l; _l: &&_l;}) -#ifdef __KERNEL__#include <asm/hw_breakpoint.h>
arch/arm64/include/asm/processor.h +0 -7
@@ -25,13 +25,6 @@#define USER_DS (TASK_SIZE_64 - 1)#ifndef __ASSEMBLY__ - -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -#define current_text_addr () ({ __label__ _l; _l: &&_l;}) -#ifdef __KERNEL__#include <linux/build_bug.h>
arch/c6x/include/asm/processor.h +0 -11
@@ -17,17 +17,6 @@#include <asm/page.h> #include <asm/current.h> -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -#define current_text_addr () \ -({ \ - void *__pc; \ - asm("mvc .S2 pce1,%0\n" : "=b"(__pc)); \ - __pc; \ -}) -/* * User space process size. This is mostly meaningless for NOMMU * but some C6X processors may have RAM addresses up to 0xFFFFFFFF.
arch/h8300/include/asm/processor.h +0 -6
@@ -12,12 +12,6 @@#ifndef __ASM_H8300_PROCESSOR_H#define __ASM_H8300_PROCESSOR_H -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -#define current_text_addr () ({ __label__ _l; _l: &&_l; }) -#include <linux/compiler.h> #include <asm/segment.h> #include <asm/ptrace.h>
arch/hexagon/include/asm/processor.h +0 -3
@@ -27,9 +27,6 @@#include <asm/registers.h> #include <asm/hexagon_vm.h> -/* must be a macro */ -#define current_text_addr () ({ __label__ _l; _l: &&_l; }) -/* task_struct, defined elsewhere, is the "process descriptor" */ struct task_struct ;
arch/ia64/include/asm/processor.h +0 -6
@@ -602,12 +602,6 @@ ia64_set_unat (__u64 *unat, void *spill_addr, unsigned long nat) *unat = (*unat & ~mask) | (nat << bit); } -/* -* Get the current instruction/program counter value. -*/ -#define current_text_addr () \ - ({ void *_pc; _pc = (void *)ia64_getreg(_IA64_REG_IP); _pc; }) -static inline __u64 ia64_get_ivr (void ) {
arch/m68k/include/asm/processor.h +0 -6
@@ -8,12 +8,6 @@#ifndef __ASM_M68K_PROCESSOR_H#define __ASM_M68K_PROCESSOR_H -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -#define current_text_addr () ({ __label__ _l; _l: &&_l;}) -#include <linux/thread_info.h> #include <asm/segment.h> #include <asm/fpu.h>
arch/microblaze/include/asm/processor.h +0 -12
@@ -45,12 +45,6 @@ extern void ret_from_kernel_thread(void);*/ # define TASK_SIZE (0x81000000 - 0x80000000) -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -# define current_text_addr () ({ __label__ _l; _l: &&_l; }) -/* * This decides where the kernel will search for a free chunk of vm * space during mmap's. We won't be using it
@@ -92,12 +86,6 @@ extern unsigned long get_wchan(struct task_struct *p);# ifndef __ASSEMBLY__ -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -# define current_text_addr () ({ __label__ _l; _l: &&_l; }) -/* If you change this, you must change the associated assembly-languages * constants defined below, THREAD_*. */
arch/mips/include/asm/processor.h +0 -5
@@ -22,11 +22,6 @@#include <asm/mipsregs.h> #include <asm/prefetch.h> -/* -* Return current * instruction pointer ("program counter"). -*/ -#define current_text_addr () ({ __label__ _l; _l: &&_l;}) -/* * System setup and hardware flags.. */
arch/nds32/include/asm/processor.h +0 -6
@@ -4,12 +4,6 @@#ifndef __ASM_NDS32_PROCESSOR_H#define __ASM_NDS32_PROCESSOR_H -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -#define current_text_addr () ({ __label__ _l; _l: &&_l;}) -#ifdef __KERNEL__#include <asm/ptrace.h>
arch/nios2/include/asm/processor.h +0 -6
@@ -38,12 +38,6 @@#define KUSER_SIZE (PAGE_SIZE)#ifndef __ASSEMBLY__ -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -#define current_text_addr () ({ __label__ _l; _l: &&_l; }) -# define TASK_SIZE 0x7FFF0000UL# define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3))
arch/openrisc/include/asm/processor.h +0 -5
@@ -30,11 +30,6 @@ | SPR_SR_DCE | SPR_SR_SM)#define USER_SR (SPR_SR_DME | SPR_SR_IME | SPR_SR_ICE \ | SPR_SR_DCE | SPR_SR_IEE | SPR_SR_TEE) -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -#define current_text_addr () ({ __label__ _l; _l: &&_l; })/* * User space process size. This is hardcoded into a few places,
arch/parisc/include/asm/processor.h +0 -11
@@ -20,17 +20,6 @@#include <asm/percpu.h> #endif /* __ASSEMBLY__ */ -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -#ifdef CONFIG_PA20 -#define current_ia (x) __asm__("mfia %0" : "=r"(x)) -#else /* mfia added in pa2.0 */ -#define current_ia (x) __asm__("blr 0,%0\n\tnop" : "=r"(x)) -#endif -#define current_text_addr () ({ void *pc; current_ia(pc); pc; }) -#define HAVE_ARCH_PICK_MMAP_LAYOUT #define TASK_SIZE_OF (tsk) ((tsk)->thread.task_size)
arch/powerpc/include/asm/processor.h +0 -6
@@ -67,12 +67,6 @@ extern int _chrp_type;#endif /* defined(__KERNEL__) && defined(CONFIG_PPC32) */ -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -#define current_text_addr () ({ __label__ _l; _l: &&_l;}) -/* Macros for adjusting thread priority (hardware multi-threading) */ #define HMT_very_low () asm volatile("or 31,31,31 # very low priority")#define HMT_low () asm volatile("or 1,1,1 # low priority")
arch/riscv/include/asm/processor.h +0 -6
@@ -33,12 +33,6 @@struct task_struct ;struct pt_regs ; -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -#define current_text_addr () ({ __label__ _l; _l: &&_l; }) -/* CPU-specific state of a task */ struct thread_struct {/* Callee-saved registers */
arch/s390/include/asm/processor.h +0 -6
@@ -73,12 +73,6 @@ static inline int test_cpu_flag_of(int flag, int cpu)#define arch_needs_cpu () test_cpu_flag(CIF_NOHZ_DELAY) -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -#define current_text_addr () ({ void *pc; asm("basr %0,0" : "=a" (pc)); pc; }) -static inline void get_cpu_id (struct cpuid *ptr) { asmvolatile ("stidp %0" :"=Q" (*ptr));
arch/sh/include/asm/processor_32.h +0 -6
@@ -16,12 +16,6 @@#include <asm/types.h> #include <asm/hw_breakpoint.h> -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -#define current_text_addr () ({ void *pc; __asm__("mova 1f, %0\n.align 2\n1:":"=z" (pc)); pc; }) -/* Core Processor Version Register */ #define CCN_PVR 0xff000030#define CCN_CVR 0xff000040
arch/sh/include/asm/processor_64.h +0 -15
@@ -19,21 +19,6 @@#include <asm/types.h> #include <cpu/registers.h> -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -#define current_text_addr () ({ \ -void *pc; \ -unsigned long long __dummy = 0; \ -__asm__("gettr tr0, %1\n\t" \ - "pta 4, tr0\n\t" \ - "gettr tr0, %0\n\t" \ - "ptabs %1, tr0\n\t" \ - :"=r" (pc), "=r" (__dummy) \ - : "1" (__dummy)); \ -pc; }) -#endif /*
arch/sparc/include/asm/processor_32.h +0 -6
@@ -7,12 +7,6 @@#ifndef __ASM_SPARC_PROCESSOR_H#define __ASM_SPARC_PROCESSOR_H -/* -* Sparc32 implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -#define current_text_addr () ({ void *pc; __asm__("sethi %%hi(1f), %0; or %0, %%lo(1f), %0;\n1:" : "=r" (pc)); pc; }) -#include <asm/psr.h> #include <asm/ptrace.h> #include <asm/head.h>
arch/sparc/include/asm/processor_64.h +0 -6
@@ -8,12 +8,6 @@#ifndef __ASM_SPARC64_PROCESSOR_H#define __ASM_SPARC64_PROCESSOR_H -/* -* Sparc64 implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -#define current_text_addr () ({ void *pc; __asm__("rd %%pc, %0" : "=r" (pc)); pc; }) -#include <asm/asi.h> #include <asm/pstate.h> #include <asm/ptrace.h>
arch/unicore32/include/asm/processor.h +0 -6
@@ -13,12 +13,6 @@#ifndef __UNICORE_PROCESSOR_H__#define __UNICORE_PROCESSOR_H__ -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -#define current_text_addr () ({ __label__ _l; _l: &&_l; }) -#ifdef __KERNEL__#include <asm/ptrace.h>
arch/x86/include/asm/kexec.h +2 -1
@@ -21,6 +21,7 @@#ifndef __ASSEMBLY__#include <linux/string.h> +#include <linux/kernel.h> #include <asm/page.h> #include <asm/ptrace.h>
@@ -132,7 +133,7 @@ static inline void crash_setup_regs(struct pt_regs *newregs, asmvolatile ("movl %%cs, %%eax;" :"=a" (newregs->cs)); asmvolatile ("pushfq; popq %0" :"=m" (newregs->flags));#endif - newregs->ip = (unsigned long )current_text_addr (); + newregs->ip = _THIS_IP_; } }
arch/x86/include/asm/processor.h +0 -12
@@ -42,18 +42,6 @@ struct vm86;#define NET_IP_ALIGN 0#define HBP_NUM 4 -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -static inline void *current_text_addr (void ) -{ -void *pc; - - asmvolatile ("mov $1f, %0; 1:" :"=r" (pc)); - -return pc; -}/* * These alignment constraints are for performance in the vSMP case,
arch/x86/um/asm/processor_32.h +0 -8
@@ -47,14 +47,6 @@ static inline void arch_copy_thread(struct arch_thread *from,memcpy (&to->tls_array, &from->tls_array,sizeof (from->tls_array)); } -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). Stolen -* from asm-i386/processor.h -*/ -#define current_text_addr () \ - ({ void *pc; __asm__("movl $1f,%0\n1:":"=g" (pc)); pc; }) -#define current_sp () ({ void *sp; __asm__("movl %%esp, %0" : "=r" (sp) : ); sp; })#define current_bp () ({ unsigned long bp; __asm__("movl %%ebp, %0" : "=r" (bp) : ); bp; })
arch/x86/um/asm/processor_64.h +0 -3
@@ -31,9 +31,6 @@ static inline void arch_copy_thread(struct arch_thread *from, to->fs = from->fs; } -#define current_text_addr () \ - ({ void *pc; __asm__("movq $1f,%0\n1:":"=g" (pc)); pc; }) -#define current_sp () ({ void *sp; __asm__("movq %%rsp, %0" : "=r" (sp) : ); sp; })#define current_bp () ({ unsigned long bp; __asm__("movq %%rbp, %0" : "=r" (bp) : ); bp; })
arch/xtensa/include/asm/processor.h +0 -8
@@ -152,14 +152,6 @@ struct thread_struct { int align[0] __attribute__ ((aligned(16))); }; - -/* -* Default implementation of macro that returns current -* instruction pointer ("program counter"). -*/ -#define current_text_addr () ({ __label__ _l; _l: &&_l;}) - -/* This decides where the kernel will search for a free chunk of vm * space during mmap's. */
Signature · 1 line
2.19.0.rc2.392.g5ba43deb5a-goog