1
2
3
4
5
6
7#ifndef __ASM_SH_PROCESSOR_H
8#define __ASM_SH_PROCESSOR_H
9
10#include <asm/page.h>
11#include <asm/types.h>
12#include <linux/threads.h>
13
14
15
16
17
18#define current_text_addr() ({ void *pc; __asm__("mova 1f, %0\n1:":"=z" (pc)); pc; })
19
20
21
22
23enum cpu_type {
24 CPU_SH7708,
25 CPU_SH7729,
26 CPU_SH7750,
27 CPU_ST40,
28 CPU_SH4202,
29 CPU_SH_NONE
30};
31
32struct sh_cpuinfo {
33 enum cpu_type type;
34 char hard_math;
35 unsigned long loops_per_jiffy;
36
37 unsigned int cpu_clock, master_clock, bus_clock, module_clock;
38#ifdef CONFIG_CPU_SUBTYPE_ST40
39 unsigned int memory_clock;
40#endif
41};
42
43extern struct sh_cpuinfo boot_cpu_data;
44
45#define cpu_data (&boot_cpu_data)
46#define current_cpu_data boot_cpu_data
47
48
49
50
51
52
53#define TASK_SIZE 0x7c000000UL
54
55
56
57
58#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)
59
60
61
62
63
64
65
66
67
68
69
70#define SR_FD 0x00008000
71#define SR_DSP 0x00001000
72#define SR_IMASK 0x000000f0
73
74
75
76
77
78struct sh_fpu_hard_struct {
79 unsigned long fp_regs[16];
80 unsigned long xfp_regs[16];
81 unsigned long fpscr;
82 unsigned long fpul;
83
84 long status;
85};
86
87
88struct sh_fpu_soft_struct {
89 unsigned long fp_regs[16];
90 unsigned long xfp_regs[16];
91 unsigned long fpscr;
92 unsigned long fpul;
93
94 unsigned char lookahead;
95 unsigned long entry_pc;
96};
97
98union sh_fpu_union {
99 struct sh_fpu_hard_struct hard;
100 struct sh_fpu_soft_struct soft;
101};
102
103struct thread_struct {
104 unsigned long sp;
105 unsigned long pc;
106
107 unsigned long trap_no, error_code;
108 unsigned long address;
109
110
111 unsigned long ubc_pc1, ubc_pc2;
112
113
114 union sh_fpu_union fpu;
115};
116
117
118extern int ubc_usercnt;
119
120#define INIT_THREAD { \
121 sizeof(init_stack) + (long) &init_stack, \
122 0, \
123 0, 0, \
124 0, \
125 0, -1, \
126 {{{0,}},} \
127}
128
129
130
131
132#define start_thread(regs, new_pc, new_sp) \
133 set_fs(USER_DS); \
134 regs->pr = 0; \
135 regs->sr = 0; \
136 regs->pc = new_pc; \
137 regs->regs[15] = new_sp
138
139
140struct task_struct;
141struct mm_struct;
142
143
144extern void release_thread(struct task_struct *);
145
146
147
148extern int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
149
150
151
152
153#define EISA_bus 0
154#define EISA_bus__is_a_macro
155#define MCA_bus 0
156#define MCA_bus__is_a_macro
157
158
159
160#define copy_segments(p, mm) do { } while(0)
161#define release_segments(mm) do { } while(0)
162
163
164
165
166
167static __inline__ void release_fpu(void)
168{
169 unsigned long __dummy;
170
171
172 __asm__ __volatile__("stc sr, %0\n\t"
173 "or %1, %0\n\t"
174 "ldc %0, sr"
175 : "=&r" (__dummy)
176 : "r" (SR_FD));
177}
178
179static __inline__ void grab_fpu(void)
180{
181 unsigned long __dummy;
182
183
184 __asm__ __volatile__("stc sr, %0\n\t"
185 "and %1, %0\n\t"
186 "ldc %0, sr"
187 : "=&r" (__dummy)
188 : "r" (~SR_FD));
189}
190
191extern void save_fpu(struct task_struct *__tsk);
192
193#define unlazy_fpu(tsk) do { \
194 if ((tsk)->flags & PF_USEDFPU) { \
195 save_fpu(tsk); \
196 } \
197} while (0)
198
199#define clear_fpu(tsk) do { \
200 if ((tsk)->flags & PF_USEDFPU) { \
201 (tsk)->flags &= ~PF_USEDFPU; \
202 release_fpu(); \
203 } \
204} while (0)
205
206
207#define FPSCR_INIT 0x00080000
208
209#define FPSCR_CAUSE_MASK 0x0001f000
210#define FPSCR_FLAG_MASK 0x0000007c
211
212
213
214
215static __inline__ unsigned long thread_saved_pc(struct thread_struct *t)
216{
217 return t->pc;
218}
219
220extern unsigned long get_wchan(struct task_struct *p);
221
222#define KSTK_EIP(tsk) ((tsk)->thread.pc)
223#define KSTK_ESP(tsk) ((tsk)->thread.sp)
224
225#define THREAD_SIZE (2*PAGE_SIZE)
226extern struct task_struct * alloc_task_struct(void);
227extern void free_task_struct(struct task_struct *);
228#define get_task_struct(tsk) atomic_inc(&virt_to_page(tsk)->count)
229
230#define init_task (init_task_union.task)
231#define init_stack (init_task_union.stack)
232
233#define cpu_relax() do { } while (0)
234
235#endif
236