/*
 * Header for stack related functions
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Library General Public License version 2.
 */
#ifndef _STACK_H_
#define _STACK_H_

#include <libcflat.h>
#include <asm/stack.h>

#ifdef HAVE_ARCH_BACKTRACE_FRAME
extern int arch_backtrace_frame(const void *frame, const void **return_addrs,
				int max_depth, bool current_frame);

static inline int backtrace_frame(const void *frame, const void **return_addrs,
				  int max_depth)
{
	return arch_backtrace_frame(frame, return_addrs, max_depth, false);
}

static inline int backtrace(const void **return_addrs, int max_depth)
{
	return arch_backtrace_frame(NULL, return_addrs, max_depth, true);
}
#else
extern int backtrace(const void **return_addrs, int max_depth);

static inline int backtrace_frame(const void *frame, const void **return_addrs,
				  int max_depth)
{
	return 0;
}
#endif

bool __attribute__((weak)) arch_base_address(const void *rebased_addr, unsigned long *addr);

#endif
