summaryrefslogtreecommitdiff
path: root/arch/loongarch/include/asm/asm-extable.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/loongarch/include/asm/asm-extable.h')
-rw-r--r--arch/loongarch/include/asm/asm-extable.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/loongarch/include/asm/asm-extable.h b/arch/loongarch/include/asm/asm-extable.h
new file mode 100644
index 000000000000..4f615bf56727
--- /dev/null
+++ b/arch/loongarch/include/asm/asm-extable.h
@@ -0,0 +1,35 @@
+/* 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 8; \
+ .quad (insn); \
+ .quad (fixup); \
+ .popsection;
+
+ .macro _asm_extable, insn, fixup
+ __ASM_EXTABLE_RAW(\insn, \fixup)
+ .endm
+
+#else /* __ASSEMBLY__ */
+
+#include <linux/bits.h>
+#include <linux/stringify.h>
+
+#define __ASM_EXTABLE_RAW(insn, fixup) \
+ ".pushsection __ex_table, \"a\"\n" \
+ ".balign 8\n" \
+ ".quad ((" insn "))\n" \
+ ".quad ((" fixup "))\n" \
+ ".popsection\n"
+
+#define _ASM_EXTABLE(insn, fixup) \
+ __ASM_EXTABLE_RAW(#insn, #fixup)
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* __ASM_ASM_EXTABLE_H */