18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
48c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
58c2ecf20Sopenharmony_ci * for more details.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (C) 2020 Loongson Technology Co., Ltd.
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci#ifndef _ASM_BRANCH_H
108c2ecf20Sopenharmony_ci#define _ASM_BRANCH_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <asm/ptrace.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_cistatic inline unsigned long exception_era(struct pt_regs *regs)
158c2ecf20Sopenharmony_ci{
168c2ecf20Sopenharmony_ci	return regs->csr_era;
178c2ecf20Sopenharmony_ci}
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_cistatic inline int compute_return_era(struct pt_regs *regs)
208c2ecf20Sopenharmony_ci{
218c2ecf20Sopenharmony_ci	regs->csr_era += 4;
228c2ecf20Sopenharmony_ci	return 0;
238c2ecf20Sopenharmony_ci}
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#endif /* _ASM_BRANCH_H */
26