Commit 6dd10d91 authored by Jisheng Zhang's avatar Jisheng Zhang Committed by Palmer Dabbelt

riscv: extable: consolidate definitions

This is a riscv port of commit 819771cc ("arm64: extable:
consolidate definitions").
Signed-off-by: default avatarJisheng Zhang <jszhang@kernel.org>
Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
parent 9d504f9a
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef __ASM_ASM_EXTABLE_H
#define __ASM_ASM_EXTABLE_H
#ifdef __ASSEMBLY__
#define __ASM_EXTABLE_RAW(insn, fixup) \
.pushsection __ex_table, "a"; \
.balign 4; \
.long ((insn) - .); \
.long ((fixup) - .); \
.popsection;
.macro _asm_extable, insn, fixup
__ASM_EXTABLE_RAW(\insn, \fixup)
.endm
#else /* __ASSEMBLY__ */
#include <linux/stringify.h>
#define __ASM_EXTABLE_RAW(insn, fixup) \
".pushsection __ex_table, \"a\"\n" \
".balign 4\n" \
".long ((" insn ") - .)\n" \
".long ((" fixup ") - .)\n" \
".popsection\n"
#define _ASM_EXTABLE(insn, fixup) __ASM_EXTABLE_RAW(#insn, #fixup)
#endif /* __ASSEMBLY__ */
#endif /* __ASM_ASM_EXTABLE_H */
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <asm/asm.h> #include <asm/asm.h>
#include <asm/asm-extable.h>
/* We don't even really need the extable code, but for now keep it simple */ /* We don't even really need the extable code, but for now keep it simple */
#ifndef CONFIG_MMU #ifndef CONFIG_MMU
......
...@@ -8,14 +8,9 @@ ...@@ -8,14 +8,9 @@
#ifndef _ASM_RISCV_UACCESS_H #ifndef _ASM_RISCV_UACCESS_H
#define _ASM_RISCV_UACCESS_H #define _ASM_RISCV_UACCESS_H
#include <asm/asm-extable.h>
#include <asm/pgtable.h> /* for TASK_SIZE */ #include <asm/pgtable.h> /* for TASK_SIZE */
#define _ASM_EXTABLE(from, to) \
" .pushsection __ex_table, \"a\"\n" \
" .balign 4\n" \
" .long (" #from " - .), (" #to " - .)\n" \
" .popsection\n"
/* /*
* User space memory access functions * User space memory access functions
*/ */
......
#include <linux/linkage.h> #include <linux/linkage.h>
#include <asm-generic/export.h> #include <asm-generic/export.h>
#include <asm/asm.h> #include <asm/asm.h>
#include <asm/asm-extable.h>
#include <asm/csr.h> #include <asm/csr.h>
.macro fixup op reg addr lbl .macro fixup op reg addr lbl
100: 100:
\op \reg, \addr \op \reg, \addr
.section __ex_table,"a" _asm_extable 100b, \lbl
.balign 4
.long (100b - .), (\lbl - .)
.previous
.endm .endm
ENTRY(__asm_copy_to_user) ENTRY(__asm_copy_to_user)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment