From bf8d2b71bb76b03b9a4db36fe6928c29a41a43e7 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Thu, 10 Nov 2016 13:40:37 -0800 Subject: AMOs should always return store faults, not load faults This commit also factors out the common AMO code into mmu_t. --- riscv/insns/amoand_w.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'riscv/insns/amoand_w.h') diff --git a/riscv/insns/amoand_w.h b/riscv/insns/amoand_w.h index 7db2160..f7e1ba7 100644 --- a/riscv/insns/amoand_w.h +++ b/riscv/insns/amoand_w.h @@ -1,4 +1,2 @@ require_extension('A'); -reg_t v = MMU.load_int32(RS1); -MMU.store_uint32(RS1, RS2 & v); -WRITE_RD(v); +WRITE_RD(sext32(MMU.amo_uint32(RS1, [&](uint32_t lhs) { return lhs & RS2; }))); -- cgit v1.1