summaryrefslogtreecommitdiff
path: root/arch/nds32/include/asm/assembler.h
diff options
context:
space:
mode:
authorGreentime Hu <greentime@andestech.com>2017-10-24 09:19:11 +0300
committerGreentime Hu <greentime@andestech.com>2018-02-22 05:44:31 +0300
commite1d82de681fd79e65f86912c7b231d88180ac8a4 (patch)
treec5925da6341e197e205834f2b95c36733e187e0b /arch/nds32/include/asm/assembler.h
parent2312dbf7462bdc04b4dc26aef66c8413125c77f0 (diff)
downloadlinux-e1d82de681fd79e65f86912c7b231d88180ac8a4.tar.xz
nds32: Assembly macros and definitions
This patch includes assembly macros, bit field definitions used in .S files across arch/nds32/. Signed-off-by: Vincent Chen <vincentc@andestech.com> Signed-off-by: Greentime Hu <greentime@andestech.com> Acked-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/nds32/include/asm/assembler.h')
-rw-r--r--arch/nds32/include/asm/assembler.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/arch/nds32/include/asm/assembler.h b/arch/nds32/include/asm/assembler.h
new file mode 100644
index 000000000000..c3855782a541
--- /dev/null
+++ b/arch/nds32/include/asm/assembler.h
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (C) 2005-2017 Andes Technology Corporation
+
+#ifndef __NDS32_ASSEMBLER_H__
+#define __NDS32_ASSEMBLER_H__
+
+.macro gie_disable
+ setgie.d
+ dsb
+.endm
+
+.macro gie_enable
+ setgie.e
+ dsb
+.endm
+
+.macro gie_save oldpsw
+ mfsr \oldpsw, $ir0
+ setgie.d
+ dsb
+.endm
+
+.macro gie_restore oldpsw
+ andi \oldpsw, \oldpsw, #0x1
+ beqz \oldpsw, 7001f
+ setgie.e
+ dsb
+7001:
+.endm
+
+
+#define USER(insn, reg, addr, opr) \
+9999: insn reg, addr, opr; \
+ .section __ex_table,"a"; \
+ .align 3; \
+ .long 9999b, 9001f; \
+ .previous
+
+#endif /* __NDS32_ASSEMBLER_H__ */