diff options
author | Zhigang Lu <zlu@ezchip.com> | 2015-09-30 09:53:47 +0800 |
---|---|---|
committer | Chris Metcalf <cmetcalf@ezchip.com> | 2016-01-04 15:09:31 -0500 |
commit | f419e6f63c5afea00d7c17ebf54f2d265f5c4d7e (patch) | |
tree | c9c49f97a3a3abd0c55fce3f41fe71ef0125d3af /arch/tile/include | |
parent | 9f9499ae8e6415cefc4fe0a96ad0e27864353c89 (diff) |
tile: define a macro ktext_writable_addr to get writable kernel text address
It is used by kgdb, ftrace, kprobe and jump label, so we factor
this out into a helper routine.
Reviewed-by: Chris Metcalf <cmetcalf@ezchip.com>
Signed-off-by: Zhigang Lu <zlu@ezchip.com>
Signed-off-by: Chris Metcalf <cmetcalf@ezchip.com>
Diffstat (limited to 'arch/tile/include')
-rw-r--r-- | arch/tile/include/asm/page.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/tile/include/asm/page.h b/arch/tile/include/asm/page.h index a213a8d84a95..5cee2cbff2b1 100644 --- a/arch/tile/include/asm/page.h +++ b/arch/tile/include/asm/page.h @@ -319,6 +319,16 @@ static inline int pfn_valid(unsigned long pfn) #define virt_to_page(kaddr) pfn_to_page(kaddr_to_pfn((void *)(kaddr))) #define page_to_virt(page) pfn_to_kaddr(page_to_pfn(page)) +/* + * The kernel text is mapped at MEM_SV_START as read-only. To allow + * modifying kernel text, it is also mapped at PAGE_OFFSET as read-write. + * This macro converts a kernel address to its writable kernel text mapping, + * which is used to modify the text code on a running kernel by kgdb, + * ftrace, kprobe, jump label, etc. + */ +#define ktext_writable_addr(kaddr) \ + ((unsigned long)(kaddr) - MEM_SV_START + PAGE_OFFSET) + struct mm_struct; extern pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr); extern pte_t *virt_to_kpte(unsigned long kaddr); |