Merge remote-tracking branch 'torvalds/master' into perf/core
[linux-2.6-block.git] / arch / loongarch / include / asm / unwind.h
CommitLineData
49232773
QZ
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Most of this ideas comes from x86.
4 *
5 * Copyright (C) 2022 Loongson Technology Corporation Limited
6 */
7#ifndef _ASM_UNWIND_H
8#define _ASM_UNWIND_H
9
10#include <linux/sched.h>
11
12#include <asm/stacktrace.h>
13
49aef111
QZ
14enum unwinder_type {
15 UNWINDER_GUESS,
16 UNWINDER_PROLOGUE,
17};
18
49232773 19struct unwind_state {
49aef111 20 char type; /* UNWINDER_XXX */
49232773
QZ
21 struct stack_info stack_info;
22 struct task_struct *task;
4733f09d 23 bool first, error, is_ftrace;
a51ac524 24 int graph_idx;
49aef111 25 unsigned long sp, pc, ra;
49232773
QZ
26};
27
28void unwind_start(struct unwind_state *state,
29 struct task_struct *task, struct pt_regs *regs);
30bool unwind_next_frame(struct unwind_state *state);
31unsigned long unwind_get_return_address(struct unwind_state *state);
32
33static inline bool unwind_done(struct unwind_state *state)
34{
35 return state->stack_info.type == STACK_TYPE_UNKNOWN;
36}
37
38static inline bool unwind_error(struct unwind_state *state)
39{
40 return state->error;
41}
42
43#endif /* _ASM_UNWIND_H */