1/* 2 * Copyright (c) 2017 Jean-Paul Etienne <fractalclone@gmail.com> 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7/* 8 * common interrupt management code for riscv SOCs supporting the riscv 9 * privileged architecture specification 10 */ 11#include <zephyr/kernel_structs.h> 12#include <zephyr/offsets.h> 13#include <zephyr/toolchain.h> 14#include <zephyr/linker/sections.h> 15#include <zephyr/arch/riscv/irq.h> 16 17/* 18 * __soc_handle_irq is defined as .weak to allow re-implementation by 19 * SOCs that do not truly follow the riscv privilege specification. 20 */ 21WTEXT(__soc_handle_irq) 22 23/* 24 * SOC-specific function to handle pending IRQ number generating the interrupt. 25 * Exception number is given as parameter via register a0. 26 */ 27SECTION_FUNC(exception.other, __soc_handle_irq) 28 /* Clear exception number from CSR mip register */ 29 li t1, 1 30 sll t0, t1, a0 31 csrrc t1, mip, t0 32 33 /* Return */ 34 ret 35