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

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.

[akpm@linux-foundation.org: fix arch/csky/include/asm/processor.h]
Link: http://lkml.kernel.org/r/20180911182413.180715-1-ndesaulniers@google.com
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Nick Desaulniers and committed by
Linus Torvalds
de0d22e5 49ef341a

+2 -199
-6
arch/alpha/include/asm/processor.h
··· 11 11 #include <linux/personality.h> /* for ADDR_LIMIT_32BIT */ 12 12 13 13 /* 14 - * Returns current instruction pointer ("program counter"). 15 - */ 16 - #define current_text_addr() \ 17 - ({ void *__pc; __asm__ ("br %0,.+4" : "=r"(__pc)); __pc; }) 18 - 19 - /* 20 14 * We have a 42-bit user address space: 4TB user VM... 21 15 */ 22 16 #define TASK_SIZE (0x40000000000UL)
-8
arch/arc/include/asm/processor.h
··· 98 98 99 99 extern unsigned int get_wchan(struct task_struct *p); 100 100 101 - /* 102 - * Default implementation of macro that returns current 103 - * instruction pointer ("program counter"). 104 - * Should the PC register be read instead ? This macro does not seem to 105 - * be used in many places so this wont be all that bad. 106 - */ 107 - #define current_text_addr() ({ __label__ _l; _l: &&_l; }) 108 - 109 101 #endif /* !__ASSEMBLY__ */ 110 102 111 103 /*
-6
arch/arm/include/asm/processor.h
··· 11 11 #ifndef __ASM_ARM_PROCESSOR_H 12 12 #define __ASM_ARM_PROCESSOR_H 13 13 14 - /* 15 - * Default implementation of macro that returns current 16 - * instruction pointer ("program counter"). 17 - */ 18 - #define current_text_addr() ({ __label__ _l; _l: &&_l;}) 19 - 20 14 #ifdef __KERNEL__ 21 15 22 16 #include <asm/hw_breakpoint.h>
-7
arch/arm64/include/asm/processor.h
··· 25 25 #define USER_DS (TASK_SIZE_64 - 1) 26 26 27 27 #ifndef __ASSEMBLY__ 28 - 29 - /* 30 - * Default implementation of macro that returns current 31 - * instruction pointer ("program counter"). 32 - */ 33 - #define current_text_addr() ({ __label__ _l; _l: &&_l;}) 34 - 35 28 #ifdef __KERNEL__ 36 29 37 30 #include <linux/build_bug.h>
-11
arch/c6x/include/asm/processor.h
··· 18 18 #include <asm/current.h> 19 19 20 20 /* 21 - * Default implementation of macro that returns current 22 - * instruction pointer ("program counter"). 23 - */ 24 - #define current_text_addr() \ 25 - ({ \ 26 - void *__pc; \ 27 - asm("mvc .S2 pce1,%0\n" : "=b"(__pc)); \ 28 - __pc; \ 29 - }) 30 - 31 - /* 32 21 * User space process size. This is mostly meaningless for NOMMU 33 22 * but some C6X processors may have RAM addresses up to 0xFFFFFFFF. 34 23 * Since calls like mmap() can return an address or an error, we
-6
arch/csky/include/asm/processor.h
··· 4 4 #ifndef __ASM_CSKY_PROCESSOR_H 5 5 #define __ASM_CSKY_PROCESSOR_H 6 6 7 - /* 8 - * Default implementation of macro that returns current 9 - * instruction pointer ("program counter"). 10 - */ 11 - #define current_text_addr() ({ __label__ _l; _l: &&_l; }) 12 - 13 7 #include <linux/bitops.h> 14 8 #include <asm/segment.h> 15 9 #include <asm/ptrace.h>
-6
arch/h8300/include/asm/processor.h
··· 12 12 #ifndef __ASM_H8300_PROCESSOR_H 13 13 #define __ASM_H8300_PROCESSOR_H 14 14 15 - /* 16 - * Default implementation of macro that returns current 17 - * instruction pointer ("program counter"). 18 - */ 19 - #define current_text_addr() ({ __label__ _l; _l: &&_l; }) 20 - 21 15 #include <linux/compiler.h> 22 16 #include <asm/segment.h> 23 17 #include <asm/ptrace.h>
-3
arch/hexagon/include/asm/processor.h
··· 27 27 #include <asm/registers.h> 28 28 #include <asm/hexagon_vm.h> 29 29 30 - /* must be a macro */ 31 - #define current_text_addr() ({ __label__ _l; _l: &&_l; }) 32 - 33 30 /* task_struct, defined elsewhere, is the "process descriptor" */ 34 31 struct task_struct; 35 32
-6
arch/ia64/include/asm/processor.h
··· 602 602 *unat = (*unat & ~mask) | (nat << bit); 603 603 } 604 604 605 - /* 606 - * Get the current instruction/program counter value. 607 - */ 608 - #define current_text_addr() \ 609 - ({ void *_pc; _pc = (void *)ia64_getreg(_IA64_REG_IP); _pc; }) 610 - 611 605 static inline __u64 612 606 ia64_get_ivr (void) 613 607 {
-6
arch/m68k/include/asm/processor.h
··· 8 8 #ifndef __ASM_M68K_PROCESSOR_H 9 9 #define __ASM_M68K_PROCESSOR_H 10 10 11 - /* 12 - * Default implementation of macro that returns current 13 - * instruction pointer ("program counter"). 14 - */ 15 - #define current_text_addr() ({ __label__ _l; _l: &&_l;}) 16 - 17 11 #include <linux/thread_info.h> 18 12 #include <asm/segment.h> 19 13 #include <asm/fpu.h>
-12
arch/microblaze/include/asm/processor.h
··· 46 46 # define TASK_SIZE (0x81000000 - 0x80000000) 47 47 48 48 /* 49 - * Default implementation of macro that returns current 50 - * instruction pointer ("program counter"). 51 - */ 52 - # define current_text_addr() ({ __label__ _l; _l: &&_l; }) 53 - 54 - /* 55 49 * This decides where the kernel will search for a free chunk of vm 56 50 * space during mmap's. We won't be using it 57 51 */ ··· 85 91 # define THREAD_KSP 0 86 92 87 93 # ifndef __ASSEMBLY__ 88 - 89 - /* 90 - * Default implementation of macro that returns current 91 - * instruction pointer ("program counter"). 92 - */ 93 - # define current_text_addr() ({ __label__ _l; _l: &&_l; }) 94 94 95 95 /* If you change this, you must change the associated assembly-languages 96 96 * constants defined below, THREAD_*.
-5
arch/mips/include/asm/processor.h
··· 24 24 #include <asm/prefetch.h> 25 25 26 26 /* 27 - * Return current * instruction pointer ("program counter"). 28 - */ 29 - #define current_text_addr() ({ __label__ _l; _l: &&_l;}) 30 - 31 - /* 32 27 * System setup and hardware flags.. 33 28 */ 34 29
-6
arch/nds32/include/asm/processor.h
··· 4 4 #ifndef __ASM_NDS32_PROCESSOR_H 5 5 #define __ASM_NDS32_PROCESSOR_H 6 6 7 - /* 8 - * Default implementation of macro that returns current 9 - * instruction pointer ("program counter"). 10 - */ 11 - #define current_text_addr() ({ __label__ _l; _l: &&_l;}) 12 - 13 7 #ifdef __KERNEL__ 14 8 15 9 #include <asm/ptrace.h>
-6
arch/nios2/include/asm/processor.h
··· 38 38 #define KUSER_SIZE (PAGE_SIZE) 39 39 #ifndef __ASSEMBLY__ 40 40 41 - /* 42 - * Default implementation of macro that returns current 43 - * instruction pointer ("program counter"). 44 - */ 45 - #define current_text_addr() ({ __label__ _l; _l: &&_l; }) 46 - 47 41 # define TASK_SIZE 0x7FFF0000UL 48 42 # define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3)) 49 43
-5
arch/openrisc/include/asm/processor.h
··· 30 30 | SPR_SR_DCE | SPR_SR_SM) 31 31 #define USER_SR (SPR_SR_DME | SPR_SR_IME | SPR_SR_ICE \ 32 32 | SPR_SR_DCE | SPR_SR_IEE | SPR_SR_TEE) 33 - /* 34 - * Default implementation of macro that returns current 35 - * instruction pointer ("program counter"). 36 - */ 37 - #define current_text_addr() ({ __label__ _l; _l: &&_l; }) 38 33 39 34 /* 40 35 * User space process size. This is hardcoded into a few places,
-11
arch/parisc/include/asm/processor.h
··· 20 20 #include <asm/percpu.h> 21 21 #endif /* __ASSEMBLY__ */ 22 22 23 - /* 24 - * Default implementation of macro that returns current 25 - * instruction pointer ("program counter"). 26 - */ 27 - #ifdef CONFIG_PA20 28 - #define current_ia(x) __asm__("mfia %0" : "=r"(x)) 29 - #else /* mfia added in pa2.0 */ 30 - #define current_ia(x) __asm__("blr 0,%0\n\tnop" : "=r"(x)) 31 - #endif 32 - #define current_text_addr() ({ void *pc; current_ia(pc); pc; }) 33 - 34 23 #define HAVE_ARCH_PICK_MMAP_LAYOUT 35 24 36 25 #define TASK_SIZE_OF(tsk) ((tsk)->thread.task_size)
-6
arch/powerpc/include/asm/processor.h
··· 67 67 68 68 #endif /* defined(__KERNEL__) && defined(CONFIG_PPC32) */ 69 69 70 - /* 71 - * Default implementation of macro that returns current 72 - * instruction pointer ("program counter"). 73 - */ 74 - #define current_text_addr() ({ __label__ _l; _l: &&_l;}) 75 - 76 70 /* Macros for adjusting thread priority (hardware multi-threading) */ 77 71 #define HMT_very_low() asm volatile("or 31,31,31 # very low priority") 78 72 #define HMT_low() asm volatile("or 1,1,1 # low priority")
-6
arch/riscv/include/asm/processor.h
··· 33 33 struct task_struct; 34 34 struct pt_regs; 35 35 36 - /* 37 - * Default implementation of macro that returns current 38 - * instruction pointer ("program counter"). 39 - */ 40 - #define current_text_addr() ({ __label__ _l; _l: &&_l; }) 41 - 42 36 /* CPU-specific state of a task */ 43 37 struct thread_struct { 44 38 /* Callee-saved registers */
-6
arch/s390/include/asm/processor.h
··· 73 73 74 74 #define arch_needs_cpu() test_cpu_flag(CIF_NOHZ_DELAY) 75 75 76 - /* 77 - * Default implementation of macro that returns current 78 - * instruction pointer ("program counter"). 79 - */ 80 - #define current_text_addr() ({ void *pc; asm("basr %0,0" : "=a" (pc)); pc; }) 81 - 82 76 static inline void get_cpu_id(struct cpuid *ptr) 83 77 { 84 78 asm volatile("stidp %0" : "=Q" (*ptr));
-6
arch/sh/include/asm/processor_32.h
··· 16 16 #include <asm/types.h> 17 17 #include <asm/hw_breakpoint.h> 18 18 19 - /* 20 - * Default implementation of macro that returns current 21 - * instruction pointer ("program counter"). 22 - */ 23 - #define current_text_addr() ({ void *pc; __asm__("mova 1f, %0\n.align 2\n1:":"=z" (pc)); pc; }) 24 - 25 19 /* Core Processor Version Register */ 26 20 #define CCN_PVR 0xff000030 27 21 #define CCN_CVR 0xff000040
-15
arch/sh/include/asm/processor_64.h
··· 19 19 #include <asm/types.h> 20 20 #include <cpu/registers.h> 21 21 22 - /* 23 - * Default implementation of macro that returns current 24 - * instruction pointer ("program counter"). 25 - */ 26 - #define current_text_addr() ({ \ 27 - void *pc; \ 28 - unsigned long long __dummy = 0; \ 29 - __asm__("gettr tr0, %1\n\t" \ 30 - "pta 4, tr0\n\t" \ 31 - "gettr tr0, %0\n\t" \ 32 - "ptabs %1, tr0\n\t" \ 33 - :"=r" (pc), "=r" (__dummy) \ 34 - : "1" (__dummy)); \ 35 - pc; }) 36 - 37 22 #endif 38 23 39 24 /*
-6
arch/sparc/include/asm/processor_32.h
··· 7 7 #ifndef __ASM_SPARC_PROCESSOR_H 8 8 #define __ASM_SPARC_PROCESSOR_H 9 9 10 - /* 11 - * Sparc32 implementation of macro that returns current 12 - * instruction pointer ("program counter"). 13 - */ 14 - #define current_text_addr() ({ void *pc; __asm__("sethi %%hi(1f), %0; or %0, %%lo(1f), %0;\n1:" : "=r" (pc)); pc; }) 15 - 16 10 #include <asm/psr.h> 17 11 #include <asm/ptrace.h> 18 12 #include <asm/head.h>
-6
arch/sparc/include/asm/processor_64.h
··· 8 8 #ifndef __ASM_SPARC64_PROCESSOR_H 9 9 #define __ASM_SPARC64_PROCESSOR_H 10 10 11 - /* 12 - * Sparc64 implementation of macro that returns current 13 - * instruction pointer ("program counter"). 14 - */ 15 - #define current_text_addr() ({ void *pc; __asm__("rd %%pc, %0" : "=r" (pc)); pc; }) 16 - 17 11 #include <asm/asi.h> 18 12 #include <asm/pstate.h> 19 13 #include <asm/ptrace.h>
-6
arch/unicore32/include/asm/processor.h
··· 13 13 #ifndef __UNICORE_PROCESSOR_H__ 14 14 #define __UNICORE_PROCESSOR_H__ 15 15 16 - /* 17 - * Default implementation of macro that returns current 18 - * instruction pointer ("program counter"). 19 - */ 20 - #define current_text_addr() ({ __label__ _l; _l: &&_l; }) 21 - 22 16 #ifdef __KERNEL__ 23 17 24 18 #include <asm/ptrace.h>
+2 -1
arch/x86/include/asm/kexec.h
··· 21 21 #ifndef __ASSEMBLY__ 22 22 23 23 #include <linux/string.h> 24 + #include <linux/kernel.h> 24 25 25 26 #include <asm/page.h> 26 27 #include <asm/ptrace.h> ··· 133 132 asm volatile("movl %%cs, %%eax;" :"=a"(newregs->cs)); 134 133 asm volatile("pushfq; popq %0" :"=m"(newregs->flags)); 135 134 #endif 136 - newregs->ip = (unsigned long)current_text_addr(); 135 + newregs->ip = _THIS_IP_; 137 136 } 138 137 } 139 138
-12
arch/x86/include/asm/processor.h
··· 42 42 #define NET_IP_ALIGN 0 43 43 44 44 #define HBP_NUM 4 45 - /* 46 - * Default implementation of macro that returns current 47 - * instruction pointer ("program counter"). 48 - */ 49 - static inline void *current_text_addr(void) 50 - { 51 - void *pc; 52 - 53 - asm volatile("mov $1f, %0; 1:":"=r" (pc)); 54 - 55 - return pc; 56 - } 57 45 58 46 /* 59 47 * These alignment constraints are for performance in the vSMP case,
-8
arch/x86/um/asm/processor_32.h
··· 47 47 memcpy(&to->tls_array, &from->tls_array, sizeof(from->tls_array)); 48 48 } 49 49 50 - /* 51 - * Default implementation of macro that returns current 52 - * instruction pointer ("program counter"). Stolen 53 - * from asm-i386/processor.h 54 - */ 55 - #define current_text_addr() \ 56 - ({ void *pc; __asm__("movl $1f,%0\n1:":"=g" (pc)); pc; }) 57 - 58 50 #define current_sp() ({ void *sp; __asm__("movl %%esp, %0" : "=r" (sp) : ); sp; }) 59 51 #define current_bp() ({ unsigned long bp; __asm__("movl %%ebp, %0" : "=r" (bp) : ); bp; }) 60 52
-3
arch/x86/um/asm/processor_64.h
··· 31 31 to->fs = from->fs; 32 32 } 33 33 34 - #define current_text_addr() \ 35 - ({ void *pc; __asm__("movq $1f,%0\n1:":"=g" (pc)); pc; }) 36 - 37 34 #define current_sp() ({ void *sp; __asm__("movq %%rsp, %0" : "=r" (sp) : ); sp; }) 38 35 #define current_bp() ({ unsigned long bp; __asm__("movq %%rbp, %0" : "=r" (bp) : ); bp; }) 39 36
-8
arch/xtensa/include/asm/processor.h
··· 152 152 int align[0] __attribute__ ((aligned(16))); 153 153 }; 154 154 155 - 156 - /* 157 - * Default implementation of macro that returns current 158 - * instruction pointer ("program counter"). 159 - */ 160 - #define current_text_addr() ({ __label__ _l; _l: &&_l;}) 161 - 162 - 163 155 /* This decides where the kernel will search for a free chunk of vm 164 156 * space during mmap's. 165 157 */