aboutsummaryrefslogtreecommitdiff
path: root/riscv/mmu.h
diff options
context:
space:
mode:
authorRyan Buchner <ryan.buchner@arilinc.com>2022-04-21 11:23:35 -0700
committerRyan Buchner <ryan.buchner@arilinc.com>2022-04-21 13:00:07 -0700
commit61eba540e15d4f27d8c3a78b605c614096b3e552 (patch)
tree7d7fb9d7af6ffb826fa02c9c7ba8ad667648104a /riscv/mmu.h
parent004bdc492710e0abd23771fdba33097a9ae1f792 (diff)
downloadspike-61eba540e15d4f27d8c3a78b605c614096b3e552.zip
spike-61eba540e15d4f27d8c3a78b605c614096b3e552.tar.gz
spike-61eba540e15d4f27d8c3a78b605c614096b3e552.tar.bz2
Modify store_func to throw fault if misaligned and require_alignment=true
Diffstat (limited to 'riscv/mmu.h')
-rw-r--r--riscv/mmu.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/riscv/mmu.h b/riscv/mmu.h
index c08acd3..415cf1a 100644
--- a/riscv/mmu.h
+++ b/riscv/mmu.h
@@ -148,8 +148,10 @@ 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, bool actually_store=true, bool require_alignment=false) { \
- if (unlikely(addr & (sizeof(type##_t)-1))) \
- return misaligned_store(addr, val, sizeof(type##_t), xlate_flags); \
+ if (unlikely(addr & (sizeof(type##_t)-1))) { \
+ if (require_alignment) store_conditional_address_misaligned(addr); \
+ else return misaligned_store(addr, val, sizeof(type##_t), xlate_flags); \
+ } \
reg_t vpn = addr >> PGSHIFT; \
size_t size = sizeof(type##_t); \
if ((xlate_flags) == 0 && likely(tlb_store_tag[vpn % TLB_ENTRIES] == vpn)) { \