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/config.h>
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 STI(reg) STI_M reg
59 ; WORKAROUND: "-> nop" is a workaround for the M32700(TS1).
62 #define CLI(reg) CLI_M reg
65 ; WORKAROUND: "-> nop" is a workaround for the M32700(TS1).
67 #else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
68 #define STI(reg) STI_M reg
71 or3 \reg, \reg, #0x0040
75 #define CLI(reg) CLI_M 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 #error unknown isa configuration
116 push r13 ; syscall_nr (default: -1)
127 addi sp, #-4 ; room for implicit pt_regs parameter
148 addi r15, #4 ; Skip syscall number
149 #if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2)
158 #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
164 #error unknown isa configuration
170 addi sp, #8 ; Skip bbpsw, bbpc
176 addi sp, #4 ; Skip orig_r0
182 .section __ex_table,"a"
188 #define GET_CURRENT(reg) get_current reg
189 .macro get_current reg
194 #if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104))
195 .macro SWITCH_TO_KERNEL_STACK
196 ; switch to kernel stack (spi)
199 #else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
200 .macro SWITCH_TO_KERNEL_STACK
201 push r0 ; save r0 for working
203 and3 r0, r0, #0x00ff7f
206 bltz r0, 1f ; check BSM-bit
208 ;; called from kernel context: previous stack = spi
213 ;; called from user context: previous stack = spu
217 ld r0, @(-4,r0) ; retrieve r0
221 #endif /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
223 #endif /* __ASSEMBLY__ */
225 #endif /* _ASM_M32R_ASSEMBLER_H */