From 62b1ade8bdb728e3b636a372fab60fc65fa67a27 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Wed, 16 Jun 2021 15:21:37 +0300 Subject: [PATCH] RV32I hw layer update --- components/hw/RISC-V/RV32I/hw_cpu.S | 16 ++++++++-------- components/hw/RISC-V/RV32I/hw_cpu.h | 1 + components/hw/RISC-V/{RV32I => }/lang_asm_gcc.h | 0 3 files changed, 9 insertions(+), 8 deletions(-) rename components/hw/RISC-V/{RV32I => }/lang_asm_gcc.h (100%) diff --git a/components/hw/RISC-V/RV32I/hw_cpu.S b/components/hw/RISC-V/RV32I/hw_cpu.S index 7fd0f50..337771f 100644 --- a/components/hw/RISC-V/RV32I/hw_cpu.S +++ b/components/hw/RISC-V/RV32I/hw_cpu.S @@ -42,6 +42,9 @@ #endif ;FX_METADATA(({ implementation: [HW_CPU, RV32I] })) +ASM_ENTRY1(hw_cpu_mcause_get) + csrr a0, mcause + ret ASM_ENTRY1(hw_cpu_dmb) fence @@ -49,8 +52,7 @@ ASM_ENTRY1(hw_cpu_dmb) ASM_ENTRY1(hw_cpu_atomic_cas) fence - csrr t0, mstatus - csrc mstatus, RV_SPEC_MSTATUS_MIE + csrrci t0, mstatus, RV_SPEC_MSTATUS_MIE lw t1, (a0) bne t1, a1, 1f sw a2, (a0) @@ -62,8 +64,7 @@ ASM_ENTRY1(hw_cpu_atomic_cas) ASM_ENTRY1(hw_cpu_atomic_swap) fence - csrr t0, mstatus - csrc mstatus, RV_SPEC_MSTATUS_MIE + csrrci t0, mstatus, RV_SPEC_MSTATUS_MIE lw t1, (a0) sw a1, (a0) csrw mstatus, t0 @@ -73,8 +74,7 @@ ASM_ENTRY1(hw_cpu_atomic_swap) ASM_ENTRY1(hw_cpu_atomic_add) fence - csrr t0, mstatus - csrc mstatus, RV_SPEC_MSTATUS_MIE + csrrci t0, mstatus, RV_SPEC_MSTATUS_MIE lw t1, (a0) add a1, a1, t1 sw a1, (a0) @@ -84,7 +84,7 @@ ASM_ENTRY1(hw_cpu_atomic_add) ret ASM_ENTRY1(hw_cpu_clz) - mv a1, a0 + mv a1, a0 li a2, 0x80000000 li a0, 0 1: @@ -114,7 +114,7 @@ ASM_ENTRY1(hw_cpu_idle) ret ASM_ENTRY1(hw_cpu_intr_enable) - csrs mstatus, RV_SPEC_MSTATUS_MIE + csrsi mstatus, RV_SPEC_MSTATUS_MIE ret ASM_ENTRY1(hw_cpu_intr_disable) diff --git a/components/hw/RISC-V/RV32I/hw_cpu.h b/components/hw/RISC-V/RV32I/hw_cpu.h index af4683b..5edcd45 100644 --- a/components/hw/RISC-V/RV32I/hw_cpu.h +++ b/components/hw/RISC-V/RV32I/hw_cpu.h @@ -49,6 +49,7 @@ uintptr_t hw_cpu_mscratch_get(void); void hw_cpu_mscratch_set(uintptr_t); uintptr_t hw_cpu_mstatus_get(void); uintptr_t hw_cpu_mie_get(void); +uintptr_t hw_cpu_mcause_get(void); void hw_cpu_mie_set(uintptr_t); void hw_cpu_msie_set(unsigned int); diff --git a/components/hw/RISC-V/RV32I/lang_asm_gcc.h b/components/hw/RISC-V/lang_asm_gcc.h similarity index 100% rename from components/hw/RISC-V/RV32I/lang_asm_gcc.h rename to components/hw/RISC-V/lang_asm_gcc.h