1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * linux/arch/unicore32/include/asm/assembler.h
5 * Code specific to PKUnity SoC and UniCore ISA
7 * Copyright (C) 2001-2010 GUAN Xue-tao
9 * Do not include any C declarations in this file - it is included by
13 #error "Only include this from assembly code"
16 #include <asm/ptrace.h>
19 * Little Endian independent macros for shifting bytes within registers.
23 #define get_byte_0 << #0
24 #define get_byte_1 >> #8
25 #define get_byte_2 >> #16
26 #define get_byte_3 >> #24
27 #define put_byte_0 << #0
28 #define put_byte_1 << #8
29 #define put_byte_2 << #16
30 #define put_byte_3 << #24
38 * Enable and disable interrupts
40 .macro disable_irq, temp
42 andn \temp, \temp, #0xFF
43 or \temp, \temp, #PSR_I_BIT | PRIV_MODE
47 .macro enable_irq, temp
49 andn \temp, \temp, #0xFF
50 or \temp, \temp, #PRIV_MODE
56 .pushsection __ex_table, "a"; \
61 .macro notcond, cond, nexti = .+8
90 .else; .ifnc \cond, al
91 .error "Unknown cond in notcond macro argument"
92 .endif; .endif; .endif; .endif; .endif; .endif; .endif
93 .endif; .endif; .endif; .endif; .endif; .endif; .endif
97 .macro usracc, instr, reg, ptr, inc, cond, rept, abort
102 \instr\()b.u \reg, [\ptr], #\inc
104 \instr\()w.u \reg, [\ptr], #\inc
106 .error "Unsupported inc macro argument"
109 .pushsection __ex_table, "a"
116 .macro strusr, reg, ptr, inc, cond = al, rept = 1, abort = 9001f
117 usracc st, \reg, \ptr, \inc, \cond, \rept, \abort
120 .macro ldrusr, reg, ptr, inc, cond = al, rept = 1, abort = 9001f
121 usracc ld, \reg, \ptr, \inc, \cond, \rept, \abort