18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Kernel exception handling table support.  Derived from arch/alpha/mm/extable.c.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 1998, 1999, 2001-2002, 2004 Hewlett-Packard Co
68c2ecf20Sopenharmony_ci *	David Mosberger-Tang <davidm@hpl.hp.com>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <asm/ptrace.h>
108c2ecf20Sopenharmony_ci#include <asm/extable.h>
118c2ecf20Sopenharmony_ci#include <asm/errno.h>
128c2ecf20Sopenharmony_ci#include <asm/processor.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_civoid
158c2ecf20Sopenharmony_ciia64_handle_exception (struct pt_regs *regs, const struct exception_table_entry *e)
168c2ecf20Sopenharmony_ci{
178c2ecf20Sopenharmony_ci	long fix = (u64) &e->fixup + e->fixup;
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci	regs->r8 = -EFAULT;
208c2ecf20Sopenharmony_ci	if (fix & 4)
218c2ecf20Sopenharmony_ci		regs->r9 = 0;
228c2ecf20Sopenharmony_ci	regs->cr_iip = fix & ~0xf;
238c2ecf20Sopenharmony_ci	ia64_psr(regs)->ri = fix & 0x3;		/* set continuation slot number */
248c2ecf20Sopenharmony_ci}
25