aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/kernel/process.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-10-11 08:09:48 -0400
committerPaul Mackerras <paulus@samba.org>2005-10-11 08:09:48 -0400
commit3abec857a0f7491b397a97337cc057b84a1d637a (patch)
treec0bedb7865f7106c3854065be974d8a064281d29 /arch/ppc64/kernel/process.c
parentfd582ec88eb8d2d907876603e4ecebe6eab330d9 (diff)
ppc64: Use merged versions of init_task.c and process.c.
These two files are now built in arch/powerpc/kernel instead of arch/ppc64/kernel. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc64/kernel/process.c')
-rw-r--r--arch/ppc64/kernel/process.c713
1 files changed, 0 insertions, 713 deletions
diff --git a/arch/ppc64/kernel/process.c b/arch/ppc64/kernel/process.c
deleted file mode 100644
index 887005358eb1..000000000000
--- a/arch/ppc64/kernel/process.c
+++ /dev/null
@@ -1,713 +0,0 @@
1/*
2 * linux/arch/ppc64/kernel/process.c
3 *
4 * Derived from "arch/i386/kernel/process.c"
5 * Copyright (C) 1995 Linus Torvalds
6 *
7 * Updated and modified by Cort Dougan (cort@cs.nmt.edu) and
8 * Paul Mackerras (paulus@cs.anu.edu.au)
9 *
10 * PowerPC version
11 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version
16 * 2 of the License, or (at your option) any later version.
17 */
18
19#include <linux/config.h>
20#include <linux/module.h>
21#include <linux/errno.h>
22#include <linux/sched.h>
23#include <linux/kernel.h>
24#include <linux/mm.h>
25#include <linux/smp.h>
26#include <linux/smp_lock.h>
27#include <linux/stddef.h>
28#include <linux/unistd.h>
29#include <linux/slab.h>
30#include <linux/user.h>
31#include <linux/elf.h>
32#include <linux/init.h>
33#include <linux/init_task.h>
34#include <linux/prctl.h>
35#include <linux/ptrace.h>
36#include <linux/kallsyms.h>
37#include <linux/interrupt.h>
38#include <linux/utsname.h>
39#include <linux/kprobes.h>
40
41#include <asm/pgtable.h>
42#include <asm/uaccess.h>
43#include <asm/system.h>
44#include <asm/io.h>
45#include <asm/processor.h>
46#include <asm/mmu.h>
47#include <asm/mmu_context.h>
48#include <asm/prom.h>
49#include <asm/ppcdebug.h>
50#include <asm/machdep.h>
51#include <asm/iSeries/HvCallHpt.h>
52#include <asm/cputable.h>
53#include <asm/firmware.h>
54#include <asm/sections.h>
55#include <asm/tlbflush.h>
56#include <asm/time.h>
57#include <asm/plpar_wrappers.h>
58
59#ifndef CONFIG_SMP
60struct task_struct *last_task_used_math = NULL;
61struct task_struct *last_task_used_altivec = NULL;
62#endif
63
64/*
65 * Make sure the floating-point register state in the
66 * the thread_struct is up to date for task tsk.
67 */
68void flush_fp_to_thread(struct task_struct *tsk)
69{
70 if (tsk->thread.regs) {
71 /*
72 * We need to disable preemption here because if we didn't,
73 * another process could get scheduled after the regs->msr
74 * test but before we have finished saving the FP registers
75 * to the thread_struct. That process could take over the
76 * FPU, and then when we get scheduled again we would store
77 * bogus values for the remaining FP registers.
78 */
79 preempt_disable();
80 if (tsk->thread.regs->msr & MSR_FP) {
81#ifdef CONFIG_SMP
82 /*
83 * This should only ever be called for current or
84 * for a stopped child process. Since we save away
85 * the FP register state on context switch on SMP,
86 * there is something wrong if a stopped child appears
87 * to still have its FP state in the CPU registers.
88 */
89 BUG_ON(tsk != current);
90#endif
91 giveup_fpu(current);
92 }
93 preempt_enable();
94 }
95}
96
97void enable_kernel_fp(void)
98{
99 WARN_ON(preemptible());
100
101#ifdef CONFIG_SMP
102 if (current->thread.regs && (current->thread.regs->msr & MSR_FP))
103 giveup_fpu(current);
104 else
105 giveup_fpu(NULL); /* just enables FP for kernel */
106#else
107 giveup_fpu(last_task_used_math);
108#endif /* CONFIG_SMP */
109}
110EXPORT_SYMBOL(enable_kernel_fp);
111
112int dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs)
113{
114 if (!tsk->thread.regs)
115 return 0;
116 flush_fp_to_thread(current);
117
118 memcpy(fpregs, &tsk->thread.fpr[0], sizeof(*fpregs));
119
120 return 1;
121}
122
123#ifdef CONFIG_ALTIVEC
124
125void enable_kernel_altivec(void)
126{
127 WARN_ON(preemptible());
128
129#ifdef CONFIG_SMP
130 if (current->thread.regs && (current->thread.regs->msr & MSR_VEC))
131 giveup_altivec(current);
132 else
133 giveup_altivec(NULL); /* just enables FP for kernel */
134#else
135 giveup_altivec(last_task_used_altivec);
136#endif /* CONFIG_SMP */
137}
138EXPORT_SYMBOL(enable_kernel_altivec);
139
140/*
141 * Make sure the VMX/Altivec register state in the
142 * the thread_struct is up to date for task tsk.
143 */
144void flush_altivec_to_thread(struct task_struct *tsk)
145{
146 if (tsk->thread.regs) {
147 preempt_disable();
148 if (tsk->thread.regs->msr & MSR_VEC) {
149#ifdef CONFIG_SMP
150 BUG_ON(tsk != current);
151#endif
152 giveup_altivec(current);
153 }
154 preempt_enable();
155 }
156}
157
158int dump_task_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs)
159{
160 flush_altivec_to_thread(current);
161 memcpy(vrregs, &current->thread.vr[0], sizeof(*vrregs));
162 return 1;
163}
164
165#endif /* CONFIG_ALTIVEC */
166
167static void set_dabr_spr(unsigned long val)
168{
169 mtspr(SPRN_DABR, val);
170}
171
172int set_dabr(unsigned long dabr)
173{
174 int ret = 0;
175
176 if (firmware_has_feature(FW_FEATURE_XDABR)) {
177 /* We want to catch accesses from kernel and userspace */
178 unsigned long flags = H_DABRX_KERNEL|H_DABRX_USER;
179 ret = plpar_set_xdabr(dabr, flags);
180 } else if (firmware_has_feature(FW_FEATURE_DABR)) {
181 ret = plpar_set_dabr(dabr);
182 } else {
183 set_dabr_spr(dabr);
184 }
185
186 return ret;
187}
188
189DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array);
190static DEFINE_PER_CPU(unsigned long, current_dabr);
191
192struct task_struct *__switch_to(struct task_struct *prev,
193 struct task_struct *new)
194{
195 struct thread_struct *new_thread, *old_thread;
196 unsigned long flags;
197 struct task_struct *last;
198
199#ifdef CONFIG_SMP
200 /* avoid complexity of lazy save/restore of fpu
201 * by just saving it every time we switch out if
202 * this task used the fpu during the last quantum.
203 *
204 * If it tries to use the fpu again, it'll trap and
205 * reload its fp regs. So we don't have to do a restore
206 * every switch, just a save.
207 * -- Cort
208 */
209 if (prev->thread.regs && (prev->thread.regs->msr & MSR_FP))
210 giveup_fpu(prev);
211#ifdef CONFIG_ALTIVEC
212 if (prev->thread.regs && (prev->thread.regs->msr & MSR_VEC))
213 giveup_altivec(prev);
214#endif /* CONFIG_ALTIVEC */
215#endif /* CONFIG_SMP */
216
217#if defined(CONFIG_ALTIVEC) && !defined(CONFIG_SMP)
218 /* Avoid the trap. On smp this this never happens since
219 * we don't set last_task_used_altivec -- Cort
220 */
221 if (new->thread.regs && last_task_used_altivec == new)
222 new->thread.regs->msr |= MSR_VEC;
223#endif /* CONFIG_ALTIVEC */
224
225 if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) {
226 set_dabr(new->thread.dabr);
227 __get_cpu_var(current_dabr) = new->thread.dabr;
228 }
229
230 flush_tlb_pending();
231
232 new_thread = &new->thread;
233 old_thread = &current->thread;
234
235 /* Collect purr utilization data per process and per processor
236 * wise purr is nothing but processor time base
237 */
238 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
239 struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array);
240 long unsigned start_tb, current_tb;
241 start_tb = old_thread->start_tb;
242 cu->current_tb = current_tb = mfspr(SPRN_PURR);
243 old_thread->accum_tb += (current_tb - start_tb);
244 new_thread->start_tb = current_tb;
245 }
246
247 local_irq_save(flags);
248 last = _switch(old_thread, new_thread);
249
250 local_irq_restore(flags);
251
252 return last;
253}
254
255static int instructions_to_print = 16;
256
257static void show_instructions(struct pt_regs *regs)
258{
259 int i;
260 unsigned long pc = regs->nip - (instructions_to_print * 3 / 4 *
261 sizeof(int));
262
263 printk("Instruction dump:");
264
265 for (i = 0; i < instructions_to_print; i++) {
266 int instr;
267
268 if (!(i % 8))
269 printk("\n");
270
271 if (((REGION_ID(pc) != KERNEL_REGION_ID) &&
272 (REGION_ID(pc) != VMALLOC_REGION_ID)) ||
273 __get_user(instr, (unsigned int *)pc)) {
274 printk("XXXXXXXX ");
275 } else {
276 if (regs->nip == pc)
277 printk("<%08x> ", instr);
278 else
279 printk("%08x ", instr);
280 }
281
282 pc += sizeof(int);
283 }
284
285 printk("\n");
286}
287
288void show_regs(struct pt_regs * regs)
289{
290 int i;
291 unsigned long trap;
292
293 printk("NIP: %016lX XER: %08X LR: %016lX CTR: %016lX\n",
294 regs->nip, (unsigned int)regs->xer, regs->link, regs->ctr);
295 printk("REGS: %p TRAP: %04lx %s (%s)\n",
296 regs, regs->trap, print_tainted(), system_utsname.release);
297 printk("MSR: %016lx EE: %01x PR: %01x FP: %01x ME: %01x "
298 "IR/DR: %01x%01x CR: %08X\n",
299 regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
300 regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
301 regs->msr&MSR_IR ? 1 : 0,
302 regs->msr&MSR_DR ? 1 : 0,
303 (unsigned int)regs->ccr);
304 trap = TRAP(regs);
305 printk("DAR: %016lx DSISR: %016lx\n", regs->dar, regs->dsisr);
306 printk("TASK: %p[%d] '%s' THREAD: %p",
307 current, current->pid, current->comm, current->thread_info);
308
309#ifdef CONFIG_SMP
310 printk(" CPU: %d", smp_processor_id());
311#endif /* CONFIG_SMP */
312
313 for (i = 0; i < 32; i++) {
314 if ((i % 4) == 0) {
315 printk("\n" KERN_INFO "GPR%02d: ", i);
316 }
317
318 printk("%016lX ", regs->gpr[i]);
319 if (i == 13 && !FULL_REGS(regs))
320 break;
321 }
322 printk("\n");
323 /*
324 * Lookup NIP late so we have the best change of getting the
325 * above info out without failing
326 */
327 printk("NIP [%016lx] ", regs->nip);
328 print_symbol("%s\n", regs->nip);
329 printk("LR [%016lx] ", regs->link);
330 print_symbol("%s\n", regs->link);
331 show_stack(current, (unsigned long *)regs->gpr[1]);
332 if (!user_mode(regs))
333 show_instructions(regs);
334}
335
336void exit_thread(void)
337{
338 kprobe_flush_task(current);
339
340#ifndef CONFIG_SMP
341 if (last_task_used_math == current)
342 last_task_used_math = NULL;
343#ifdef CONFIG_ALTIVEC
344 if (last_task_used_altivec == current)
345 last_task_used_altivec = NULL;
346#endif /* CONFIG_ALTIVEC */
347#endif /* CONFIG_SMP */
348}
349
350void flush_thread(void)
351{
352 struct thread_info *t = current_thread_info();
353
354 kprobe_flush_task(current);
355 if (t->flags & _TIF_ABI_PENDING)
356 t->flags ^= (_TIF_ABI_PENDING | _TIF_32BIT);
357
358#ifndef CONFIG_SMP
359 if (last_task_used_math == current)
360 last_task_used_math = NULL;
361#ifdef CONFIG_ALTIVEC
362 if (last_task_used_altivec == current)
363 last_task_used_altivec = NULL;
364#endif /* CONFIG_ALTIVEC */
365#endif /* CONFIG_SMP */
366
367 if (current->thread.dabr) {
368 current->thread.dabr = 0;
369 set_dabr(0);
370 }
371}
372
373void
374release_thread(struct task_struct *t)
375{
376}
377
378
379/*
380 * This gets called before we allocate a new thread and copy
381 * the current task into it.
382 */
383void prepare_to_copy(struct task_struct *tsk)
384{
385 flush_fp_to_thread(current);
386 flush_altivec_to_thread(current);
387}
388
389/*
390 * Copy a thread..
391 */
392int
393copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
394 unsigned long unused, struct task_struct *p, struct pt_regs *regs)
395{
396 struct pt_regs *childregs, *kregs;
397 extern void ret_from_fork(void);
398 unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE;
399
400 /* Copy registers */
401 sp -= sizeof(struct pt_regs);
402 childregs = (struct pt_regs *) sp;
403 *childregs = *regs;
404 if ((childregs->msr & MSR_PR) == 0) {
405 /* for kernel thread, set stackptr in new task */
406 childregs->gpr[1] = sp + sizeof(struct pt_regs);
407 p->thread.regs = NULL; /* no user register state */
408 clear_ti_thread_flag(p->thread_info, TIF_32BIT);
409 } else {
410 childregs->gpr[1] = usp;
411 p->thread.regs = childregs;
412 if (clone_flags & CLONE_SETTLS) {
413 if (test_thread_flag(TIF_32BIT))
414 childregs->gpr[2] = childregs->gpr[6];
415 else
416 childregs->gpr[13] = childregs->gpr[6];
417 }
418 }
419 childregs->gpr[3] = 0; /* Result from fork() */
420 sp -= STACK_FRAME_OVERHEAD;
421
422 /*
423 * The way this works is that at some point in the future
424 * some task will call _switch to switch to the new task.
425 * That will pop off the stack frame created below and start
426 * the new task running at ret_from_fork. The new task will
427 * do some house keeping and then return from the fork or clone
428 * system call, using the stack frame created above.
429 */
430 sp -= sizeof(struct pt_regs);
431 kregs = (struct pt_regs *) sp;
432 sp -= STACK_FRAME_OVERHEAD;
433 p->thread.ksp = sp;
434 if (cpu_has_feature(CPU_FTR_SLB)) {
435 unsigned long sp_vsid = get_kernel_vsid(sp);
436
437 sp_vsid <<= SLB_VSID_SHIFT;
438 sp_vsid |= SLB_VSID_KERNEL;
439 if (cpu_has_feature(CPU_FTR_16M_PAGE))
440 sp_vsid |= SLB_VSID_L;
441
442 p->thread.ksp_vsid = sp_vsid;
443 }
444
445 /*
446 * The PPC64 ABI makes use of a TOC to contain function
447 * pointers. The function (ret_from_except) is actually a pointer
448 * to the TOC entry. The first entry is a pointer to the actual
449 * function.
450 */
451 kregs->nip = *((unsigned long *)ret_from_fork);
452
453 return 0;
454}
455
456/*
457 * Set up a thread for executing a new program
458 */
459void start_thread(struct pt_regs *regs, unsigned long fdptr, unsigned long sp)
460{
461 unsigned long entry, toc, load_addr = regs->gpr[2];
462
463 /* fdptr is a relocated pointer to the function descriptor for
464 * the elf _start routine. The first entry in the function
465 * descriptor is the entry address of _start and the second
466 * entry is the TOC value we need to use.
467 */
468 set_fs(USER_DS);
469 __get_user(entry, (unsigned long __user *)fdptr);
470 __get_user(toc, (unsigned long __user *)fdptr+1);
471
472 /* Check whether the e_entry function descriptor entries
473 * need to be relocated before we can use them.
474 */
475 if (load_addr != 0) {
476 entry += load_addr;
477 toc += load_addr;
478 }
479
480 /*
481 * If we exec out of a kernel thread then thread.regs will not be
482 * set. Do it now.
483 */
484 if (!current->thread.regs) {
485 unsigned long childregs = (unsigned long)current->thread_info +
486 THREAD_SIZE;
487 childregs -= sizeof(struct pt_regs);
488 current->thread.regs = (struct pt_regs *)childregs;
489 }
490
491 regs->nip = entry;
492 regs->gpr[1] = sp;
493 regs->gpr[2] = toc;
494 regs->msr = MSR_USER64;
495#ifndef CONFIG_SMP
496 if (last_task_used_math == current)
497 last_task_used_math = 0;
498#endif /* CONFIG_SMP */
499 memset(current->thread.fpr, 0, sizeof(current->thread.fpr));
500 current->thread.fpscr = 0;
501#ifdef CONFIG_ALTIVEC
502#ifndef CONFIG_SMP
503 if (last_task_used_altivec == current)
504 last_task_used_altivec = 0;
505#endif /* CONFIG_SMP */
506 memset(current->thread.vr, 0, sizeof(current->thread.vr));
507 current->thread.vscr.u[0] = 0;
508 current->thread.vscr.u[1] = 0;
509 current->thread.vscr.u[2] = 0;
510 current->thread.vscr.u[3] = 0x00010000; /* Java mode disabled */
511 current->thread.vrsave = 0;
512 current->thread.used_vr = 0;
513#endif /* CONFIG_ALTIVEC */
514}
515EXPORT_SYMBOL(start_thread);
516
517int set_fpexc_mode(struct task_struct *tsk, unsigned int val)
518{
519 struct pt_regs *regs = tsk->thread.regs;
520
521 if (val > PR_FP_EXC_PRECISE)
522 return -EINVAL;
523 tsk->thread.fpexc_mode = __pack_fe01(val);
524 if (regs != NULL && (regs->msr & MSR_FP) != 0)
525 regs->msr = (regs->msr & ~(MSR_FE0|MSR_FE1))
526 | tsk->thread.fpexc_mode;
527 return 0;
528}
529
530int get_fpexc_mode(struct task_struct *tsk, unsigned long adr)
531{
532 unsigned int val;
533
534 val = __unpack_fe01(tsk->thread.fpexc_mode);
535 return put_user(val, (unsigned int __user *) adr);
536}
537
538int sys_clone(unsigned long clone_flags, unsigned long p2, unsigned long p3,
539 unsigned long p4, unsigned long p5, unsigned long p6,
540 struct pt_regs *regs)
541{
542 unsigned long parent_tidptr = 0;
543 unsigned long child_tidptr = 0;
544
545 if (p2 == 0)
546 p2 = regs->gpr[1]; /* stack pointer for child */
547
548 if (clone_flags & (CLONE_PARENT_SETTID | CLONE_CHILD_SETTID |
549 CLONE_CHILD_CLEARTID)) {
550 parent_tidptr = p3;
551 child_tidptr = p5;
552 if (test_thread_flag(TIF_32BIT)) {
553 parent_tidptr &= 0xffffffff;
554 child_tidptr &= 0xffffffff;
555 }
556 }
557
558 return do_fork(clone_flags, p2, regs, 0,
559 (int __user *)parent_tidptr, (int __user *)child_tidptr);
560}
561
562int sys_fork(unsigned long p1, unsigned long p2, unsigned long p3,
563 unsigned long p4, unsigned long p5, unsigned long p6,
564 struct pt_regs *regs)
565{
566 return do_fork(SIGCHLD, regs->gpr[1], regs, 0, NULL, NULL);
567}
568
569int sys_vfork(unsigned long p1, unsigned long p2, unsigned long p3,
570 unsigned long p4, unsigned long p5, unsigned long p6,
571 struct pt_regs *regs)
572{
573 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->gpr[1], regs, 0,
574 NULL, NULL);
575}
576
577int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
578 unsigned long a3, unsigned long a4, unsigned long a5,
579 struct pt_regs *regs)
580{
581 int error;
582 char * filename;
583
584 filename = getname((char __user *) a0);
585 error = PTR_ERR(filename);
586 if (IS_ERR(filename))
587 goto out;
588 flush_fp_to_thread(current);
589 flush_altivec_to_thread(current);
590 error = do_execve(filename, (char __user * __user *) a1,
591 (char __user * __user *) a2, regs);
592
593 if (error == 0) {
594 task_lock(current);
595 current->ptrace &= ~PT_DTRACE;
596 task_unlock(current);
597 }
598 putname(filename);
599
600out:
601 return error;
602}
603
604static int kstack_depth_to_print = 64;
605
606static int validate_sp(unsigned long sp, struct task_struct *p,
607 unsigned long nbytes)
608{
609 unsigned long stack_page = (unsigned long)p->thread_info;
610
611 if (sp >= stack_page + sizeof(struct thread_struct)
612 && sp <= stack_page + THREAD_SIZE - nbytes)
613 return 1;
614
615#ifdef CONFIG_IRQSTACKS
616 stack_page = (unsigned long) hardirq_ctx[task_cpu(p)];
617 if (sp >= stack_page + sizeof(struct thread_struct)
618 && sp <= stack_page + THREAD_SIZE - nbytes)
619 return 1;
620
621 stack_page = (unsigned long) softirq_ctx[task_cpu(p)];
622 if (sp >= stack_page + sizeof(struct thread_struct)
623 && sp <= stack_page + THREAD_SIZE - nbytes)
624 return 1;
625#endif
626
627 return 0;
628}
629
630unsigned long get_wchan(struct task_struct *p)
631{
632 unsigned long ip, sp;
633 int count = 0;
634
635 if (!p || p == current || p->state == TASK_RUNNING)
636 return 0;
637
638 sp = p->thread.ksp;
639 if (!validate_sp(sp, p, 112))
640 return 0;
641
642 do {
643 sp = *(unsigned long *)sp;
644 if (!validate_sp(sp, p, 112))
645 return 0;
646 if (count > 0) {
647 ip = *(unsigned long *)(sp + 16);
648 if (!in_sched_functions(ip))
649 return ip;
650 }
651 } while (count++ < 16);
652 return 0;
653}
654EXPORT_SYMBOL(get_wchan);
655
656void show_stack(struct task_struct *p, unsigned long *_sp)
657{
658 unsigned long ip, newsp, lr;
659 int count = 0;
660 unsigned long sp = (unsigned long)_sp;
661 int firstframe = 1;
662
663 if (sp == 0) {
664 if (p) {
665 sp = p->thread.ksp;
666 } else {
667 sp = __get_SP();
668 p = current;
669 }
670 }
671
672 lr = 0;
673 printk("Call Trace:\n");
674 do {
675 if (!validate_sp(sp, p, 112))
676 return;
677
678 _sp = (unsigned long *) sp;
679 newsp = _sp[0];
680 ip = _sp[2];
681 if (!firstframe || ip != lr) {
682 printk("[%016lx] [%016lx] ", sp, ip);
683 print_symbol("%s", ip);
684 if (firstframe)
685 printk(" (unreliable)");
686 printk("\n");
687 }
688 firstframe = 0;
689
690 /*
691 * See if this is an exception frame.
692 * We look for the "regshere" marker in the current frame.
693 */
694 if (validate_sp(sp, p, sizeof(struct pt_regs) + 400)
695 && _sp[12] == 0x7265677368657265ul) {
696 struct pt_regs *regs = (struct pt_regs *)
697 (sp + STACK_FRAME_OVERHEAD);
698 printk("--- Exception: %lx", regs->trap);
699 print_symbol(" at %s\n", regs->nip);
700 lr = regs->link;
701 print_symbol(" LR = %s\n", lr);
702 firstframe = 1;
703 }
704
705 sp = newsp;
706 } while (count++ < kstack_depth_to_print);
707}
708
709void dump_stack(void)
710{
711 show_stack(current, (unsigned long *)__get_SP());
712}
713EXPORT_SYMBOL(dump_stack);