unwind.c (05909cd9a0c8811731b38697af13075e8954314f) unwind.c (05cdf457477d6603b207d91873f0a3d4c7f8c1cd)
1/*
2 * Backtrace support for Microblaze
3 *
4 * Copyright (C) 2010 Digital Design Corporation
5 *
6 * Based on arch/sh/kernel/cpu/sh5/unwind.c code which is:
7 * Copyright (C) 2004 Paul Mundt
8 * Copyright (C) 2004 Richard Curnow

--- 147 unchanged lines hidden (view full) ---

156 unsigned long leaf_return,
157 struct stack_trace *trace,
158 const char *loglvl);
159
160/**
161 * unwind_trap - Unwind through a system trap, that stored previous state
162 * on the stack.
163 */
1/*
2 * Backtrace support for Microblaze
3 *
4 * Copyright (C) 2010 Digital Design Corporation
5 *
6 * Based on arch/sh/kernel/cpu/sh5/unwind.c code which is:
7 * Copyright (C) 2004 Paul Mundt
8 * Copyright (C) 2004 Richard Curnow

--- 147 unchanged lines hidden (view full) ---

156 unsigned long leaf_return,
157 struct stack_trace *trace,
158 const char *loglvl);
159
160/**
161 * unwind_trap - Unwind through a system trap, that stored previous state
162 * on the stack.
163 */
164#ifdef CONFIG_MMU
165static inline void unwind_trap(struct task_struct *task, unsigned long pc,
166 unsigned long fp, struct stack_trace *trace,
167 const char *loglvl)
168{
169 /* To be implemented */
170}
164static inline void unwind_trap(struct task_struct *task, unsigned long pc,
165 unsigned long fp, struct stack_trace *trace,
166 const char *loglvl)
167{
168 /* To be implemented */
169}
171#else
172static inline void unwind_trap(struct task_struct *task, unsigned long pc,
173 unsigned long fp, struct stack_trace *trace,
174 const char *loglvl)
175{
176 const struct pt_regs *regs = (const struct pt_regs *) fp;
177 microblaze_unwind_inner(task, regs->pc, regs->r1, regs->r15, trace, loglvl);
178}
179#endif
180
181/**
182 * microblaze_unwind_inner - Unwind the stack from the specified point
183 * @task : Task whose stack we are to unwind (may be NULL)
184 * @pc : Program counter from which we start unwinding
185 * @fp : Frame (stack) pointer from which we start unwinding
186 * @leaf_return : Value of r15 at pc. If the function is a leaf, this is
187 * the caller's return address.

--- 22 unchanged lines hidden (view full) ---

210
211 /* Is previous function the HW exception handler? */
212 if ((return_to >= (unsigned long)&_hw_exception_handler)
213 &&(return_to < (unsigned long)&ex_handler_unhandled)) {
214 /*
215 * HW exception handler doesn't save all registers,
216 * so we open-code a special case of unwind_trap()
217 */
170
171/**
172 * microblaze_unwind_inner - Unwind the stack from the specified point
173 * @task : Task whose stack we are to unwind (may be NULL)
174 * @pc : Program counter from which we start unwinding
175 * @fp : Frame (stack) pointer from which we start unwinding
176 * @leaf_return : Value of r15 at pc. If the function is a leaf, this is
177 * the caller's return address.

--- 22 unchanged lines hidden (view full) ---

200
201 /* Is previous function the HW exception handler? */
202 if ((return_to >= (unsigned long)&_hw_exception_handler)
203 &&(return_to < (unsigned long)&ex_handler_unhandled)) {
204 /*
205 * HW exception handler doesn't save all registers,
206 * so we open-code a special case of unwind_trap()
207 */
218#ifndef CONFIG_MMU
219 const struct pt_regs *regs =
220 (const struct pt_regs *) fp;
221#endif
222 printk("%sHW EXCEPTION\n", loglvl);
208 printk("%sHW EXCEPTION\n", loglvl);
223#ifndef CONFIG_MMU
224 microblaze_unwind_inner(task, regs->r17 - 4,
225 fp + EX_HANDLER_STACK_SIZ,
226 regs->r15, trace, loglvl);
227#endif
228 return;
229 }
230
231 /* Is previous function a trap handler? */
232 for (; handler->start_addr; ++handler) {
233 if ((return_to >= handler->start_addr)
234 && (return_to <= handler->end_addr)) {
235 if (!trace)

--- 93 unchanged lines hidden ---
209 return;
210 }
211
212 /* Is previous function a trap handler? */
213 for (; handler->start_addr; ++handler) {
214 if ((return_to >= handler->start_addr)
215 && (return_to <= handler->end_addr)) {
216 if (!trace)

--- 93 unchanged lines hidden ---