Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rv64,amo: fix a bug about A extension: if execute sc faild, we should clear lr_valid #123

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/isa/riscv64/instr/rva/amo.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def_rtl(amo_slow_path, rtlreg_t *dest, const rtlreg_t *src1, const rtlreg_t *src

if (funct5 == 0b00010) { // lr
assert(!cpu.amo);
rtl_lms(s, dest, src1, 0, width, MMU_DYNAMIC);
cpu.lr_addr = *src1;
cpu.lr_valid = 1;
rtl_lms(s, dest, src1, 0, width, MMU_DYNAMIC);
return;
} else if (funct5 == 0b00011) { // sc
#ifdef CONFIG_DIFFTEST_STORE_COMMIT
Expand All @@ -43,6 +43,7 @@ def_rtl(amo_slow_path, rtlreg_t *dest, const rtlreg_t *src1, const rtlreg_t *src
rtl_sm(s, src2, src1, 0, width, MMU_DYNAMIC);
cpu.lr_valid = 0;
} else {
cpu.lr_valid = 0;
// Even if scInvalid, SPF (if raised) also needs to be reported
uint64_t paddr = *dsrc1;
if (isa_mmu_check(*dsrc1, width, MEM_TYPE_WRITE) == MMU_TRANSLATE) {
Expand Down