aboutsummaryrefslogtreecommitdiff
path: root/riscv/mmu.h
diff options
context:
space:
mode:
authordave-estes-syzexion <53795406+dave-estes-syzexion@users.noreply.github.com>2019-09-18 16:24:55 -0400
committerAndrew Waterman <andrew@sifive.com>2019-09-18 13:24:55 -0700
commita515af6d3bb5146a0a68cf88adf032fe78ba4ead (patch)
tree81ba3fb8de07e39b07f08d9bc81a98e86ff950f7 /riscv/mmu.h
parentc171379c7828ae94d969846874a7ac542dbda2c3 (diff)
downloadriscv-isa-sim-a515af6d3bb5146a0a68cf88adf032fe78ba4ead.zip
riscv-isa-sim-a515af6d3bb5146a0a68cf88adf032fe78ba4ead.tar.gz
riscv-isa-sim-a515af6d3bb5146a0a68cf88adf032fe78ba4ead.tar.bz2
Extends the commit log feature with memory writes. (#324)
* Extends the commit log feature with memory writes. This provides a little more information for debugging instruction traces, allowing you to maintain the state of memory as the trace is processed. The following sample trace output illustrates the formatting of the new memory writes. The first line is an instruction at location 0x80000094, containing the bytes (0x80830313) and commiting the value 0x80000898 to the register x6. The second line is an instruction which neither commits a register nor writes memory. The third line writes the value 0x0 to 0x80000890. 3 0x80000094 (0x80830313) x 6 0x80000898 3 0x80000098 (0x0062d663) 3 0x8000009c (0x00028023) mem 0x80000890 0x0 * Changes addressing feedback from review.
Diffstat (limited to 'riscv/mmu.h')
-rw-r--r--riscv/mmu.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/riscv/mmu.h b/riscv/mmu.h
index 5fa93ff..9826cf1 100644
--- a/riscv/mmu.h
+++ b/riscv/mmu.h
@@ -112,6 +112,16 @@ public:
load_func(int32)
load_func(int64)
+#ifndef RISCV_ENABLE_COMMITLOG
+# define WRITE_MEM(addr, value, size) ({})
+#else
+# define WRITE_MEM(addr, val, size) ({ \
+ proc->state.log_mem_write.addr = addr; \
+ proc->state.log_mem_write.value = val; \
+ proc->state.log_mem_write.size = size; \
+ })
+#endif
+
// template for functions that store an aligned value to memory
#define store_func(type) \
void store_##type(reg_t addr, type##_t val) { \
@@ -130,7 +140,11 @@ public:
} \
else \
store_slow_path(addr, sizeof(type##_t), (const uint8_t*)&val); \
- }
+ if (proc) { \
+ size_t size = sizeof(type##_t); \
+ WRITE_MEM(addr, val, size); \
+ } \
+ }
// template for functions that perform an atomic memory operation
#define amo_func(type) \