blob: e8141aaa1aa9b271224a463d68678215262f0e00 [file] [log] [blame]
xiaohu.huang797c4c12024-01-24 18:52:43 +08001/*
2 * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
7#include <stdio.h>
8#include "exception_handler.h"
9#include "riscv_encoding.h"
10#include "interrupt_control_eclic.h"
11
12uint32_t handle_exception(uint32_t mcause, uint32_t sp)
13{
14 uint32_t mstatus_mps_bits = ((read_csr(mstatus) & MSTATUS_MPS) >> MSTATUS_MPS_LSB);
15 uint8_t exception_type = (mcause & 0x1f);
16
17 printf("mstatus mps:0x%x,exception type:0x%x\n", mstatus_mps_bits, exception_type);
18
19 return 0;
20}
21
22uint32_t handle_nmi(uint32_t mcause, uint32_t sp)
23{
24 return 0;
25}
26
27uint32_t interrupt_register_exception(uint32_t mcause, uint32_t sp)
28{
29 return handle_exception(mcause, sp);
30}
31
32uint32_t interrupt_register_nmi(uint32_t mcause, uint32_t sp)
33{
34 return handle_nmi(mcause, sp);
35}
36