1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_M32R_ASSEMBLER_H
3 #define _ASM_M32R_ASSEMBLER_H
6 * linux/asm-m32r/assembler.h
8 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org>
10 * This file contains M32R architecture specific macro definitions.
13 #include <linux/stringify.h>
20 #define __STR(x) __stringify(x)
24 #define M32R_LOCK __STR(lock)
25 #define M32R_UNLOCK __STR(unlock)
27 #define M32R_LOCK __STR(ld)
28 #define M32R_UNLOCK __STR(st)
33 #define ENTRY(name) ENTRY_M name
43 * LDIMM - load immediate value
44 * STI - enable interruption
45 * CLI - disable interruption
50 #define LDIMM(reg,x) LDIMM reg x
53 or3
\reg
, \reg
, #low(\x)
56 #if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104))
57 #define ENABLE_INTERRUPTS(reg) ENABLE_INTERRUPTS reg
58 .macro ENABLE_INTERRUPTS reg
60 ; WORKAROUND
: "-> nop" is a workaround
for the
M32700(TS1
).
63 #define DISABLE_INTERRUPTS(reg) DISABLE_INTERRUPTS reg
64 .macro DISABLE_INTERRUPTS reg
66 ; WORKAROUND
: "-> nop" is a workaround
for the
M32700(TS1
).
68 #else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
69 #define ENABLE_INTERRUPTS(reg) ENABLE_INTERRUPTS reg
70 .macro ENABLE_INTERRUPTS reg
72 or3
\reg
, \reg
, #0x0040
76 #define DISABLE_INTERRUPTS(reg) DISABLE_INTERRUPTS reg
77 .macro DISABLE_INTERRUPTS reg
79 and3
\reg
, \reg
, #0xffbf
82 #endif /* CONFIG_CHIP_M32102 */
99 #if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2)
108 #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
114 push r13
; dummy push acc1h
115 push r13
; dummy push acc1l
117 #error unknown isa configuration
120 push r13
; syscall_nr (default: -1)
131 addi sp
, #-4 ; room for implicit pt_regs parameter
152 addi r15
, #4 ; Skip syscall number
153 #if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2)
162 #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
163 pop r13
; dummy pop acc1h
164 pop r13
; dummy pop acc1l
170 #error unknown isa configuration
176 addi sp
, #8 ; Skip bbpsw, bbpc
182 addi sp
, #4 ; Skip orig_r0
188 .section __ex_table
,"a"
194 #define GET_CURRENT(reg) get_current reg
195 .macro get_current reg
200 #if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104))
201 .macro SWITCH_TO_KERNEL_STACK
202 ; switch to kernel
stack (spi
)
205 #else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
206 .macro SWITCH_TO_KERNEL_STACK
207 push r0
; save r0
for working
209 and3 r0
, r0
, #0x00ff7f
212 bltz r0
, 1f
; check BSM
-bit
214 ;; called from kernel context
: previous stack
= spi
219 ;; called from user context
: previous stack
= spu
223 ld r0
, @
(-4,r0
) ; retrieve r0
227 #endif /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
229 #endif /* __ASSEMBLY__ */
231 #endif /* _ASM_M32R_ASSEMBLER_H */