162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com)
462306a36Sopenharmony_ci * Copyright (C) 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#ifndef __ASM_STACKTRACE_H
862306a36Sopenharmony_ci#define __ASM_STACKTRACE_H
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#include <linux/sched.h>
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci/**
1362306a36Sopenharmony_ci * arc_unwind_core - Unwind the kernel mode stack for an execution context
1462306a36Sopenharmony_ci * @tsk:		NULL for current task, specific task otherwise
1562306a36Sopenharmony_ci * @regs:		pt_regs used to seed the unwinder {SP, FP, BLINK, PC}
1662306a36Sopenharmony_ci * 			If NULL, use pt_regs of @tsk (if !NULL) otherwise
1762306a36Sopenharmony_ci * 			use the current values of {SP, FP, BLINK, PC}
1862306a36Sopenharmony_ci * @consumer_fn:	Callback invoked for each frame unwound
1962306a36Sopenharmony_ci * 			Returns 0 to continue unwinding, -1 to stop
2062306a36Sopenharmony_ci * @arg:		Arg to callback
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci * Returns the address of first function in stack
2362306a36Sopenharmony_ci *
2462306a36Sopenharmony_ci * Semantics:
2562306a36Sopenharmony_ci *  - synchronous unwinding (e.g. dump_stack): @tsk  NULL, @regs  NULL
2662306a36Sopenharmony_ci *  - Asynchronous unwinding of sleeping task: @tsk !NULL, @regs  NULL
2762306a36Sopenharmony_ci *  - Asynchronous unwinding of intr/excp etc: @tsk !NULL, @regs !NULL
2862306a36Sopenharmony_ci */
2962306a36Sopenharmony_cinotrace noinline unsigned int arc_unwind_core(
3062306a36Sopenharmony_ci	struct task_struct *tsk, struct pt_regs *regs,
3162306a36Sopenharmony_ci	int (*consumer_fn) (unsigned int, void *),
3262306a36Sopenharmony_ci	void *arg);
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#endif /* __ASM_STACKTRACE_H */
35