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.
22 #define M32R_LOCK __STR(lock)
23 #define M32R_UNLOCK __STR(unlock)
25 #define M32R_LOCK __STR(ld)
26 #define M32R_UNLOCK __STR(st)
31 #define ENTRY(name) ENTRY_M name
41 * LDIMM - load immediate value
42 * STI - enable interruption
43 * CLI - disable interruption
48 #define LDIMM(reg,x) LDIMM reg x
51 or3 \reg, \reg, #low(\x)
54 #if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104))
55 #define STI(reg) STI_M reg
58 ; WORKAROUND: "-> nop" is a workaround for the M32700(TS1).
61 #define CLI(reg) CLI_M reg
64 ; WORKAROUND: "-> nop" is a workaround for the M32700(TS1).
66 #else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
67 #define STI(reg) STI_M reg
70 or3 \reg, \reg, #0x0040
74 #define CLI(reg) CLI_M reg
77 and3 \reg, \reg, #0xffbf
80 #endif /* CONFIG_CHIP_M32102 */
97 #if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2)
106 #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
112 push r13 ; dummy push acc1h
113 push r13 ; dummy push acc1l
115 #error unknown isa configuration
118 push r13 ; syscall_nr (default: -1)
129 addi sp, #-4 ; room for implicit pt_regs parameter
150 addi r15, #4 ; Skip syscall number
151 #if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2)
160 #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
161 pop r13 ; dummy pop acc1h
162 pop r13 ; dummy pop acc1l
168 #error unknown isa configuration
174 addi sp, #8 ; Skip bbpsw, bbpc
180 addi sp, #4 ; Skip orig_r0
186 .section __ex_table,"a"
192 #define GET_CURRENT(reg) get_current reg
193 .macro get_current reg
198 #if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104))
199 .macro SWITCH_TO_KERNEL_STACK
200 ; switch to kernel stack (spi)
203 #else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
204 .macro SWITCH_TO_KERNEL_STACK
205 push r0 ; save r0 for working
207 and3 r0, r0, #0x00ff7f
210 bltz r0, 1f ; check BSM-bit
212 ;; called from kernel context: previous stack = spi
217 ;; called from user context: previous stack = spu
221 ld r0, @(-4,r0) ; retrieve r0
225 #endif /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
227 #endif /* __ASSEMBLY__ */
229 #endif /* _ASM_M32R_ASSEMBLER_H */