diff options
author | Andrew Waterman <andrew@sifive.com> | 2020-03-23 12:41:05 -0700 |
---|---|---|
committer | Chih-Min Chao <chihmin.chao@sifive.com> | 2020-04-05 22:35:23 -0700 |
commit | 49ffb3ac6b775b1eb52bbccb1113db6088041b6f (patch) | |
tree | 5f0c0efe92bc14d9797b00d9c21848202a8195b9 /riscv/insns | |
parent | bc1a3965e96f78d03c860e927f7ffed94d40a9d4 (diff) | |
download | spike-49ffb3ac6b775b1eb52bbccb1113db6088041b6f.zip spike-49ffb3ac6b775b1eb52bbccb1113db6088041b6f.tar.gz spike-49ffb3ac6b775b1eb52bbccb1113db6088041b6f.tar.bz2 |
Don't acquire load reservation in the event of a fault
I think this bug wasn't caught because OS code never steps over faulting
LR instructions in practice. The exception is either fatal (in which case
the point is moot) or the LR is re-executed (in which case the point is
also moot).
Resolves #431
Diffstat (limited to 'riscv/insns')
-rw-r--r-- | riscv/insns/lr_d.h | 3 | ||||
-rw-r--r-- | riscv/insns/lr_w.h | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/riscv/insns/lr_d.h b/riscv/insns/lr_d.h index 52090c3..3f3521b 100644 --- a/riscv/insns/lr_d.h +++ b/riscv/insns/lr_d.h @@ -1,4 +1,5 @@ require_extension('A'); require_rv64; +auto res = MMU.load_int64(RS1); MMU.acquire_load_reservation(RS1); -WRITE_RD(MMU.load_int64(RS1)); +WRITE_RD(res); diff --git a/riscv/insns/lr_w.h b/riscv/insns/lr_w.h index c5845a6..8605cc5 100644 --- a/riscv/insns/lr_w.h +++ b/riscv/insns/lr_w.h @@ -1,3 +1,4 @@ require_extension('A'); +auto res = MMU.load_int32(RS1); MMU.acquire_load_reservation(RS1); -WRITE_RD(MMU.load_int32(RS1)); +WRITE_RD(res); |