diff --git a/MdePkg/Library/BaseLib/LoongArch64/AsmCsr.S b/MdePkg/Library/BaseLib/LoongArch64/AsmCsr.S index 3a879411f5..eb82724503 100644 --- a/MdePkg/Library/BaseLib/LoongArch64/AsmCsr.S +++ b/MdePkg/Library/BaseLib/LoongArch64/AsmCsr.S @@ -100,8 +100,7 @@ DirMapCsrRd: jirl $zero, $t0, 0 ReadSelNumErr: - addi.d $a0, $zero, -1 - jirl $zero, $ra, 0 + break 0 BasicCsrRead: CsrSel = LOONGARCH_CSR_CRMD @@ -230,8 +229,7 @@ DirMapCsrWr: jirl $zero, $t0, 0 WriteSelNumErr: - addi.d $a0, $zero, -1 - jirl $zero, $ra, 0 + break 0 BasicCsrWrite: CsrSel = LOONGARCH_CSR_CRMD @@ -368,8 +366,7 @@ DirMapCsrXchg: jirl $zero, $t0, 0 XchgSelNumErr: - addi.d $a0, $zero, -1 - jirl $zero, $ra, 0 + break 0 BasicCsrXchange: CsrSel = LOONGARCH_CSR_CRMD diff --git a/MdePkg/Library/BaseLib/LoongArch64/Csr.c b/MdePkg/Library/BaseLib/LoongArch64/Csr.c index f2ec80b38d..5a40bfede5 100644 --- a/MdePkg/Library/BaseLib/LoongArch64/Csr.c +++ b/MdePkg/Library/BaseLib/LoongArch64/Csr.c @@ -29,7 +29,8 @@ AsmCsrXChg ( @param[in] Select CSR read instruction select values. - @return The return value of csrrd instruction, return -1 means Select is out of support. + @return The return value of csrrd instruction, + if a break exception is triggered, the Select is out of support. **/ UINTN EFIAPI @@ -47,7 +48,7 @@ CsrRead ( @param[in, out] Value The csrwr will write the value. @return The return value of csrwr instruction, that is, store the old value of - the register, return -1 means Select is out of support. + the register, if a break exception is triggered, the Select is out of support. **/ UINTN EFIAPI @@ -67,7 +68,7 @@ CsrWrite ( @param[in] Mask The csrxchg mask value. @return The return value of csrxchg instruction, that is, store the old value of - the register, return -1 means Select is out of support. + the register, if a break exception is triggered, the Select is out of support. **/ UINTN EFIAPI