47415671da0cbc3a8877ab7167802a4d29b20a9f
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..
25 #include <linux/ptrace.h>
26 #include <linux/reboot.h>
27 #include <linux/init.h>
28 #include <linux/module.h>
29 #include <linux/proc_fs.h>
31 #include <asm/uaccess.h>
32 #include <asm/pgtable.h>
34 struct task_struct
*last_task_used_math
= NULL
;
36 static int hlt_counter
= 1;
38 #define HARD_IDLE_TIMEOUT (HZ / 3)
40 void disable_hlt(void)
50 static int __init
nohlt_setup(char *__unused
)
56 static int __init
hlt_setup(char *__unused
)
62 __setup("nohlt", nohlt_setup
);
63 __setup("hlt", hlt_setup
);
65 static inline void hlt(void)
67 __asm__
__volatile__ ("sleep" : : : "memory");
71 * The idle loop on a uniprocessor SH..
75 /* endless idle loop with no priority at all */
78 while (!need_resched())
82 while (!need_resched()) {
89 preempt_enable_no_resched();
96 void machine_restart(char * __unused
)
98 extern void phys_stext(void);
103 void machine_halt(void)
108 void machine_power_off(void)
111 /* Disable watchdog timer */
112 ctrl_outl(0xa5000000, WTCSR
);
113 /* Configure deep standby on sleep */
114 ctrl_outl(0x03, STBCR
);
117 __asm__
__volatile__ (
120 "nop;nop;nop;nop\n\t"
123 panic("Unexpected wakeup!\n");
126 void (*pm_power_off
)(void) = machine_power_off
;
127 EXPORT_SYMBOL(pm_power_off
);
129 void show_regs(struct pt_regs
* regs
)
131 unsigned long long ah
, al
, bh
, bl
, ch
, cl
;
135 ah
= (regs
->pc
) >> 32;
136 al
= (regs
->pc
) & 0xffffffff;
137 bh
= (regs
->regs
[18]) >> 32;
138 bl
= (regs
->regs
[18]) & 0xffffffff;
139 ch
= (regs
->regs
[15]) >> 32;
140 cl
= (regs
->regs
[15]) & 0xffffffff;
141 printk("PC : %08Lx%08Lx LINK: %08Lx%08Lx SP : %08Lx%08Lx\n",
142 ah
, al
, bh
, bl
, ch
, cl
);
144 ah
= (regs
->sr
) >> 32;
145 al
= (regs
->sr
) & 0xffffffff;
146 asm volatile ("getcon " __TEA
", %0" : "=r" (bh
));
147 asm volatile ("getcon " __TEA
", %0" : "=r" (bl
));
149 bl
= (bl
) & 0xffffffff;
150 asm volatile ("getcon " __KCR0
", %0" : "=r" (ch
));
151 asm volatile ("getcon " __KCR0
", %0" : "=r" (cl
));
153 cl
= (cl
) & 0xffffffff;
154 printk("SR : %08Lx%08Lx TEA : %08Lx%08Lx KCR0: %08Lx%08Lx\n",
155 ah
, al
, bh
, bl
, ch
, cl
);
157 ah
= (regs
->regs
[0]) >> 32;
158 al
= (regs
->regs
[0]) & 0xffffffff;
159 bh
= (regs
->regs
[1]) >> 32;
160 bl
= (regs
->regs
[1]) & 0xffffffff;
161 ch
= (regs
->regs
[2]) >> 32;
162 cl
= (regs
->regs
[2]) & 0xffffffff;
163 printk("R0 : %08Lx%08Lx R1 : %08Lx%08Lx R2 : %08Lx%08Lx\n",
164 ah
, al
, bh
, bl
, ch
, cl
);
166 ah
= (regs
->regs
[3]) >> 32;
167 al
= (regs
->regs
[3]) & 0xffffffff;
168 bh
= (regs
->regs
[4]) >> 32;
169 bl
= (regs
->regs
[4]) & 0xffffffff;
170 ch
= (regs
->regs
[5]) >> 32;
171 cl
= (regs
->regs
[5]) & 0xffffffff;
172 printk("R3 : %08Lx%08Lx R4 : %08Lx%08Lx R5 : %08Lx%08Lx\n",
173 ah
, al
, bh
, bl
, ch
, cl
);
175 ah
= (regs
->regs
[6]) >> 32;
176 al
= (regs
->regs
[6]) & 0xffffffff;
177 bh
= (regs
->regs
[7]) >> 32;
178 bl
= (regs
->regs
[7]) & 0xffffffff;
179 ch
= (regs
->regs
[8]) >> 32;
180 cl
= (regs
->regs
[8]) & 0xffffffff;
181 printk("R6 : %08Lx%08Lx R7 : %08Lx%08Lx R8 : %08Lx%08Lx\n",
182 ah
, al
, bh
, bl
, ch
, cl
);
184 ah
= (regs
->regs
[9]) >> 32;
185 al
= (regs
->regs
[9]) & 0xffffffff;
186 bh
= (regs
->regs
[10]) >> 32;
187 bl
= (regs
->regs
[10]) & 0xffffffff;
188 ch
= (regs
->regs
[11]) >> 32;
189 cl
= (regs
->regs
[11]) & 0xffffffff;
190 printk("R9 : %08Lx%08Lx R10 : %08Lx%08Lx R11 : %08Lx%08Lx\n",
191 ah
, al
, bh
, bl
, ch
, cl
);
193 ah
= (regs
->regs
[12]) >> 32;
194 al
= (regs
->regs
[12]) & 0xffffffff;
195 bh
= (regs
->regs
[13]) >> 32;
196 bl
= (regs
->regs
[13]) & 0xffffffff;
197 ch
= (regs
->regs
[14]) >> 32;
198 cl
= (regs
->regs
[14]) & 0xffffffff;
199 printk("R12 : %08Lx%08Lx R13 : %08Lx%08Lx R14 : %08Lx%08Lx\n",
200 ah
, al
, bh
, bl
, ch
, cl
);
202 ah
= (regs
->regs
[16]) >> 32;
203 al
= (regs
->regs
[16]) & 0xffffffff;
204 bh
= (regs
->regs
[17]) >> 32;
205 bl
= (regs
->regs
[17]) & 0xffffffff;
206 ch
= (regs
->regs
[19]) >> 32;
207 cl
= (regs
->regs
[19]) & 0xffffffff;
208 printk("R16 : %08Lx%08Lx R17 : %08Lx%08Lx R19 : %08Lx%08Lx\n",
209 ah
, al
, bh
, bl
, ch
, cl
);
211 ah
= (regs
->regs
[20]) >> 32;
212 al
= (regs
->regs
[20]) & 0xffffffff;
213 bh
= (regs
->regs
[21]) >> 32;
214 bl
= (regs
->regs
[21]) & 0xffffffff;
215 ch
= (regs
->regs
[22]) >> 32;
216 cl
= (regs
->regs
[22]) & 0xffffffff;
217 printk("R20 : %08Lx%08Lx R21 : %08Lx%08Lx R22 : %08Lx%08Lx\n",
218 ah
, al
, bh
, bl
, ch
, cl
);
220 ah
= (regs
->regs
[23]) >> 32;
221 al
= (regs
->regs
[23]) & 0xffffffff;
222 bh
= (regs
->regs
[24]) >> 32;
223 bl
= (regs
->regs
[24]) & 0xffffffff;
224 ch
= (regs
->regs
[25]) >> 32;
225 cl
= (regs
->regs
[25]) & 0xffffffff;
226 printk("R23 : %08Lx%08Lx R24 : %08Lx%08Lx R25 : %08Lx%08Lx\n",
227 ah
, al
, bh
, bl
, ch
, cl
);
229 ah
= (regs
->regs
[26]) >> 32;
230 al
= (regs
->regs
[26]) & 0xffffffff;
231 bh
= (regs
->regs
[27]) >> 32;
232 bl
= (regs
->regs
[27]) & 0xffffffff;
233 ch
= (regs
->regs
[28]) >> 32;
234 cl
= (regs
->regs
[28]) & 0xffffffff;
235 printk("R26 : %08Lx%08Lx R27 : %08Lx%08Lx R28 : %08Lx%08Lx\n",
236 ah
, al
, bh
, bl
, ch
, cl
);
238 ah
= (regs
->regs
[29]) >> 32;
239 al
= (regs
->regs
[29]) & 0xffffffff;
240 bh
= (regs
->regs
[30]) >> 32;
241 bl
= (regs
->regs
[30]) & 0xffffffff;
242 ch
= (regs
->regs
[31]) >> 32;
243 cl
= (regs
->regs
[31]) & 0xffffffff;
244 printk("R29 : %08Lx%08Lx R30 : %08Lx%08Lx R31 : %08Lx%08Lx\n",
245 ah
, al
, bh
, bl
, ch
, cl
);
247 ah
= (regs
->regs
[32]) >> 32;
248 al
= (regs
->regs
[32]) & 0xffffffff;
249 bh
= (regs
->regs
[33]) >> 32;
250 bl
= (regs
->regs
[33]) & 0xffffffff;
251 ch
= (regs
->regs
[34]) >> 32;
252 cl
= (regs
->regs
[34]) & 0xffffffff;
253 printk("R32 : %08Lx%08Lx R33 : %08Lx%08Lx R34 : %08Lx%08Lx\n",
254 ah
, al
, bh
, bl
, ch
, cl
);
256 ah
= (regs
->regs
[35]) >> 32;
257 al
= (regs
->regs
[35]) & 0xffffffff;
258 bh
= (regs
->regs
[36]) >> 32;
259 bl
= (regs
->regs
[36]) & 0xffffffff;
260 ch
= (regs
->regs
[37]) >> 32;
261 cl
= (regs
->regs
[37]) & 0xffffffff;
262 printk("R35 : %08Lx%08Lx R36 : %08Lx%08Lx R37 : %08Lx%08Lx\n",
263 ah
, al
, bh
, bl
, ch
, cl
);
265 ah
= (regs
->regs
[38]) >> 32;
266 al
= (regs
->regs
[38]) & 0xffffffff;
267 bh
= (regs
->regs
[39]) >> 32;
268 bl
= (regs
->regs
[39]) & 0xffffffff;
269 ch
= (regs
->regs
[40]) >> 32;
270 cl
= (regs
->regs
[40]) & 0xffffffff;
271 printk("R38 : %08Lx%08Lx R39 : %08Lx%08Lx R40 : %08Lx%08Lx\n",
272 ah
, al
, bh
, bl
, ch
, cl
);
274 ah
= (regs
->regs
[41]) >> 32;
275 al
= (regs
->regs
[41]) & 0xffffffff;
276 bh
= (regs
->regs
[42]) >> 32;
277 bl
= (regs
->regs
[42]) & 0xffffffff;
278 ch
= (regs
->regs
[43]) >> 32;
279 cl
= (regs
->regs
[43]) & 0xffffffff;
280 printk("R41 : %08Lx%08Lx R42 : %08Lx%08Lx R43 : %08Lx%08Lx\n",
281 ah
, al
, bh
, bl
, ch
, cl
);
283 ah
= (regs
->regs
[44]) >> 32;
284 al
= (regs
->regs
[44]) & 0xffffffff;
285 bh
= (regs
->regs
[45]) >> 32;
286 bl
= (regs
->regs
[45]) & 0xffffffff;
287 ch
= (regs
->regs
[46]) >> 32;
288 cl
= (regs
->regs
[46]) & 0xffffffff;
289 printk("R44 : %08Lx%08Lx R45 : %08Lx%08Lx R46 : %08Lx%08Lx\n",
290 ah
, al
, bh
, bl
, ch
, cl
);
292 ah
= (regs
->regs
[47]) >> 32;
293 al
= (regs
->regs
[47]) & 0xffffffff;
294 bh
= (regs
->regs
[48]) >> 32;
295 bl
= (regs
->regs
[48]) & 0xffffffff;
296 ch
= (regs
->regs
[49]) >> 32;
297 cl
= (regs
->regs
[49]) & 0xffffffff;
298 printk("R47 : %08Lx%08Lx R48 : %08Lx%08Lx R49 : %08Lx%08Lx\n",
299 ah
, al
, bh
, bl
, ch
, cl
);
301 ah
= (regs
->regs
[50]) >> 32;
302 al
= (regs
->regs
[50]) & 0xffffffff;
303 bh
= (regs
->regs
[51]) >> 32;
304 bl
= (regs
->regs
[51]) & 0xffffffff;
305 ch
= (regs
->regs
[52]) >> 32;
306 cl
= (regs
->regs
[52]) & 0xffffffff;
307 printk("R50 : %08Lx%08Lx R51 : %08Lx%08Lx R52 : %08Lx%08Lx\n",
308 ah
, al
, bh
, bl
, ch
, cl
);
310 ah
= (regs
->regs
[53]) >> 32;
311 al
= (regs
->regs
[53]) & 0xffffffff;
312 bh
= (regs
->regs
[54]) >> 32;
313 bl
= (regs
->regs
[54]) & 0xffffffff;
314 ch
= (regs
->regs
[55]) >> 32;
315 cl
= (regs
->regs
[55]) & 0xffffffff;
316 printk("R53 : %08Lx%08Lx R54 : %08Lx%08Lx R55 : %08Lx%08Lx\n",
317 ah
, al
, bh
, bl
, ch
, cl
);
319 ah
= (regs
->regs
[56]) >> 32;
320 al
= (regs
->regs
[56]) & 0xffffffff;
321 bh
= (regs
->regs
[57]) >> 32;
322 bl
= (regs
->regs
[57]) & 0xffffffff;
323 ch
= (regs
->regs
[58]) >> 32;
324 cl
= (regs
->regs
[58]) & 0xffffffff;
325 printk("R56 : %08Lx%08Lx R57 : %08Lx%08Lx R58 : %08Lx%08Lx\n",
326 ah
, al
, bh
, bl
, ch
, cl
);
328 ah
= (regs
->regs
[59]) >> 32;
329 al
= (regs
->regs
[59]) & 0xffffffff;
330 bh
= (regs
->regs
[60]) >> 32;
331 bl
= (regs
->regs
[60]) & 0xffffffff;
332 ch
= (regs
->regs
[61]) >> 32;
333 cl
= (regs
->regs
[61]) & 0xffffffff;
334 printk("R59 : %08Lx%08Lx R60 : %08Lx%08Lx R61 : %08Lx%08Lx\n",
335 ah
, al
, bh
, bl
, ch
, cl
);
337 ah
= (regs
->regs
[62]) >> 32;
338 al
= (regs
->regs
[62]) & 0xffffffff;
339 bh
= (regs
->tregs
[0]) >> 32;
340 bl
= (regs
->tregs
[0]) & 0xffffffff;
341 ch
= (regs
->tregs
[1]) >> 32;
342 cl
= (regs
->tregs
[1]) & 0xffffffff;
343 printk("R62 : %08Lx%08Lx T0 : %08Lx%08Lx T1 : %08Lx%08Lx\n",
344 ah
, al
, bh
, bl
, ch
, cl
);
346 ah
= (regs
->tregs
[2]) >> 32;
347 al
= (regs
->tregs
[2]) & 0xffffffff;
348 bh
= (regs
->tregs
[3]) >> 32;
349 bl
= (regs
->tregs
[3]) & 0xffffffff;
350 ch
= (regs
->tregs
[4]) >> 32;
351 cl
= (regs
->tregs
[4]) & 0xffffffff;
352 printk("T2 : %08Lx%08Lx T3 : %08Lx%08Lx T4 : %08Lx%08Lx\n",
353 ah
, al
, bh
, bl
, ch
, cl
);
355 ah
= (regs
->tregs
[5]) >> 32;
356 al
= (regs
->tregs
[5]) & 0xffffffff;
357 bh
= (regs
->tregs
[6]) >> 32;
358 bl
= (regs
->tregs
[6]) & 0xffffffff;
359 ch
= (regs
->tregs
[7]) >> 32;
360 cl
= (regs
->tregs
[7]) & 0xffffffff;
361 printk("T5 : %08Lx%08Lx T6 : %08Lx%08Lx T7 : %08Lx%08Lx\n",
362 ah
, al
, bh
, bl
, ch
, cl
);
365 * If we're in kernel mode, dump the stack too..
367 if (!user_mode(regs
)) {
368 void show_stack(struct task_struct
*tsk
, unsigned long *sp
);
369 unsigned long sp
= regs
->regs
[15] & 0xffffffff;
370 struct task_struct
*tsk
= get_current();
372 tsk
->thread
.kregs
= regs
;
374 show_stack(tsk
, (unsigned long *)sp
);
378 struct task_struct
* alloc_task_struct(void)
380 /* Get task descriptor pages */
381 return (struct task_struct
*)
382 __get_free_pages(GFP_KERNEL
, get_order(THREAD_SIZE
));
385 void free_task_struct(struct task_struct
*p
)
387 free_pages((unsigned long) p
, get_order(THREAD_SIZE
));
391 * Create a kernel thread
393 ATTRIB_NORET
void kernel_thread_helper(void *arg
, int (*fn
)(void *))
399 * This is the mechanism for creating a new kernel thread.
401 * NOTE! Only a kernel-only process(ie the swapper or direct descendants
402 * who haven't done an "execve()") should use this: it will work within
403 * a system call from a "real" process, but the process memory space will
404 * not be freed until both the parent and the child have exited.
406 int kernel_thread(int (*fn
)(void *), void * arg
, unsigned long flags
)
410 memset(®s
, 0, sizeof(regs
));
411 regs
.regs
[2] = (unsigned long)arg
;
412 regs
.regs
[3] = (unsigned long)fn
;
414 regs
.pc
= (unsigned long)kernel_thread_helper
;
417 return do_fork(flags
| CLONE_VM
| CLONE_UNTRACED
, 0,
418 ®s
, 0, NULL
, NULL
);
422 * Free current thread data structures etc..
424 void exit_thread(void)
426 /* See arch/sparc/kernel/process.c for the precedent for doing this -- RPC.
428 The SH-5 FPU save/restore approach relies on last_task_used_math
429 pointing to a live task_struct. When another task tries to use the
430 FPU for the 1st time, the FPUDIS trap handling (see
431 arch/sh64/kernel/fpu.c) will save the existing FPU state to the
432 FP regs field within last_task_used_math before re-loading the new
433 task's FPU state (or initialising it if the FPU has been used
434 before). So if last_task_used_math is stale, and its page has already been
435 re-allocated for another use, the consequences are rather grim. Unless we
436 null it here, there is no other path through which it would get safely
440 if (last_task_used_math
== current
) {
441 last_task_used_math
= NULL
;
446 void flush_thread(void)
449 /* Called by fs/exec.c (flush_old_exec) to remove traces of a
450 * previously running executable. */
452 if (last_task_used_math
== current
) {
453 last_task_used_math
= NULL
;
455 /* Force FPU state to be reinitialised after exec */
459 /* if we are a kernel thread, about to change to user thread,
462 if(current
->thread
.kregs
==&fake_swapper_regs
) {
463 current
->thread
.kregs
=
464 ((struct pt_regs
*)(THREAD_SIZE
+ (unsigned long) current
) - 1);
465 current
->thread
.uregs
= current
->thread
.kregs
;
469 void release_thread(struct task_struct
*dead_task
)
474 /* Fill in the fpu structure for a core dump.. */
475 int dump_fpu(struct pt_regs
*regs
, elf_fpregset_t
*fpu
)
479 struct task_struct
*tsk
= current
;
481 fpvalid
= !!tsk_used_math(tsk
);
483 if (current
== last_task_used_math
) {
485 fpsave(&tsk
->thread
.fpu
.hard
);
487 last_task_used_math
= 0;
491 memcpy(fpu
, &tsk
->thread
.fpu
.hard
, sizeof(*fpu
));
496 return 0; /* Task didn't use the fpu at all. */
500 asmlinkage
void ret_from_fork(void);
502 int copy_thread(int nr
, unsigned long clone_flags
, unsigned long usp
,
503 unsigned long unused
,
504 struct task_struct
*p
, struct pt_regs
*regs
)
506 struct pt_regs
*childregs
;
507 unsigned long long se
; /* Sign extension */
510 if(last_task_used_math
== current
) {
512 fpsave(¤t
->thread
.fpu
.hard
);
514 last_task_used_math
= NULL
;
518 /* Copy from sh version */
519 childregs
= (struct pt_regs
*)(THREAD_SIZE
+ task_stack_page(p
)) - 1;
523 if (user_mode(regs
)) {
524 childregs
->regs
[15] = usp
;
525 p
->thread
.uregs
= childregs
;
527 childregs
->regs
[15] = (unsigned long)task_stack_page(p
) + THREAD_SIZE
;
530 childregs
->regs
[9] = 0; /* Set return value for child */
531 childregs
->sr
|= SR_FD
; /* Invalidate FPU flag */
533 p
->thread
.sp
= (unsigned long) childregs
;
534 p
->thread
.pc
= (unsigned long) ret_from_fork
;
537 * Sign extend the edited stack.
538 * Note that thread.pc and thread.pc will stay
539 * 32-bit wide and context switch must take care
540 * of NEFF sign extension.
543 se
= childregs
->regs
[15];
544 se
= (se
& NEFF_SIGN
) ? (se
| NEFF_MASK
) : se
;
545 childregs
->regs
[15] = se
;
550 asmlinkage
int sys_fork(unsigned long r2
, unsigned long r3
,
551 unsigned long r4
, unsigned long r5
,
552 unsigned long r6
, unsigned long r7
,
553 struct pt_regs
*pregs
)
555 return do_fork(SIGCHLD
, pregs
->regs
[15], pregs
, 0, 0, 0);
558 asmlinkage
int sys_clone(unsigned long clone_flags
, unsigned long newsp
,
559 unsigned long r4
, unsigned long r5
,
560 unsigned long r6
, unsigned long r7
,
561 struct pt_regs
*pregs
)
564 newsp
= pregs
->regs
[15];
565 return do_fork(clone_flags
, newsp
, pregs
, 0, 0, 0);
569 * This is trivial, and on the face of it looks like it
570 * could equally well be done in user mode.
572 * Not so, for quite unobvious reasons - register pressure.
573 * In user mode vfork() cannot have a stack frame, and if
574 * done by calling the "clone()" system call directly, you
575 * do not have enough call-clobbered registers to hold all
576 * the information you need.
578 asmlinkage
int sys_vfork(unsigned long r2
, unsigned long r3
,
579 unsigned long r4
, unsigned long r5
,
580 unsigned long r6
, unsigned long r7
,
581 struct pt_regs
*pregs
)
583 return do_fork(CLONE_VFORK
| CLONE_VM
| SIGCHLD
, pregs
->regs
[15], pregs
, 0, 0, 0);
587 * sys_execve() executes a new program.
589 asmlinkage
int sys_execve(char *ufilename
, char **uargv
,
590 char **uenvp
, unsigned long r5
,
591 unsigned long r6
, unsigned long r7
,
592 struct pt_regs
*pregs
)
598 filename
= getname((char __user
*)ufilename
);
599 error
= PTR_ERR(filename
);
600 if (IS_ERR(filename
))
603 error
= do_execve(filename
,
604 (char __user
* __user
*)uargv
,
605 (char __user
* __user
*)uenvp
,
609 current
->ptrace
&= ~PT_DTRACE
;
610 task_unlock(current
);
619 * These bracket the sleeping functions..
621 extern void interruptible_sleep_on(wait_queue_head_t
*q
);
623 #define mid_sched ((unsigned long) interruptible_sleep_on)
625 static int in_sh64_switch_to(unsigned long pc
)
627 extern char __sh64_switch_to_end
;
628 /* For a sleeping task, the PC is somewhere in the middle of the function,
629 so we don't have to worry about masking the LSB off */
630 return (pc
>= (unsigned long) sh64_switch_to
) &&
631 (pc
< (unsigned long) &__sh64_switch_to_end
);
634 unsigned long get_wchan(struct task_struct
*p
)
636 unsigned long schedule_fp
;
637 unsigned long sh64_switch_to_fp
;
638 unsigned long schedule_caller_pc
;
641 if (!p
|| p
== current
|| p
->state
== TASK_RUNNING
)
645 * The same comment as on the Alpha applies here, too ...
647 pc
= thread_saved_pc(p
);
649 #ifdef CONFIG_FRAME_POINTER
650 if (in_sh64_switch_to(pc
)) {
651 sh64_switch_to_fp
= (long) p
->thread
.sp
;
652 /* r14 is saved at offset 4 in the sh64_switch_to frame */
653 schedule_fp
= *(unsigned long *) (long)(sh64_switch_to_fp
+ 4);
655 /* and the caller of 'schedule' is (currently!) saved at offset 24
656 in the frame of schedule (from disasm) */
657 schedule_caller_pc
= *(unsigned long *) (long)(schedule_fp
+ 24);
658 return schedule_caller_pc
;
664 /* Provide a /proc/asids file that lists out the
665 ASIDs currently associated with the processes. (If the DM.PC register is
666 examined through the debug link, this shows ASID + PC. To make use of this,
667 the PID->ASID relationship needs to be known. This is primarily for
671 #if defined(CONFIG_SH64_PROC_ASIDS)
673 asids_proc_info(char *buf
, char **start
, off_t fpos
, int length
, int *eof
, void *data
)
676 struct task_struct
*p
;
677 read_lock(&tasklist_lock
);
678 for_each_process(p
) {
680 struct mm_struct
*mm
;
684 unsigned long asid
, context
;
685 context
= mm
->context
;
686 asid
= (context
& 0xff);
687 len
+= sprintf(buf
+len
, "%5d : %02lx\n", pid
, asid
);
689 len
+= sprintf(buf
+len
, "%5d : (none)\n", pid
);
692 read_unlock(&tasklist_lock
);
697 static int __init
register_proc_asids(void)
699 create_proc_read_entry("asids", 0, NULL
, asids_proc_info
, NULL
);
702 __initcall(register_proc_asids
);
This page took 0.055167 seconds and 5 git commands to generate.