1 #ifndef __ASM_SH_SYSTEM_32_H
2 #define __ASM_SH_SYSTEM_32_H
4 #include <linux/types.h>
8 #define is_dsp_enabled(tsk) \
9 (!!(tsk->thread.dsp_status.status & SR_DSP))
11 #define __restore_dsp(tsk) \
13 register u32 *__ts2 __asm__ ("r2") = \
14 (u32 *)&tsk->thread.dsp_status; \
15 __asm__ __volatile__ ( \
17 "movs.l @r2+, a0\n\t" \
18 "movs.l @r2+, a1\n\t" \
19 "movs.l @r2+, a0g\n\t" \
20 "movs.l @r2+, a1g\n\t" \
21 "movs.l @r2+, m0\n\t" \
22 "movs.l @r2+, m1\n\t" \
23 "movs.l @r2+, x0\n\t" \
24 "movs.l @r2+, x1\n\t" \
25 "movs.l @r2+, y0\n\t" \
26 "movs.l @r2+, y1\n\t" \
27 "lds.l @r2+, dsr\n\t" \
28 "ldc.l @r2+, rs\n\t" \
29 "ldc.l @r2+, re\n\t" \
30 "ldc.l @r2+, mod\n\t" \
35 #define __save_dsp(tsk) \
37 register u32 *__ts2 __asm__ ("r2") = \
38 (u32 *)&tsk->thread.dsp_status + 14; \
40 __asm__ __volatile__ ( \
42 "stc.l mod, @-r2\n\t" \
43 "stc.l re, @-r2\n\t" \
44 "stc.l rs, @-r2\n\t" \
45 "sts.l dsr, @-r2\n\t" \
46 "movs.l y1, @-r2\n\t" \
47 "movs.l y0, @-r2\n\t" \
48 "movs.l x1, @-r2\n\t" \
49 "movs.l x0, @-r2\n\t" \
50 "movs.l m1, @-r2\n\t" \
51 "movs.l m0, @-r2\n\t" \
52 "movs.l a1g, @-r2\n\t" \
53 "movs.l a0g, @-r2\n\t" \
54 "movs.l a1, @-r2\n\t" \
55 "movs.l a0, @-r2\n\t" \
61 #define is_dsp_enabled(tsk) (0)
62 #define __save_dsp(tsk) do { } while (0)
63 #define __restore_dsp(tsk) do { } while (0)
66 #if defined(CONFIG_CPU_SH4A)
67 #define __icbi(addr) __asm__ __volatile__ ( "icbi @%0\n\t" : : "r" (addr))
69 #define __icbi(addr) mb()
72 #define __ocbp(addr) __asm__ __volatile__ ( "ocbp @%0\n\t" : : "r" (addr))
73 #define __ocbi(addr) __asm__ __volatile__ ( "ocbi @%0\n\t" : : "r" (addr))
74 #define __ocbwb(addr) __asm__ __volatile__ ( "ocbwb @%0\n\t" : : "r" (addr))
76 struct task_struct
*__switch_to(struct task_struct
*prev
,
77 struct task_struct
*next
);
80 * switch_to() should switch tasks to task nr n, first
82 #define switch_to(prev, next, last) \
84 register u32 *__ts1 __asm__ ("r1"); \
85 register u32 *__ts2 __asm__ ("r2"); \
86 register u32 *__ts4 __asm__ ("r4"); \
87 register u32 *__ts5 __asm__ ("r5"); \
88 register u32 *__ts6 __asm__ ("r6"); \
89 register u32 __ts7 __asm__ ("r7"); \
90 struct task_struct *__last; \
92 if (is_dsp_enabled(prev)) \
95 __ts1 = (u32 *)&prev->thread.sp; \
96 __ts2 = (u32 *)&prev->thread.pc; \
97 __ts4 = (u32 *)prev; \
98 __ts5 = (u32 *)next; \
99 __ts6 = (u32 *)&next->thread.sp; \
100 __ts7 = next->thread.pc; \
102 __asm__ __volatile__ ( \
104 "stc.l gbr, @-r15\n\t" \
105 "sts.l pr, @-r15\n\t" \
106 "mov.l r8, @-r15\n\t" \
107 "mov.l r9, @-r15\n\t" \
108 "mov.l r10, @-r15\n\t" \
109 "mov.l r11, @-r15\n\t" \
110 "mov.l r12, @-r15\n\t" \
111 "mov.l r13, @-r15\n\t" \
112 "mov.l r14, @-r15\n\t" \
113 "mov.l r15, @r1\t! save SP\n\t" \
114 "mov.l @r6, r15\t! change to new stack\n\t" \
116 "mov.l %0, @r2\t! save PC\n\t" \
118 "jmp @%0\t! call __switch_to\n\t" \
119 " lds r7, pr\t! with return to new PC\n\t" \
122 ".long __switch_to\n" \
124 "mov.l @r15+, r14\n\t" \
125 "mov.l @r15+, r13\n\t" \
126 "mov.l @r15+, r12\n\t" \
127 "mov.l @r15+, r11\n\t" \
128 "mov.l @r15+, r10\n\t" \
129 "mov.l @r15+, r9\n\t" \
130 "mov.l @r15+, r8\n\t" \
131 "lds.l @r15+, pr\n\t" \
132 "ldc.l @r15+, gbr\n\t" \
134 : "r" (__ts1), "r" (__ts2), "r" (__ts4), \
135 "r" (__ts5), "r" (__ts6), "r" (__ts7) \
141 #define finish_arch_switch(prev) \
143 if (is_dsp_enabled(prev)) \
144 __restore_dsp(prev); \
147 #define __uses_jump_to_uncached \
148 noinline __attribute__ ((__section__ (".uncached.text")))
151 * Jump to uncached area.
152 * When handling TLB or caches, we need to do it from an uncached area.
154 #define jump_to_uncached() \
156 unsigned long __dummy; \
158 __asm__ __volatile__( \
166 : "r" (cached_to_uncached)); \
170 * Back to cached area.
172 #define back_to_cached() \
174 unsigned long __dummy; \
176 __asm__ __volatile__( \
183 : "=&r" (__dummy)); \
186 #ifdef CONFIG_CPU_HAS_SR_RB
187 #define lookup_exception_vector() \
189 unsigned long _vec; \
191 __asm__ __volatile__ ( \
192 "stc r2_bank, %0\n\t" \
199 #define lookup_exception_vector() \
201 unsigned long _vec; \
202 __asm__ __volatile__ ( \
211 static inline reg_size_t
register_align(void *val
)
213 return (unsigned long)(signed long)val
;
216 int handle_unaligned_access(insn_size_t instruction
, struct pt_regs
*regs
,
217 struct mem_access
*ma
, int);
219 asmlinkage
void do_address_error(struct pt_regs
*regs
,
220 unsigned long writeaccess
,
221 unsigned long address
);
222 asmlinkage
void do_divide_error(unsigned long r4
, unsigned long r5
,
223 unsigned long r6
, unsigned long r7
,
224 struct pt_regs __regs
);
225 asmlinkage
void do_reserved_inst(unsigned long r4
, unsigned long r5
,
226 unsigned long r6
, unsigned long r7
,
227 struct pt_regs __regs
);
228 asmlinkage
void do_illegal_slot_inst(unsigned long r4
, unsigned long r5
,
229 unsigned long r6
, unsigned long r7
,
230 struct pt_regs __regs
);
231 asmlinkage
void do_exception_error(unsigned long r4
, unsigned long r5
,
232 unsigned long r6
, unsigned long r7
,
233 struct pt_regs __regs
);
235 #endif /* __ASM_SH_SYSTEM_32_H */