~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/asm-sh/processor.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * include/asm-sh/processor.h
  3  *
  4  * Copyright (C) 1999, 2000  Niibe Yutaka
  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  * Default implementation of macro that returns current
 16  * instruction pointer ("program counter").
 17  */
 18 #define current_text_addr() ({ void *pc; __asm__("mova  1f, %0\n1:":"=z" (pc)); pc; })
 19 
 20 /*
 21  *  CPU type and hardware bug flags. Kept separately for each CPU.
 22  */
 23 enum cpu_type {
 24         CPU_SH7708,             /* Represents 7707, 7708, 7708S, 7708R, 7709 */
 25         CPU_SH7729,             /* Represents 7709A, 7729 */
 26         CPU_SH7750,
 27         CPU_SH_NONE
 28 };
 29 
 30 struct sh_cpuinfo {
 31         enum cpu_type type;
 32         unsigned long loops_per_jiffy;
 33 
 34         char    hard_math;
 35 
 36         unsigned long *pgd_quick;
 37         unsigned long *pte_quick;
 38         unsigned long pgtable_cache_sz;
 39         unsigned int cpu_clock, master_clock, bus_clock, module_clock;
 40 };
 41 
 42 extern struct sh_cpuinfo boot_cpu_data;
 43 
 44 #define cpu_data (&boot_cpu_data)
 45 #define current_cpu_data boot_cpu_data
 46 
 47 /*
 48  * User space process size: 2GB.
 49  *
 50  * Since SH7709 and SH7750 have "area 7", we can't use 0x7c000000--0x7fffffff
 51  */
 52 #define TASK_SIZE       0x7c000000UL
 53 
 54 /* This decides where the kernel will search for a free chunk of vm
 55  * space during mmap's.
 56  */
 57 #define TASK_UNMAPPED_BASE      (TASK_SIZE / 3)
 58 
 59 /*
 60  * Bit of SR register
 61  *
 62  * FD-bit:
 63  *     When it's set, it means the processor doesn't have right to use FPU,
 64  *     and it results exception when the floating operation is executed.
 65  *
 66  * IMASK-bit:
 67  *     Interrupt level mask
 68  */
 69 #define SR_FD    0x00008000
 70 #define SR_IMASK 0x000000f0
 71 
 72 /*
 73  * FPU structure and data
 74  */
 75 
 76 struct sh_fpu_hard_struct {
 77         unsigned long fp_regs[16];
 78         unsigned long long xd_regs[8];
 79         unsigned long fpscr;
 80         unsigned long fpul;
 81 
 82         long status; /* software status information */
 83 };
 84 
 85 /* Dummy fpu emulator  */
 86 struct sh_fpu_soft_struct {
 87         unsigned long fp_regs[16];
 88         unsigned long long xd_regs[8];
 89         unsigned long fpscr;
 90         unsigned long fpul;
 91 
 92         unsigned char lookahead;
 93         unsigned long entry_pc;
 94 };
 95 
 96 union sh_fpu_union {
 97         struct sh_fpu_hard_struct hard;
 98         struct sh_fpu_soft_struct soft;
 99 };
100 
101 struct thread_struct {
102         unsigned long sp;
103         unsigned long pc;
104 
105         unsigned long trap_no, error_code;
106         unsigned long address;
107         /* Hardware debugging registers may come here */
108 
109         /* floating point info */
110         union sh_fpu_union fpu;
111 };
112 
113 #define INIT_MMAP \
114 { &init_mm, 0x80000000, 0xa0000000, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
115 
116 #define INIT_THREAD  {                                          \
117         sizeof(init_stack) + (long) &init_stack, /* sp */       \
118         0,                                       /* pc */       \
119         0, 0,                                                   \
120         0,                                                      \
121         {{{0,}},}                               /* fpu state */ \
122 }
123 
124 /*
125  * Do necessary setup to start up a newly executed thread.
126  */
127 #define start_thread(regs, new_pc, new_sp)       \
128         set_fs(USER_DS);                         \
129         regs->pr = 0;                            \
130         regs->sr = 0;           /* User mode. */ \
131         regs->pc = new_pc;                       \
132         regs->regs[15] = new_sp
133 
134 /* Forward declaration, a strange C thing */
135 struct task_struct;
136 struct mm_struct;
137 
138 /* Free all resources held by a thread. */
139 extern void release_thread(struct task_struct *);
140 /*
141  * create a kernel thread without removing it from tasklists
142  */
143 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
144 
145 /*
146  * Bus types
147  */
148 #define EISA_bus 0
149 #define EISA_bus__is_a_macro /* for versions in ksyms.c */
150 #define MCA_bus 0
151 #define MCA_bus__is_a_macro /* for versions in ksyms.c */
152 
153 
154 /* Copy and release all segment info associated with a VM */
155 #define copy_segments(p, mm)    do { } while(0)
156 #define release_segments(mm)    do { } while(0)
157 
158 /*
159  * FPU lazy state save handling.
160  */
161 
162 extern __inline__ void release_fpu(void)
163 {
164         unsigned long __dummy;
165 
166         /* Set FD flag in SR */
167         __asm__ __volatile__("stc       sr, %0\n\t"
168                              "or        %1, %0\n\t"
169                              "ldc       %0, sr"
170                              : "=&r" (__dummy)
171                              : "r" (SR_FD));
172 }
173 
174 extern __inline__ void grab_fpu(void)
175 {
176         unsigned long __dummy;
177 
178         /* Clear out FD flag in SR */
179         __asm__ __volatile__("stc       sr, %0\n\t"
180                              "and       %1, %0\n\t"
181                              "ldc       %0, sr"
182                              : "=&r" (__dummy)
183                              : "r" (~SR_FD));
184 }
185 
186 extern void save_fpu(struct task_struct *__tsk);
187 
188 #define unlazy_fpu(tsk) do {                    \
189         if ((tsk)->flags & PF_USEDFPU) {        \
190                 grab_fpu();                     \
191                 save_fpu(tsk);                  \
192         }                                       \
193 } while (0)
194 
195 #define clear_fpu(tsk) do {                     \
196         if ((tsk)->flags & PF_USEDFPU)          \
197                 (tsk)->flags &= ~PF_USEDFPU;    \
198 } while (0)
199 
200 /* Double presision, NANS as NANS, rounding to nearest, no exceptions */
201 #define FPSCR_INIT  0x00080000
202 
203 /*
204  * Return saved PC of a blocked thread.
205  */
206 extern __inline__ unsigned long thread_saved_pc(struct thread_struct *t)
207 {
208         return t->pc;
209 }
210 
211 extern unsigned long get_wchan(struct task_struct *p);
212 
213 #define KSTK_EIP(tsk)  ((tsk)->thread.pc)
214 #define KSTK_ESP(tsk)  ((tsk)->thread.sp)
215 
216 #define THREAD_SIZE (2*PAGE_SIZE)
217 extern struct task_struct * alloc_task_struct(void);
218 extern void free_task_struct(struct task_struct *);
219 #define get_task_struct(tsk)      atomic_inc(&virt_to_page(tsk)->count)
220 
221 #define init_task       (init_task_union.task)
222 #define init_stack      (init_task_union.stack)
223 
224 #endif /* __ASM_SH_PROCESSOR_H */
225 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.