Merge branches 'acpi-processor', 'acpi-cppc', 'acpi-dbg', 'acpi-misc' and 'acpi-pci'
[linux-2.6-microblaze.git] / arch / x86 / kernel / unwind_orc.c
index 5b0bd85..7f969b2 100644 (file)
@@ -320,12 +320,19 @@ EXPORT_SYMBOL_GPL(unwind_get_return_address);
 
 unsigned long *unwind_get_return_address_ptr(struct unwind_state *state)
 {
+       struct task_struct *task = state->task;
+
        if (unwind_done(state))
                return NULL;
 
        if (state->regs)
                return &state->regs->ip;
 
+       if (task != current && state->sp == task->thread.sp) {
+               struct inactive_task_frame *frame = (void *)task->thread.sp;
+               return &frame->ret_addr;
+       }
+
        if (state->sp)
                return (unsigned long *)state->sp - 1;
 
@@ -617,23 +624,23 @@ EXPORT_SYMBOL_GPL(unwind_next_frame);
 void __unwind_start(struct unwind_state *state, struct task_struct *task,
                    struct pt_regs *regs, unsigned long *first_frame)
 {
-       if (!orc_init)
-               goto done;
-
        memset(state, 0, sizeof(*state));
        state->task = task;
 
+       if (!orc_init)
+               goto err;
+
        /*
         * Refuse to unwind the stack of a task while it's executing on another
         * CPU.  This check is racy, but that's ok: the unwinder has other
         * checks to prevent it from going off the rails.
         */
        if (task_on_another_cpu(task))
-               goto done;
+               goto err;
 
        if (regs) {
                if (user_mode(regs))
-                       goto done;
+                       goto the_end;
 
                state->ip = regs->ip;
                state->sp = regs->sp;
@@ -666,6 +673,7 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task,
                 * generate some kind of backtrace if this happens.
                 */
                void *next_page = (void *)PAGE_ALIGN((unsigned long)state->sp);
+               state->error = true;
                if (get_stack_info(next_page, state->task, &state->stack_info,
                                   &state->stack_mask))
                        return;
@@ -691,8 +699,9 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task,
 
        return;
 
-done:
+err:
+       state->error = true;
+the_end:
        state->stack_info.type = STACK_TYPE_UNKNOWN;
-       return;
 }
 EXPORT_SYMBOL_GPL(__unwind_start);