From 2dc822da1bc043fc3e19b5bc264807e044700d93 Mon Sep 17 00:00:00 2001 From: bacon Date: Mon, 3 Feb 2025 13:12:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9B=E5=85=A5=E4=B8=AD=E6=96=AD=EF=BC=8C?= =?UTF-8?q?=E7=A1=AC=E4=BB=B6=E8=87=AA=E5=8A=A8=E7=A6=81=E7=94=A8=E4=B8=AD?= =?UTF-8?q?=E6=96=AD=EF=BC=8C=E5=87=BA=E4=B8=AD=E6=96=AD=EF=BC=8C=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=BC=80=E5=90=AF=E4=B8=AD=E6=96=AD=EF=BC=8C=E6=97=A0?= =?UTF-8?q?=E9=9C=80=E6=89=8B=E5=8A=A8=E6=93=8D=E4=BD=9C=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=AF=B9=E5=BA=94=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tb/sw/src/mstStartup.S | 8 ++++++++ tb/sw/src/mstSvr.S | 24 +++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/tb/sw/src/mstStartup.S b/tb/sw/src/mstStartup.S index c9781b0..eaf2035 100644 --- a/tb/sw/src/mstStartup.S +++ b/tb/sw/src/mstStartup.S @@ -128,15 +128,19 @@ trap_entry: sw t6,124(sp) #endif +#if 0 csrr t0, mstatus # 读取 mstatus 寄存器 andi t0, t0, ~(1 << 3) # 清除 MIE 位 (全局中断禁用) csrw mstatus, t0 # 写回 mstatus 寄存器 +#endif call plic_handle +#if 0 csrr t0, mstatus ori t0, t0, 1<<3 csrw mstatus, t0 +#endif lw ra,4(sp) lw sp,8(sp) @@ -219,9 +223,11 @@ opt_trap_entry: #sw t5,120(sp) #sw t6,124(sp) +#if 0 csrr t0, mstatus # 读取 mstatus 寄存器 andi t0, t0, ~(1 << 3) # 清除 MIE 位 (全局中断禁用) csrw mstatus, t0 # 写回 mstatus 寄存器 +#endif lui t1, %hi(plic_claim) lw t0, %lo(plic_claim)(t1) # t0 = &plic_claim @@ -264,9 +270,11 @@ opt_trap_entry: sw s1,%lo(flag_intRxEnd)(s0) 4: +#if 0 csrr t0, mstatus ori t0, t0, 1<<3 csrw mstatus, t0 +#endif #lw ra,4(sp) #lw sp,8(sp) diff --git a/tb/sw/src/mstSvr.S b/tb/sw/src/mstSvr.S index 850dd38..73a0d4d 100644 --- a/tb/sw/src/mstSvr.S +++ b/tb/sw/src/mstSvr.S @@ -42,15 +42,17 @@ _prog_start: .balign 32 _rv32i_plic_handle: +#if 0 /*RV32的核心自动禁用中断,无需手动禁用*/ csrr x16, mstatus # 读取 mstatus 寄存器 andi x16, x16, ~(1 << 3) # 清除 MIE 位 (全局中断禁用) csrw mstatus, x16 # 写回 mstatus 寄存器 +#endif lw x23, 0(x17) # x23 = *plic_claim sw x23, 0(x17) # *plic_claim = x23 #li x25, 1 - +#if 0 li x24, CDR_INT_TXEND bne x23, x24, 1f #_if (x23 != x24) goto 1f sw x25, 0(x18) #_else @@ -72,9 +74,29 @@ _rv32i_plic_handle: li x24, CDR_INT_RXEND bne x23, x24, 4f #_if (x23 != x24) goto 4f sw x25, 0(x21) #_else +#else + bne x23, x28, 1f #_if (x23 != x24) goto 1f + sw x25, 0(x18) #_else + j 4f +1: + bne x23, x29, 2f #_if (x23 != x24) goto 2f + sw x25, 0(x19) #_else + j 4f + +2: + bne x23, x30, 3f #_if (x23 != x24) goto 3f + sw x25, 0(x20) #_else + j 4f + +3: + bne x23, x31, 4f #_if (x23 != x24) goto 4f + sw x25, 0(x21) #_else +#endif 4: +#if 0 /*RV32的核心自动启动中断,无需手动启用*/ csrr x16, mstatus ori x16, x16, 1<<3 csrw mstatus, x16 +#endif mret