162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Kernel exception handling table support.  Derived from arch/alpha/mm/extable.c.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 1998, 1999, 2001-2002, 2004 Hewlett-Packard Co
662306a36Sopenharmony_ci *	David Mosberger-Tang <davidm@hpl.hp.com>
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#include <asm/ptrace.h>
1062306a36Sopenharmony_ci#include <asm/extable.h>
1162306a36Sopenharmony_ci#include <asm/errno.h>
1262306a36Sopenharmony_ci#include <asm/processor.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_civoid
1562306a36Sopenharmony_ciia64_handle_exception (struct pt_regs *regs, const struct exception_table_entry *e)
1662306a36Sopenharmony_ci{
1762306a36Sopenharmony_ci	long fix = (u64) &e->fixup + e->fixup;
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci	regs->r8 = -EFAULT;
2062306a36Sopenharmony_ci	if (fix & 4)
2162306a36Sopenharmony_ci		regs->r9 = 0;
2262306a36Sopenharmony_ci	regs->cr_iip = fix & ~0xf;
2362306a36Sopenharmony_ci	ia64_psr(regs)->ri = fix & 0x3;		/* set continuation slot number */
2462306a36Sopenharmony_ci}
25