From b1e7493a652b969c3aed96628a347f683dd1af16 Mon Sep 17 00:00:00 2001 From: Ryan Buchner Date: Tue, 12 Apr 2022 12:53:18 -0700 Subject: Add actually_store tag to store_func and store_slow_path Will be used to check store attributes without actually performing the store. Needed to AMO bug fix. --- riscv/mmu.cc | 2 +- riscv/mmu.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/riscv/mmu.cc b/riscv/mmu.cc index fd8a320..6c7af21 100644 --- a/riscv/mmu.cc +++ b/riscv/mmu.cc @@ -161,7 +161,7 @@ void mmu_t::load_slow_path(reg_t addr, reg_t len, uint8_t* bytes, uint32_t xlate } } -void mmu_t::store_slow_path(reg_t addr, reg_t len, const uint8_t* bytes, uint32_t xlate_flags) +void mmu_t::store_slow_path(reg_t addr, reg_t len, const uint8_t* bytes, uint32_t xlate_flags, bool actually_store) { reg_t paddr = translate(addr, len, STORE, xlate_flags); diff --git a/riscv/mmu.h b/riscv/mmu.h index 3782ffa..deacbc4 100644 --- a/riscv/mmu.h +++ b/riscv/mmu.h @@ -147,7 +147,7 @@ public: // template for functions that store an aligned value to memory #define store_func(type, prefix, xlate_flags) \ - void prefix##_##type(reg_t addr, type##_t val) { \ + void prefix##_##type(reg_t addr, type##_t val, bool actually_store=true) { \ if (unlikely(addr & (sizeof(type##_t)-1))) \ return misaligned_store(addr, val, sizeof(type##_t), xlate_flags); \ reg_t vpn = addr >> PGSHIFT; \ @@ -167,7 +167,7 @@ public: } \ else { \ target_endian target_val = to_target(val); \ - store_slow_path(addr, sizeof(type##_t), (const uint8_t*)&target_val, (xlate_flags)); \ + store_slow_path(addr, sizeof(type##_t), (const uint8_t*)&target_val, (xlate_flags), actually_store); \ if (proc) WRITE_MEM(addr, val, size); \ } \ } @@ -438,7 +438,7 @@ private: // handle uncommon cases: TLB misses, page faults, MMIO tlb_entry_t fetch_slow_path(reg_t addr); void load_slow_path(reg_t addr, reg_t len, uint8_t* bytes, uint32_t xlate_flags); - void store_slow_path(reg_t addr, reg_t len, const uint8_t* bytes, uint32_t xlate_flags); + void store_slow_path(reg_t addr, reg_t len, const uint8_t* bytes, uint32_t xlate_flags, bool actually_store); bool mmio_load(reg_t addr, size_t len, uint8_t* bytes); bool mmio_store(reg_t addr, size_t len, const uint8_t* bytes); bool mmio_ok(reg_t addr, access_type type); -- cgit v1.1