1 #ifndef _ASM_M32R_ASSEMBLER_H
2 #define _ASM_M32R_ASSEMBLER_H
5 * linux/asm-m32r/assembler.h
7 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org>
9 * This file contains M32R architecture specific macro definitions.
12 #include <linux/stringify.h>
19 #define __STR(x) __stringify(x)
23 #define M32R_LOCK __STR(lock)
24 #define M32R_UNLOCK __STR(unlock)
26 #define M32R_LOCK __STR(ld)
27 #define M32R_UNLOCK __STR(st)
32 #define ENTRY(name) ENTRY_M name
42 * LDIMM - load immediate value
43 * STI - enable interruption
44 * CLI - disable interruption
49 #define LDIMM(reg,x) LDIMM reg x
52 or3 \reg, \reg, #low(\x)
55 #if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104))
56 #define ENABLE_INTERRUPTS(reg) ENABLE_INTERRUPTS reg
57 .macro ENABLE_INTERRUPTS reg
59 ; WORKAROUND: "-> nop" is a workaround for the M32700(TS1).
62 #define DISABLE_INTERRUPTS(reg) DISABLE_INTERRUPTS reg
63 .macro DISABLE_INTERRUPTS reg
65 ; WORKAROUND: "-> nop" is a workaround for the M32700(TS1).
67 #else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
68 #define ENABLE_INTERRUPTS(reg) ENABLE_INTERRUPTS reg
69 .macro ENABLE_INTERRUPTS reg
71 or3 \reg, \reg, #0x0040
75 #define DISABLE_INTERRUPTS(reg) DISABLE_INTERRUPTS reg
76 .macro DISABLE_INTERRUPTS reg
78 and3 \reg, \reg, #0xffbf
81 #endif /* CONFIG_CHIP_M32102 */
98 #if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2)
107 #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
113 push r13 ; dummy push acc1h
114 push r13 ; dummy push acc1l
116 #error unknown isa configuration
119 push r13 ; syscall_nr (default: -1)
130 addi sp, #-4 ; room for implicit pt_regs parameter
151 addi r15, #4 ; Skip syscall number
152 #if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2)
161 #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
162 pop r13 ; dummy pop acc1h
163 pop r13 ; dummy pop acc1l
169 #error unknown isa configuration
175 addi sp, #8 ; Skip bbpsw, bbpc
181 addi sp, #4 ; Skip orig_r0
187 .section __ex_table,"a"
193 #define GET_CURRENT(reg) get_current reg
194 .macro get_current reg
199 #if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104))
200 .macro SWITCH_TO_KERNEL_STACK
201 ; switch to kernel stack (spi)
204 #else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
205 .macro SWITCH_TO_KERNEL_STACK
206 push r0 ; save r0 for working
208 and3 r0, r0, #0x00ff7f
211 bltz r0, 1f ; check BSM-bit
213 ;; called from kernel context: previous stack = spi
218 ;; called from user context: previous stack = spu
222 ld r0, @(-4,r0) ; retrieve r0
226 #endif /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
228 #endif /* __ASSEMBLY__ */
230 #endif /* _ASM_M32R_ASSEMBLER_H */