1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Copyright (C) 2021 SiFive 4 */ 5 6#include <linux/linkage.h> 7#include <asm/asm.h> 8#include <asm/asm-offsets.h> 9#include <asm/alternative.h> 10 11.macro ADD_SIGN_EXT pt_reg badaddr tmp_reg 12 REG_L \badaddr, PT_BADADDR(\pt_reg) 13 li \tmp_reg,1 14 slli \tmp_reg,\tmp_reg,0x26 15 and \tmp_reg,\tmp_reg,\badaddr 16 beqz \tmp_reg, 1f 17 li \tmp_reg,-1 18 slli \tmp_reg,\tmp_reg,0x27 19 or \badaddr,\tmp_reg,\badaddr 20 REG_S \badaddr, PT_BADADDR(\pt_reg) 211: 22.endm 23 24ENTRY(sifive_cip_453_page_fault_trp) 25 ADD_SIGN_EXT a0, t0, t1 26#ifdef CONFIG_MMU 27 la t0, do_page_fault 28#else 29 la t0, do_trap_unknown 30#endif 31 jr t0 32END(sifive_cip_453_page_fault_trp) 33 34ENTRY(sifive_cip_453_insn_fault_trp) 35 ADD_SIGN_EXT a0, t0, t1 36 la t0, do_trap_insn_fault 37 jr t0 38END(sifive_cip_453_insn_fault_trp) 39