2 * Copyright 2010 Tilera Corporation. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation, version 2.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11 * NON INFRINGEMENT. See the GNU General Public License for
15 #include <linux/sched.h>
16 #include <linux/preempt.h>
17 #include <linux/module.h>
19 #include <linux/kprobes.h>
20 #include <linux/elfcore.h>
21 #include <linux/tick.h>
22 #include <linux/init.h>
24 #include <linux/compat.h>
25 #include <linux/hardirq.h>
26 #include <linux/syscalls.h>
27 #include <linux/kernel.h>
28 #include <linux/tracehook.h>
29 #include <linux/signal.h>
30 #include <asm/stack.h>
31 #include <asm/homecache.h>
32 #include <asm/syscalls.h>
33 #include <asm/traps.h>
34 #include <asm/setup.h>
35 #ifdef CONFIG_HARDWALL
36 #include <asm/hardwall.h>
38 #include <arch/chip.h>
40 #include <arch/sim_def.h>
44 * Use the (x86) "idle=poll" option to prefer low latency when leaving the
45 * idle loop over low power while in the idle loop, e.g. if we have
46 * one thread per core and we want to get threads out of futex waits fast.
48 static int no_idle_nap;
49 static int __init idle_setup(char *str)
54 if (!strcmp(str, "poll")) {
55 pr_info("using polling idle threads.\n");
57 } else if (!strcmp(str, "halt"))
64 early_param("idle", idle_setup);
67 * The idle thread. There's no useful work to be
68 * done, so just try to conserve power and have a
69 * low exit latency (ie sit in a loop waiting for
70 * somebody to say that they'd like to reschedule)
74 int cpu = smp_processor_id();
77 current_thread_info()->status |= TS_POLLING;
81 while (!need_resched())
87 /* endless idle loop with no priority at all */
89 tick_nohz_idle_enter();
91 while (!need_resched()) {
92 if (cpu_is_offline(cpu))
93 BUG(); /* no HOTPLUG_CPU */
96 __get_cpu_var(irq_stat).idle_timestamp = jiffies;
97 current_thread_info()->status &= ~TS_POLLING;
99 * TS_POLLING-cleared state must be visible before we
108 current_thread_info()->status |= TS_POLLING;
111 tick_nohz_idle_exit();
112 schedule_preempt_disabled();
116 struct thread_info *alloc_thread_info_node(struct task_struct *task, int node)
119 gfp_t flags = GFP_KERNEL;
121 #ifdef CONFIG_DEBUG_STACK_USAGE
125 page = alloc_pages_node(node, flags, THREAD_SIZE_ORDER);
129 return (struct thread_info *)page_address(page);
133 * Free a thread_info node, and all of its derivative
136 void free_thread_info(struct thread_info *info)
138 struct single_step_state *step_state = info->step_state;
140 #ifdef CONFIG_HARDWALL
142 * We free a thread_info from the context of the task that has
143 * been scheduled next, so the original task is already dead.
144 * Calling deactivate here just frees up the data structures.
145 * If the task we're freeing held the last reference to a
146 * hardwall fd, it would have been released prior to this point
147 * anyway via exit_files(), and "hardwall" would be NULL by now.
149 if (info->task->thread.hardwall)
150 hardwall_deactivate(info->task);
156 * FIXME: we don't munmap step_state->buffer
157 * because the mm_struct for this process (info->task->mm)
158 * has already been zeroed in exit_mm(). Keeping a
159 * reference to it here seems like a bad move, so this
160 * means we can't munmap() the buffer, and therefore if we
161 * ptrace multiple threads in a process, we will slowly
162 * leak user memory. (Note that as soon as the last
163 * thread in a process dies, we will reclaim all user
164 * memory including single-step buffers in the usual way.)
165 * We should either assign a kernel VA to this buffer
166 * somehow, or we should associate the buffer(s) with the
167 * mm itself so we can clean them up that way.
172 free_pages((unsigned long)info, THREAD_SIZE_ORDER);
175 static void save_arch_state(struct thread_struct *t);
177 int copy_thread(unsigned long clone_flags, unsigned long sp,
178 unsigned long stack_size,
179 struct task_struct *p, struct pt_regs *regs)
181 struct pt_regs *childregs;
185 * When creating a new kernel thread we pass sp as zero.
186 * Assign it to a reasonable value now that we have the stack.
188 if (sp == 0 && regs->ex1 == PL_ICS_EX1(KERNEL_PL, 0))
192 * Do not clone step state from the parent; each thread
193 * must make its own lazily.
195 task_thread_info(p)->step_state = NULL;
198 * Start new thread in ret_from_fork so it schedules properly
199 * and then return from interrupt like the parent.
201 p->thread.pc = (unsigned long) ret_from_fork;
203 /* Save user stack top pointer so we can ID the stack vm area later. */
206 /* Record the pid of the process that created this one. */
207 p->thread.creator_pid = current->pid;
210 * Copy the registers onto the kernel stack so the
211 * return-from-interrupt code will reload it into registers.
213 childregs = task_pt_regs(p);
215 childregs->regs[0] = 0; /* return value is zero */
216 childregs->sp = sp; /* override with new user stack pointer */
219 * If CLONE_SETTLS is set, set "tp" in the new task to "r4",
220 * which is passed in as arg #5 to sys_clone().
222 if (clone_flags & CLONE_SETTLS)
223 childregs->tp = regs->regs[4];
226 * Copy the callee-saved registers from the passed pt_regs struct
227 * into the context-switch callee-saved registers area.
228 * This way when we start the interrupt-return sequence, the
229 * callee-save registers will be correctly in registers, which
230 * is how we assume the compiler leaves them as we start doing
231 * the normal return-from-interrupt path after calling C code.
232 * Zero out the C ABI save area to mark the top of the stack.
234 ksp = (unsigned long) childregs;
235 ksp -= C_ABI_SAVE_AREA_SIZE; /* interrupt-entry save area */
236 ((long *)ksp)[0] = ((long *)ksp)[1] = 0;
237 ksp -= CALLEE_SAVED_REGS_COUNT * sizeof(unsigned long);
238 memcpy((void *)ksp, ®s->regs[CALLEE_SAVED_FIRST_REG],
239 CALLEE_SAVED_REGS_COUNT * sizeof(unsigned long));
240 ksp -= C_ABI_SAVE_AREA_SIZE; /* __switch_to() save area */
241 ((long *)ksp)[0] = ((long *)ksp)[1] = 0;
244 #if CHIP_HAS_TILE_DMA()
246 * No DMA in the new thread. We model this on the fact that
247 * fork() clears the pending signals, alarms, and aio for the child.
249 memset(&p->thread.tile_dma_state, 0, sizeof(struct tile_dma_state));
250 memset(&p->thread.dma_async_tlb, 0, sizeof(struct async_tlb));
253 #if CHIP_HAS_SN_PROC()
254 /* Likewise, the new thread is not running static processor code. */
255 p->thread.sn_proc_running = 0;
256 memset(&p->thread.sn_async_tlb, 0, sizeof(struct async_tlb));
259 #if CHIP_HAS_PROC_STATUS_SPR()
260 /* New thread has its miscellaneous processor state bits clear. */
261 p->thread.proc_status = 0;
264 #ifdef CONFIG_HARDWALL
265 /* New thread does not own any networks. */
266 p->thread.hardwall = NULL;
271 * Start the new thread with the current architecture state
272 * (user interrupt masks, etc.).
274 save_arch_state(&p->thread);
280 * Return "current" if it looks plausible, or else a pointer to a dummy.
281 * This can be helpful if we are just trying to emit a clean panic.
283 struct task_struct *validate_current(void)
285 static struct task_struct corrupt = { .comm = "<corrupt>" };
286 struct task_struct *tsk = current;
287 if (unlikely((unsigned long)tsk < PAGE_OFFSET ||
288 (void *)tsk > high_memory ||
289 ((unsigned long)tsk & (__alignof__(*tsk) - 1)) != 0)) {
290 pr_err("Corrupt 'current' %p (sp %#lx)\n", tsk, stack_pointer);
296 /* Take and return the pointer to the previous task, for schedule_tail(). */
297 struct task_struct *sim_notify_fork(struct task_struct *prev)
299 struct task_struct *tsk = current;
300 __insn_mtspr(SPR_SIM_CONTROL, SIM_CONTROL_OS_FORK_PARENT |
301 (tsk->thread.creator_pid << _SIM_CONTROL_OPERATOR_BITS));
302 __insn_mtspr(SPR_SIM_CONTROL, SIM_CONTROL_OS_FORK |
303 (tsk->pid << _SIM_CONTROL_OPERATOR_BITS));
307 int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
309 struct pt_regs *ptregs = task_pt_regs(tsk);
310 elf_core_copy_regs(regs, ptregs);
314 #if CHIP_HAS_TILE_DMA()
316 /* Allow user processes to access the DMA SPRs */
317 void grant_dma_mpls(void)
319 #if CONFIG_KERNEL_PL == 2
320 __insn_mtspr(SPR_MPL_DMA_CPL_SET_1, 1);
321 __insn_mtspr(SPR_MPL_DMA_NOTIFY_SET_1, 1);
323 __insn_mtspr(SPR_MPL_DMA_CPL_SET_0, 1);
324 __insn_mtspr(SPR_MPL_DMA_NOTIFY_SET_0, 1);
328 /* Forbid user processes from accessing the DMA SPRs */
329 void restrict_dma_mpls(void)
331 #if CONFIG_KERNEL_PL == 2
332 __insn_mtspr(SPR_MPL_DMA_CPL_SET_2, 1);
333 __insn_mtspr(SPR_MPL_DMA_NOTIFY_SET_2, 1);
335 __insn_mtspr(SPR_MPL_DMA_CPL_SET_1, 1);
336 __insn_mtspr(SPR_MPL_DMA_NOTIFY_SET_1, 1);
340 /* Pause the DMA engine, then save off its state registers. */
341 static void save_tile_dma_state(struct tile_dma_state *dma)
343 unsigned long state = __insn_mfspr(SPR_DMA_USER_STATUS);
344 unsigned long post_suspend_state;
346 /* If we're running, suspend the engine. */
347 if ((state & DMA_STATUS_MASK) == SPR_DMA_STATUS__RUNNING_MASK)
348 __insn_mtspr(SPR_DMA_CTR, SPR_DMA_CTR__SUSPEND_MASK);
351 * Wait for the engine to idle, then save regs. Note that we
352 * want to record the "running" bit from before suspension,
353 * and the "done" bit from after, so that we can properly
354 * distinguish a case where the user suspended the engine from
355 * the case where the kernel suspended as part of the context
359 post_suspend_state = __insn_mfspr(SPR_DMA_USER_STATUS);
360 } while (post_suspend_state & SPR_DMA_STATUS__BUSY_MASK);
362 dma->src = __insn_mfspr(SPR_DMA_SRC_ADDR);
363 dma->src_chunk = __insn_mfspr(SPR_DMA_SRC_CHUNK_ADDR);
364 dma->dest = __insn_mfspr(SPR_DMA_DST_ADDR);
365 dma->dest_chunk = __insn_mfspr(SPR_DMA_DST_CHUNK_ADDR);
366 dma->strides = __insn_mfspr(SPR_DMA_STRIDE);
367 dma->chunk_size = __insn_mfspr(SPR_DMA_CHUNK_SIZE);
368 dma->byte = __insn_mfspr(SPR_DMA_BYTE);
369 dma->status = (state & SPR_DMA_STATUS__RUNNING_MASK) |
370 (post_suspend_state & SPR_DMA_STATUS__DONE_MASK);
373 /* Restart a DMA that was running before we were context-switched out. */
374 static void restore_tile_dma_state(struct thread_struct *t)
376 const struct tile_dma_state *dma = &t->tile_dma_state;
379 * The only way to restore the done bit is to run a zero
380 * length transaction.
382 if ((dma->status & SPR_DMA_STATUS__DONE_MASK) &&
383 !(__insn_mfspr(SPR_DMA_USER_STATUS) & SPR_DMA_STATUS__DONE_MASK)) {
384 __insn_mtspr(SPR_DMA_BYTE, 0);
385 __insn_mtspr(SPR_DMA_CTR, SPR_DMA_CTR__REQUEST_MASK);
386 while (__insn_mfspr(SPR_DMA_USER_STATUS) &
387 SPR_DMA_STATUS__BUSY_MASK)
391 __insn_mtspr(SPR_DMA_SRC_ADDR, dma->src);
392 __insn_mtspr(SPR_DMA_SRC_CHUNK_ADDR, dma->src_chunk);
393 __insn_mtspr(SPR_DMA_DST_ADDR, dma->dest);
394 __insn_mtspr(SPR_DMA_DST_CHUNK_ADDR, dma->dest_chunk);
395 __insn_mtspr(SPR_DMA_STRIDE, dma->strides);
396 __insn_mtspr(SPR_DMA_CHUNK_SIZE, dma->chunk_size);
397 __insn_mtspr(SPR_DMA_BYTE, dma->byte);
400 * Restart the engine if we were running and not done.
401 * Clear a pending async DMA fault that we were waiting on return
402 * to user space to execute, since we expect the DMA engine
403 * to regenerate those faults for us now. Note that we don't
404 * try to clear the TIF_ASYNC_TLB flag, since it's relatively
405 * harmless if set, and it covers both DMA and the SN processor.
407 if ((dma->status & DMA_STATUS_MASK) == SPR_DMA_STATUS__RUNNING_MASK) {
408 t->dma_async_tlb.fault_num = 0;
409 __insn_mtspr(SPR_DMA_CTR, SPR_DMA_CTR__REQUEST_MASK);
415 static void save_arch_state(struct thread_struct *t)
417 #if CHIP_HAS_SPLIT_INTR_MASK()
418 t->interrupt_mask = __insn_mfspr(SPR_INTERRUPT_MASK_0_0) |
419 ((u64)__insn_mfspr(SPR_INTERRUPT_MASK_0_1) << 32);
421 t->interrupt_mask = __insn_mfspr(SPR_INTERRUPT_MASK_0);
423 t->ex_context[0] = __insn_mfspr(SPR_EX_CONTEXT_0_0);
424 t->ex_context[1] = __insn_mfspr(SPR_EX_CONTEXT_0_1);
425 t->system_save[0] = __insn_mfspr(SPR_SYSTEM_SAVE_0_0);
426 t->system_save[1] = __insn_mfspr(SPR_SYSTEM_SAVE_0_1);
427 t->system_save[2] = __insn_mfspr(SPR_SYSTEM_SAVE_0_2);
428 t->system_save[3] = __insn_mfspr(SPR_SYSTEM_SAVE_0_3);
429 t->intctrl_0 = __insn_mfspr(SPR_INTCTRL_0_STATUS);
430 #if CHIP_HAS_PROC_STATUS_SPR()
431 t->proc_status = __insn_mfspr(SPR_PROC_STATUS);
433 #if !CHIP_HAS_FIXED_INTVEC_BASE()
434 t->interrupt_vector_base = __insn_mfspr(SPR_INTERRUPT_VECTOR_BASE_0);
436 #if CHIP_HAS_TILE_RTF_HWM()
437 t->tile_rtf_hwm = __insn_mfspr(SPR_TILE_RTF_HWM);
439 #if CHIP_HAS_DSTREAM_PF()
440 t->dstream_pf = __insn_mfspr(SPR_DSTREAM_PF);
444 static void restore_arch_state(const struct thread_struct *t)
446 #if CHIP_HAS_SPLIT_INTR_MASK()
447 __insn_mtspr(SPR_INTERRUPT_MASK_0_0, (u32) t->interrupt_mask);
448 __insn_mtspr(SPR_INTERRUPT_MASK_0_1, t->interrupt_mask >> 32);
450 __insn_mtspr(SPR_INTERRUPT_MASK_0, t->interrupt_mask);
452 __insn_mtspr(SPR_EX_CONTEXT_0_0, t->ex_context[0]);
453 __insn_mtspr(SPR_EX_CONTEXT_0_1, t->ex_context[1]);
454 __insn_mtspr(SPR_SYSTEM_SAVE_0_0, t->system_save[0]);
455 __insn_mtspr(SPR_SYSTEM_SAVE_0_1, t->system_save[1]);
456 __insn_mtspr(SPR_SYSTEM_SAVE_0_2, t->system_save[2]);
457 __insn_mtspr(SPR_SYSTEM_SAVE_0_3, t->system_save[3]);
458 __insn_mtspr(SPR_INTCTRL_0_STATUS, t->intctrl_0);
459 #if CHIP_HAS_PROC_STATUS_SPR()
460 __insn_mtspr(SPR_PROC_STATUS, t->proc_status);
462 #if !CHIP_HAS_FIXED_INTVEC_BASE()
463 __insn_mtspr(SPR_INTERRUPT_VECTOR_BASE_0, t->interrupt_vector_base);
465 #if CHIP_HAS_TILE_RTF_HWM()
466 __insn_mtspr(SPR_TILE_RTF_HWM, t->tile_rtf_hwm);
468 #if CHIP_HAS_DSTREAM_PF()
469 __insn_mtspr(SPR_DSTREAM_PF, t->dstream_pf);
474 void _prepare_arch_switch(struct task_struct *next)
476 #if CHIP_HAS_SN_PROC()
479 #if CHIP_HAS_TILE_DMA()
480 struct tile_dma_state *dma = ¤t->thread.tile_dma_state;
482 save_tile_dma_state(dma);
484 #if CHIP_HAS_SN_PROC()
486 * Suspend the static network processor if it was running.
487 * We do not suspend the fabric itself, just like we don't
488 * try to suspend the UDN.
490 snctl = __insn_mfspr(SPR_SNCTL);
491 current->thread.sn_proc_running =
492 (snctl & SPR_SNCTL__FRZPROC_MASK) == 0;
493 if (current->thread.sn_proc_running)
494 __insn_mtspr(SPR_SNCTL, snctl | SPR_SNCTL__FRZPROC_MASK);
499 struct task_struct *__sched _switch_to(struct task_struct *prev,
500 struct task_struct *next)
502 /* DMA state is already saved; save off other arch state. */
503 save_arch_state(&prev->thread);
505 #if CHIP_HAS_TILE_DMA()
507 * Restore DMA in new task if desired.
508 * Note that it is only safe to restart here since interrupts
509 * are disabled, so we can't take any DMATLB miss or access
510 * interrupts before we have finished switching stacks.
512 if (next->thread.tile_dma_state.enabled) {
513 restore_tile_dma_state(&next->thread);
520 /* Restore other arch state. */
521 restore_arch_state(&next->thread);
523 #if CHIP_HAS_SN_PROC()
525 * Restart static network processor in the new process
526 * if it was running before.
528 if (next->thread.sn_proc_running) {
529 int snctl = __insn_mfspr(SPR_SNCTL);
530 __insn_mtspr(SPR_SNCTL, snctl & ~SPR_SNCTL__FRZPROC_MASK);
534 #ifdef CONFIG_HARDWALL
535 /* Enable or disable access to the network registers appropriately. */
536 if (prev->thread.hardwall != NULL) {
537 if (next->thread.hardwall == NULL)
538 restrict_network_mpls();
539 } else if (next->thread.hardwall != NULL) {
540 grant_network_mpls();
545 * Switch kernel SP, PC, and callee-saved registers.
546 * In the context of the new task, return the old task pointer
547 * (i.e. the task that actually called __switch_to).
548 * Pass the value to use for SYSTEM_SAVE_K_0 when we reset our sp.
550 return __switch_to(prev, next, next_current_ksp0(next));
554 * This routine is called on return from interrupt if any of the
555 * TIF_WORK_MASK flags are set in thread_info->flags. It is
556 * entered with interrupts disabled so we don't miss an event
557 * that modified the thread_info flags. If any flag is set, we
558 * handle it and return, and the calling assembly code will
559 * re-disable interrupts, reload the thread flags, and call back
560 * if more flags need to be handled.
562 * We return whether we need to check the thread_info flags again
563 * or not. Note that we don't clear TIF_SINGLESTEP here, so it's
564 * important that it be tested last, and then claim that we don't
565 * need to recheck the flags.
567 int do_work_pending(struct pt_regs *regs, u32 thread_info_flags)
569 if (thread_info_flags & _TIF_NEED_RESCHED) {
573 #if CHIP_HAS_TILE_DMA() || CHIP_HAS_SN_PROC()
574 if (thread_info_flags & _TIF_ASYNC_TLB) {
575 do_async_page_fault(regs);
579 if (thread_info_flags & _TIF_SIGPENDING) {
583 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
584 clear_thread_flag(TIF_NOTIFY_RESUME);
585 tracehook_notify_resume(regs);
586 if (current->replacement_session_keyring)
587 key_replace_session_keyring();
590 if (thread_info_flags & _TIF_SINGLESTEP) {
591 if ((regs->ex1 & SPR_EX_CONTEXT_1_1__PL_MASK) == 0)
592 single_step_once(regs);
595 panic("work_pending: bad flags %#x\n", thread_info_flags);
598 /* Note there is an implicit fifth argument if (clone_flags & CLONE_SETTLS). */
599 SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
600 void __user *, parent_tidptr, void __user *, child_tidptr,
601 struct pt_regs *, regs)
605 return do_fork(clone_flags, newsp, regs, 0,
606 parent_tidptr, child_tidptr);
610 * sys_execve() executes a new program.
612 SYSCALL_DEFINE4(execve, const char __user *, path,
613 const char __user *const __user *, argv,
614 const char __user *const __user *, envp,
615 struct pt_regs *, regs)
620 filename = getname(path);
621 error = PTR_ERR(filename);
622 if (IS_ERR(filename))
624 error = do_execve(filename, argv, envp, regs);
627 single_step_execve();
633 long compat_sys_execve(const char __user *path,
634 compat_uptr_t __user *argv,
635 compat_uptr_t __user *envp,
636 struct pt_regs *regs)
641 filename = getname(path);
642 error = PTR_ERR(filename);
643 if (IS_ERR(filename))
645 error = compat_do_execve(filename, argv, envp, regs);
648 single_step_execve();
654 unsigned long get_wchan(struct task_struct *p)
656 struct KBacktraceIterator kbt;
658 if (!p || p == current || p->state == TASK_RUNNING)
661 for (KBacktraceIterator_init(&kbt, p, NULL);
662 !KBacktraceIterator_end(&kbt);
663 KBacktraceIterator_next(&kbt)) {
664 if (!in_sched_functions(kbt.it.pc))
672 * We pass in lr as zero (cleared in kernel_thread) and the caller
673 * part of the backtrace ABI on the stack also zeroed (in copy_thread)
674 * so that backtraces will stop with this function.
675 * Note that we don't use r0, since copy_thread() clears it.
677 static void start_kernel_thread(int dummy, int (*fn)(int), int arg)
683 * Create a kernel thread
685 int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
689 memset(®s, 0, sizeof(regs));
690 regs.ex1 = PL_ICS_EX1(KERNEL_PL, 0); /* run at kernel PL, no ICS */
691 regs.pc = (long) start_kernel_thread;
692 regs.flags = PT_FLAGS_CALLER_SAVES; /* need to restore r1 and r2 */
693 regs.regs[1] = (long) fn; /* function pointer */
694 regs.regs[2] = (long) arg; /* parameter register */
696 /* Ok, create the new process.. */
697 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s,
700 EXPORT_SYMBOL(kernel_thread);
702 /* Flush thread state. */
703 void flush_thread(void)
709 * Free current thread data structures etc..
711 void exit_thread(void)
716 void show_regs(struct pt_regs *regs)
718 struct task_struct *tsk = validate_current();
722 pr_err(" Pid: %d, comm: %20s, CPU: %d\n",
723 tsk->pid, tsk->comm, smp_processor_id());
725 for (i = 0; i < 51; i += 3)
726 pr_err(" r%-2d: "REGFMT" r%-2d: "REGFMT" r%-2d: "REGFMT"\n",
727 i, regs->regs[i], i+1, regs->regs[i+1],
728 i+2, regs->regs[i+2]);
729 pr_err(" r51: "REGFMT" r52: "REGFMT" tp : "REGFMT"\n",
730 regs->regs[51], regs->regs[52], regs->tp);
731 pr_err(" sp : "REGFMT" lr : "REGFMT"\n", regs->sp, regs->lr);
733 for (i = 0; i < 52; i += 4)
734 pr_err(" r%-2d: "REGFMT" r%-2d: "REGFMT
735 " r%-2d: "REGFMT" r%-2d: "REGFMT"\n",
736 i, regs->regs[i], i+1, regs->regs[i+1],
737 i+2, regs->regs[i+2], i+3, regs->regs[i+3]);
738 pr_err(" r52: "REGFMT" tp : "REGFMT" sp : "REGFMT" lr : "REGFMT"\n",
739 regs->regs[52], regs->tp, regs->sp, regs->lr);
741 pr_err(" pc : "REGFMT" ex1: %ld faultnum: %ld\n",
742 regs->pc, regs->ex1, regs->faultnum);
744 dump_stack_regs(regs);