2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * arch/sh64/kernel/process.c
8 * Copyright (C) 2000, 2001 Paolo Alberelli
9 * Copyright (C) 2003 Paul Mundt
10 * Copyright (C) 2003, 2004 Richard Curnow
12 * Started from SH3/4 version:
13 * Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima
15 * In turn started from i386 version:
16 * Copyright (C) 1995 Linus Torvalds
21 * This file handles the architecture-dependent parts of process handling..
24 #include <linux/ptrace.h>
25 #include <linux/reboot.h>
26 #include <linux/init.h>
27 #include <linux/module.h>
28 #include <asm/uaccess.h>
29 #include <asm/pgtable.h>
31 struct task_struct
*last_task_used_math
= NULL
;
33 static int hlt_counter
= 1;
35 #define HARD_IDLE_TIMEOUT (HZ / 3)
37 void disable_hlt(void)
47 static int __init
nohlt_setup(char *__unused
)
53 static int __init
hlt_setup(char *__unused
)
59 __setup("nohlt", nohlt_setup
);
60 __setup("hlt", hlt_setup
);
62 static inline void hlt(void)
64 __asm__
__volatile__ ("sleep" : : : "memory");
68 * The idle loop on a uniprocessor SH..
72 /* endless idle loop with no priority at all */
75 while (!need_resched())
79 while (!need_resched()) {
86 preempt_enable_no_resched();
93 void machine_restart(char * __unused
)
95 extern void phys_stext(void);
100 void machine_halt(void)
105 void machine_power_off(void)
107 extern void enter_deep_standby(void);
109 enter_deep_standby();
112 void (*pm_power_off
)(void) = machine_power_off
;
113 EXPORT_SYMBOL(pm_power_off
);
115 void show_regs(struct pt_regs
* regs
)
117 unsigned long long ah
, al
, bh
, bl
, ch
, cl
;
121 ah
= (regs
->pc
) >> 32;
122 al
= (regs
->pc
) & 0xffffffff;
123 bh
= (regs
->regs
[18]) >> 32;
124 bl
= (regs
->regs
[18]) & 0xffffffff;
125 ch
= (regs
->regs
[15]) >> 32;
126 cl
= (regs
->regs
[15]) & 0xffffffff;
127 printk("PC : %08Lx%08Lx LINK: %08Lx%08Lx SP : %08Lx%08Lx\n",
128 ah
, al
, bh
, bl
, ch
, cl
);
130 ah
= (regs
->sr
) >> 32;
131 al
= (regs
->sr
) & 0xffffffff;
132 asm volatile ("getcon " __TEA
", %0" : "=r" (bh
));
133 asm volatile ("getcon " __TEA
", %0" : "=r" (bl
));
135 bl
= (bl
) & 0xffffffff;
136 asm volatile ("getcon " __KCR0
", %0" : "=r" (ch
));
137 asm volatile ("getcon " __KCR0
", %0" : "=r" (cl
));
139 cl
= (cl
) & 0xffffffff;
140 printk("SR : %08Lx%08Lx TEA : %08Lx%08Lx KCR0: %08Lx%08Lx\n",
141 ah
, al
, bh
, bl
, ch
, cl
);
143 ah
= (regs
->regs
[0]) >> 32;
144 al
= (regs
->regs
[0]) & 0xffffffff;
145 bh
= (regs
->regs
[1]) >> 32;
146 bl
= (regs
->regs
[1]) & 0xffffffff;
147 ch
= (regs
->regs
[2]) >> 32;
148 cl
= (regs
->regs
[2]) & 0xffffffff;
149 printk("R0 : %08Lx%08Lx R1 : %08Lx%08Lx R2 : %08Lx%08Lx\n",
150 ah
, al
, bh
, bl
, ch
, cl
);
152 ah
= (regs
->regs
[3]) >> 32;
153 al
= (regs
->regs
[3]) & 0xffffffff;
154 bh
= (regs
->regs
[4]) >> 32;
155 bl
= (regs
->regs
[4]) & 0xffffffff;
156 ch
= (regs
->regs
[5]) >> 32;
157 cl
= (regs
->regs
[5]) & 0xffffffff;
158 printk("R3 : %08Lx%08Lx R4 : %08Lx%08Lx R5 : %08Lx%08Lx\n",
159 ah
, al
, bh
, bl
, ch
, cl
);
161 ah
= (regs
->regs
[6]) >> 32;
162 al
= (regs
->regs
[6]) & 0xffffffff;
163 bh
= (regs
->regs
[7]) >> 32;
164 bl
= (regs
->regs
[7]) & 0xffffffff;
165 ch
= (regs
->regs
[8]) >> 32;
166 cl
= (regs
->regs
[8]) & 0xffffffff;
167 printk("R6 : %08Lx%08Lx R7 : %08Lx%08Lx R8 : %08Lx%08Lx\n",
168 ah
, al
, bh
, bl
, ch
, cl
);
170 ah
= (regs
->regs
[9]) >> 32;
171 al
= (regs
->regs
[9]) & 0xffffffff;
172 bh
= (regs
->regs
[10]) >> 32;
173 bl
= (regs
->regs
[10]) & 0xffffffff;
174 ch
= (regs
->regs
[11]) >> 32;
175 cl
= (regs
->regs
[11]) & 0xffffffff;
176 printk("R9 : %08Lx%08Lx R10 : %08Lx%08Lx R11 : %08Lx%08Lx\n",
177 ah
, al
, bh
, bl
, ch
, cl
);
179 ah
= (regs
->regs
[12]) >> 32;
180 al
= (regs
->regs
[12]) & 0xffffffff;
181 bh
= (regs
->regs
[13]) >> 32;
182 bl
= (regs
->regs
[13]) & 0xffffffff;
183 ch
= (regs
->regs
[14]) >> 32;
184 cl
= (regs
->regs
[14]) & 0xffffffff;
185 printk("R12 : %08Lx%08Lx R13 : %08Lx%08Lx R14 : %08Lx%08Lx\n",
186 ah
, al
, bh
, bl
, ch
, cl
);
188 ah
= (regs
->regs
[16]) >> 32;
189 al
= (regs
->regs
[16]) & 0xffffffff;
190 bh
= (regs
->regs
[17]) >> 32;
191 bl
= (regs
->regs
[17]) & 0xffffffff;
192 ch
= (regs
->regs
[19]) >> 32;
193 cl
= (regs
->regs
[19]) & 0xffffffff;
194 printk("R16 : %08Lx%08Lx R17 : %08Lx%08Lx R19 : %08Lx%08Lx\n",
195 ah
, al
, bh
, bl
, ch
, cl
);
197 ah
= (regs
->regs
[20]) >> 32;
198 al
= (regs
->regs
[20]) & 0xffffffff;
199 bh
= (regs
->regs
[21]) >> 32;
200 bl
= (regs
->regs
[21]) & 0xffffffff;
201 ch
= (regs
->regs
[22]) >> 32;
202 cl
= (regs
->regs
[22]) & 0xffffffff;
203 printk("R20 : %08Lx%08Lx R21 : %08Lx%08Lx R22 : %08Lx%08Lx\n",
204 ah
, al
, bh
, bl
, ch
, cl
);
206 ah
= (regs
->regs
[23]) >> 32;
207 al
= (regs
->regs
[23]) & 0xffffffff;
208 bh
= (regs
->regs
[24]) >> 32;
209 bl
= (regs
->regs
[24]) & 0xffffffff;
210 ch
= (regs
->regs
[25]) >> 32;
211 cl
= (regs
->regs
[25]) & 0xffffffff;
212 printk("R23 : %08Lx%08Lx R24 : %08Lx%08Lx R25 : %08Lx%08Lx\n",
213 ah
, al
, bh
, bl
, ch
, cl
);
215 ah
= (regs
->regs
[26]) >> 32;
216 al
= (regs
->regs
[26]) & 0xffffffff;
217 bh
= (regs
->regs
[27]) >> 32;
218 bl
= (regs
->regs
[27]) & 0xffffffff;
219 ch
= (regs
->regs
[28]) >> 32;
220 cl
= (regs
->regs
[28]) & 0xffffffff;
221 printk("R26 : %08Lx%08Lx R27 : %08Lx%08Lx R28 : %08Lx%08Lx\n",
222 ah
, al
, bh
, bl
, ch
, cl
);
224 ah
= (regs
->regs
[29]) >> 32;
225 al
= (regs
->regs
[29]) & 0xffffffff;
226 bh
= (regs
->regs
[30]) >> 32;
227 bl
= (regs
->regs
[30]) & 0xffffffff;
228 ch
= (regs
->regs
[31]) >> 32;
229 cl
= (regs
->regs
[31]) & 0xffffffff;
230 printk("R29 : %08Lx%08Lx R30 : %08Lx%08Lx R31 : %08Lx%08Lx\n",
231 ah
, al
, bh
, bl
, ch
, cl
);
233 ah
= (regs
->regs
[32]) >> 32;
234 al
= (regs
->regs
[32]) & 0xffffffff;
235 bh
= (regs
->regs
[33]) >> 32;
236 bl
= (regs
->regs
[33]) & 0xffffffff;
237 ch
= (regs
->regs
[34]) >> 32;
238 cl
= (regs
->regs
[34]) & 0xffffffff;
239 printk("R32 : %08Lx%08Lx R33 : %08Lx%08Lx R34 : %08Lx%08Lx\n",
240 ah
, al
, bh
, bl
, ch
, cl
);
242 ah
= (regs
->regs
[35]) >> 32;
243 al
= (regs
->regs
[35]) & 0xffffffff;
244 bh
= (regs
->regs
[36]) >> 32;
245 bl
= (regs
->regs
[36]) & 0xffffffff;
246 ch
= (regs
->regs
[37]) >> 32;
247 cl
= (regs
->regs
[37]) & 0xffffffff;
248 printk("R35 : %08Lx%08Lx R36 : %08Lx%08Lx R37 : %08Lx%08Lx\n",
249 ah
, al
, bh
, bl
, ch
, cl
);
251 ah
= (regs
->regs
[38]) >> 32;
252 al
= (regs
->regs
[38]) & 0xffffffff;
253 bh
= (regs
->regs
[39]) >> 32;
254 bl
= (regs
->regs
[39]) & 0xffffffff;
255 ch
= (regs
->regs
[40]) >> 32;
256 cl
= (regs
->regs
[40]) & 0xffffffff;
257 printk("R38 : %08Lx%08Lx R39 : %08Lx%08Lx R40 : %08Lx%08Lx\n",
258 ah
, al
, bh
, bl
, ch
, cl
);
260 ah
= (regs
->regs
[41]) >> 32;
261 al
= (regs
->regs
[41]) & 0xffffffff;
262 bh
= (regs
->regs
[42]) >> 32;
263 bl
= (regs
->regs
[42]) & 0xffffffff;
264 ch
= (regs
->regs
[43]) >> 32;
265 cl
= (regs
->regs
[43]) & 0xffffffff;
266 printk("R41 : %08Lx%08Lx R42 : %08Lx%08Lx R43 : %08Lx%08Lx\n",
267 ah
, al
, bh
, bl
, ch
, cl
);
269 ah
= (regs
->regs
[44]) >> 32;
270 al
= (regs
->regs
[44]) & 0xffffffff;
271 bh
= (regs
->regs
[45]) >> 32;
272 bl
= (regs
->regs
[45]) & 0xffffffff;
273 ch
= (regs
->regs
[46]) >> 32;
274 cl
= (regs
->regs
[46]) & 0xffffffff;
275 printk("R44 : %08Lx%08Lx R45 : %08Lx%08Lx R46 : %08Lx%08Lx\n",
276 ah
, al
, bh
, bl
, ch
, cl
);
278 ah
= (regs
->regs
[47]) >> 32;
279 al
= (regs
->regs
[47]) & 0xffffffff;
280 bh
= (regs
->regs
[48]) >> 32;
281 bl
= (regs
->regs
[48]) & 0xffffffff;
282 ch
= (regs
->regs
[49]) >> 32;
283 cl
= (regs
->regs
[49]) & 0xffffffff;
284 printk("R47 : %08Lx%08Lx R48 : %08Lx%08Lx R49 : %08Lx%08Lx\n",
285 ah
, al
, bh
, bl
, ch
, cl
);
287 ah
= (regs
->regs
[50]) >> 32;
288 al
= (regs
->regs
[50]) & 0xffffffff;
289 bh
= (regs
->regs
[51]) >> 32;
290 bl
= (regs
->regs
[51]) & 0xffffffff;
291 ch
= (regs
->regs
[52]) >> 32;
292 cl
= (regs
->regs
[52]) & 0xffffffff;
293 printk("R50 : %08Lx%08Lx R51 : %08Lx%08Lx R52 : %08Lx%08Lx\n",
294 ah
, al
, bh
, bl
, ch
, cl
);
296 ah
= (regs
->regs
[53]) >> 32;
297 al
= (regs
->regs
[53]) & 0xffffffff;
298 bh
= (regs
->regs
[54]) >> 32;
299 bl
= (regs
->regs
[54]) & 0xffffffff;
300 ch
= (regs
->regs
[55]) >> 32;
301 cl
= (regs
->regs
[55]) & 0xffffffff;
302 printk("R53 : %08Lx%08Lx R54 : %08Lx%08Lx R55 : %08Lx%08Lx\n",
303 ah
, al
, bh
, bl
, ch
, cl
);
305 ah
= (regs
->regs
[56]) >> 32;
306 al
= (regs
->regs
[56]) & 0xffffffff;
307 bh
= (regs
->regs
[57]) >> 32;
308 bl
= (regs
->regs
[57]) & 0xffffffff;
309 ch
= (regs
->regs
[58]) >> 32;
310 cl
= (regs
->regs
[58]) & 0xffffffff;
311 printk("R56 : %08Lx%08Lx R57 : %08Lx%08Lx R58 : %08Lx%08Lx\n",
312 ah
, al
, bh
, bl
, ch
, cl
);
314 ah
= (regs
->regs
[59]) >> 32;
315 al
= (regs
->regs
[59]) & 0xffffffff;
316 bh
= (regs
->regs
[60]) >> 32;
317 bl
= (regs
->regs
[60]) & 0xffffffff;
318 ch
= (regs
->regs
[61]) >> 32;
319 cl
= (regs
->regs
[61]) & 0xffffffff;
320 printk("R59 : %08Lx%08Lx R60 : %08Lx%08Lx R61 : %08Lx%08Lx\n",
321 ah
, al
, bh
, bl
, ch
, cl
);
323 ah
= (regs
->regs
[62]) >> 32;
324 al
= (regs
->regs
[62]) & 0xffffffff;
325 bh
= (regs
->tregs
[0]) >> 32;
326 bl
= (regs
->tregs
[0]) & 0xffffffff;
327 ch
= (regs
->tregs
[1]) >> 32;
328 cl
= (regs
->tregs
[1]) & 0xffffffff;
329 printk("R62 : %08Lx%08Lx T0 : %08Lx%08Lx T1 : %08Lx%08Lx\n",
330 ah
, al
, bh
, bl
, ch
, cl
);
332 ah
= (regs
->tregs
[2]) >> 32;
333 al
= (regs
->tregs
[2]) & 0xffffffff;
334 bh
= (regs
->tregs
[3]) >> 32;
335 bl
= (regs
->tregs
[3]) & 0xffffffff;
336 ch
= (regs
->tregs
[4]) >> 32;
337 cl
= (regs
->tregs
[4]) & 0xffffffff;
338 printk("T2 : %08Lx%08Lx T3 : %08Lx%08Lx T4 : %08Lx%08Lx\n",
339 ah
, al
, bh
, bl
, ch
, cl
);
341 ah
= (regs
->tregs
[5]) >> 32;
342 al
= (regs
->tregs
[5]) & 0xffffffff;
343 bh
= (regs
->tregs
[6]) >> 32;
344 bl
= (regs
->tregs
[6]) & 0xffffffff;
345 ch
= (regs
->tregs
[7]) >> 32;
346 cl
= (regs
->tregs
[7]) & 0xffffffff;
347 printk("T5 : %08Lx%08Lx T6 : %08Lx%08Lx T7 : %08Lx%08Lx\n",
348 ah
, al
, bh
, bl
, ch
, cl
);
351 * If we're in kernel mode, dump the stack too..
353 if (!user_mode(regs
)) {
354 void show_stack(struct task_struct
*tsk
, unsigned long *sp
);
355 unsigned long sp
= regs
->regs
[15] & 0xffffffff;
356 struct task_struct
*tsk
= get_current();
358 tsk
->thread
.kregs
= regs
;
360 show_stack(tsk
, (unsigned long *)sp
);
364 struct task_struct
* alloc_task_struct(void)
366 /* Get task descriptor pages */
367 return (struct task_struct
*)
368 __get_free_pages(GFP_KERNEL
, get_order(THREAD_SIZE
));
371 void free_task_struct(struct task_struct
*p
)
373 free_pages((unsigned long) p
, get_order(THREAD_SIZE
));
377 * Create a kernel thread
379 ATTRIB_NORET
void kernel_thread_helper(void *arg
, int (*fn
)(void *))
385 * This is the mechanism for creating a new kernel thread.
387 * NOTE! Only a kernel-only process(ie the swapper or direct descendants
388 * who haven't done an "execve()") should use this: it will work within
389 * a system call from a "real" process, but the process memory space will
390 * not be free'd until both the parent and the child have exited.
392 int kernel_thread(int (*fn
)(void *), void * arg
, unsigned long flags
)
396 memset(®s
, 0, sizeof(regs
));
397 regs
.regs
[2] = (unsigned long)arg
;
398 regs
.regs
[3] = (unsigned long)fn
;
400 regs
.pc
= (unsigned long)kernel_thread_helper
;
403 return do_fork(flags
| CLONE_VM
| CLONE_UNTRACED
, 0,
404 ®s
, 0, NULL
, NULL
);
408 * Free current thread data structures etc..
410 void exit_thread(void)
412 /* See arch/sparc/kernel/process.c for the precedent for doing this -- RPC.
414 The SH-5 FPU save/restore approach relies on last_task_used_math
415 pointing to a live task_struct. When another task tries to use the
416 FPU for the 1st time, the FPUDIS trap handling (see
417 arch/sh64/kernel/fpu.c) will save the existing FPU state to the
418 FP regs field within last_task_used_math before re-loading the new
419 task's FPU state (or initialising it if the FPU has been used
420 before). So if last_task_used_math is stale, and its page has already been
421 re-allocated for another use, the consequences are rather grim. Unless we
422 null it here, there is no other path through which it would get safely
426 if (last_task_used_math
== current
) {
427 last_task_used_math
= NULL
;
432 void flush_thread(void)
435 /* Called by fs/exec.c (flush_old_exec) to remove traces of a
436 * previously running executable. */
438 if (last_task_used_math
== current
) {
439 last_task_used_math
= NULL
;
441 /* Force FPU state to be reinitialised after exec */
445 /* if we are a kernel thread, about to change to user thread,
448 if(current
->thread
.kregs
==&fake_swapper_regs
) {
449 current
->thread
.kregs
=
450 ((struct pt_regs
*)(THREAD_SIZE
+ (unsigned long) current
) - 1);
451 current
->thread
.uregs
= current
->thread
.kregs
;
455 void release_thread(struct task_struct
*dead_task
)
460 /* Fill in the fpu structure for a core dump.. */
461 int dump_fpu(struct pt_regs
*regs
, elf_fpregset_t
*fpu
)
465 struct task_struct
*tsk
= current
;
467 fpvalid
= !!tsk_used_math(tsk
);
469 if (current
== last_task_used_math
) {
471 fpsave(&tsk
->thread
.fpu
.hard
);
473 last_task_used_math
= 0;
477 memcpy(fpu
, &tsk
->thread
.fpu
.hard
, sizeof(*fpu
));
482 return 0; /* Task didn't use the fpu at all. */
486 asmlinkage
void ret_from_fork(void);
488 int copy_thread(int nr
, unsigned long clone_flags
, unsigned long usp
,
489 unsigned long unused
,
490 struct task_struct
*p
, struct pt_regs
*regs
)
492 struct pt_regs
*childregs
;
493 unsigned long long se
; /* Sign extension */
496 if(last_task_used_math
== current
) {
498 fpsave(¤t
->thread
.fpu
.hard
);
500 last_task_used_math
= NULL
;
504 /* Copy from sh version */
505 childregs
= (struct pt_regs
*)(THREAD_SIZE
+ task_stack_page(p
)) - 1;
509 if (user_mode(regs
)) {
510 childregs
->regs
[15] = usp
;
511 p
->thread
.uregs
= childregs
;
513 childregs
->regs
[15] = (unsigned long)task_stack_page(p
) + THREAD_SIZE
;
516 childregs
->regs
[9] = 0; /* Set return value for child */
517 childregs
->sr
|= SR_FD
; /* Invalidate FPU flag */
519 p
->thread
.sp
= (unsigned long) childregs
;
520 p
->thread
.pc
= (unsigned long) ret_from_fork
;
523 * Sign extend the edited stack.
524 * Note that thread.pc and thread.pc will stay
525 * 32-bit wide and context switch must take care
526 * of NEFF sign extension.
529 se
= childregs
->regs
[15];
530 se
= (se
& NEFF_SIGN
) ? (se
| NEFF_MASK
) : se
;
531 childregs
->regs
[15] = se
;
536 asmlinkage
int sys_fork(unsigned long r2
, unsigned long r3
,
537 unsigned long r4
, unsigned long r5
,
538 unsigned long r6
, unsigned long r7
,
539 struct pt_regs
*pregs
)
541 return do_fork(SIGCHLD
, pregs
->regs
[15], pregs
, 0, 0, 0);
544 asmlinkage
int sys_clone(unsigned long clone_flags
, unsigned long newsp
,
545 unsigned long r4
, unsigned long r5
,
546 unsigned long r6
, unsigned long r7
,
547 struct pt_regs
*pregs
)
550 newsp
= pregs
->regs
[15];
551 return do_fork(clone_flags
, newsp
, pregs
, 0, 0, 0);
555 * This is trivial, and on the face of it looks like it
556 * could equally well be done in user mode.
558 * Not so, for quite unobvious reasons - register pressure.
559 * In user mode vfork() cannot have a stack frame, and if
560 * done by calling the "clone()" system call directly, you
561 * do not have enough call-clobbered registers to hold all
562 * the information you need.
564 asmlinkage
int sys_vfork(unsigned long r2
, unsigned long r3
,
565 unsigned long r4
, unsigned long r5
,
566 unsigned long r6
, unsigned long r7
,
567 struct pt_regs
*pregs
)
569 return do_fork(CLONE_VFORK
| CLONE_VM
| SIGCHLD
, pregs
->regs
[15], pregs
, 0, 0, 0);
573 * sys_execve() executes a new program.
575 asmlinkage
int sys_execve(char *ufilename
, char **uargv
,
576 char **uenvp
, unsigned long r5
,
577 unsigned long r6
, unsigned long r7
,
578 struct pt_regs
*pregs
)
584 filename
= getname((char __user
*)ufilename
);
585 error
= PTR_ERR(filename
);
586 if (IS_ERR(filename
))
589 error
= do_execve(filename
,
590 (char __user
* __user
*)uargv
,
591 (char __user
* __user
*)uenvp
,
595 current
->ptrace
&= ~PT_DTRACE
;
596 task_unlock(current
);
605 * These bracket the sleeping functions..
607 extern void interruptible_sleep_on(wait_queue_head_t
*q
);
609 #define mid_sched ((unsigned long) interruptible_sleep_on)
611 static int in_sh64_switch_to(unsigned long pc
)
613 extern char __sh64_switch_to_end
;
614 /* For a sleeping task, the PC is somewhere in the middle of the function,
615 so we don't have to worry about masking the LSB off */
616 return (pc
>= (unsigned long) sh64_switch_to
) &&
617 (pc
< (unsigned long) &__sh64_switch_to_end
);
620 unsigned long get_wchan(struct task_struct
*p
)
622 unsigned long schedule_fp
;
623 unsigned long sh64_switch_to_fp
;
624 unsigned long schedule_caller_pc
;
627 if (!p
|| p
== current
|| p
->state
== TASK_RUNNING
)
631 * The same comment as on the Alpha applies here, too ...
633 pc
= thread_saved_pc(p
);
635 #ifdef CONFIG_FRAME_POINTER
636 if (in_sh64_switch_to(pc
)) {
637 sh64_switch_to_fp
= (long) p
->thread
.sp
;
638 /* r14 is saved at offset 4 in the sh64_switch_to frame */
639 schedule_fp
= *(unsigned long *) (long)(sh64_switch_to_fp
+ 4);
641 /* and the caller of 'schedule' is (currently!) saved at offset 24
642 in the frame of schedule (from disasm) */
643 schedule_caller_pc
= *(unsigned long *) (long)(schedule_fp
+ 24);
644 return schedule_caller_pc
;
650 /* Provide a /proc/asids file that lists out the
651 ASIDs currently associated with the processes. (If the DM.PC register is
652 examined through the debug link, this shows ASID + PC. To make use of this,
653 the PID->ASID relationship needs to be known. This is primarily for
657 #if defined(CONFIG_SH64_PROC_ASIDS)
658 #include <linux/init.h>
659 #include <linux/proc_fs.h>
662 asids_proc_info(char *buf
, char **start
, off_t fpos
, int length
, int *eof
, void *data
)
665 struct task_struct
*p
;
666 read_lock(&tasklist_lock
);
667 for_each_process(p
) {
669 struct mm_struct
*mm
;
673 unsigned long asid
, context
;
674 context
= mm
->context
;
675 asid
= (context
& 0xff);
676 len
+= sprintf(buf
+len
, "%5d : %02lx\n", pid
, asid
);
678 len
+= sprintf(buf
+len
, "%5d : (none)\n", pid
);
681 read_unlock(&tasklist_lock
);
686 static int __init
register_proc_asids(void)
688 create_proc_read_entry("asids", 0, NULL
, asids_proc_info
, NULL
);
692 __initcall(register_proc_asids
);