diff options
author | Prashanth Mundkur <prashanth.mundkur@gmail.com> | 2019-01-25 20:17:56 -0800 |
---|---|---|
committer | Prashanth Mundkur <prashanth.mundkur@gmail.com> | 2019-01-25 20:17:56 -0800 |
commit | 3f2933fdcdb0ff550d3c8ddbbbcb8400e7c45fd6 (patch) | |
tree | ba7b70da24ef32d70b3e618ee57b8a9405dd3b3f | |
parent | 09c841923f26c398dd51a876b4499a3248793f7a (diff) | |
download | sail-riscv-3f2933fdcdb0ff550d3c8ddbbbcb8400e7c45fd6.zip sail-riscv-3f2933fdcdb0ff550d3c8ddbbbcb8400e7c45fd6.tar.gz sail-riscv-3f2933fdcdb0ff550d3c8ddbbbcb8400e7c45fd6.tar.bz2 |
Tweaks to reservation handling.
-rw-r--r-- | c_emulator/riscv_platform.c | 10 | ||||
-rw-r--r-- | model/riscv_platform.sail | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/c_emulator/riscv_platform.c b/c_emulator/riscv_platform.c index 3587206..e3c85a8 100644 --- a/c_emulator/riscv_platform.c +++ b/c_emulator/riscv_platform.c @@ -39,6 +39,7 @@ unit load_reservation(mach_bits addr) { reservation = addr; reservation_valid = true; + /* fprintf(stderr, "reservation <- %0" PRIx64 "\n", reservation); */ return UNIT; } @@ -46,10 +47,15 @@ bool speculate_conditional(unit u) { return true; } bool match_reservation(mach_bits addr) -{ return reservation_valid && reservation == addr; } +{ /* + fprintf(stderr, "reservation(%c): %0" PRIx64 ", key=%0" PRIx64 "\n", + reservation_valid ? 'v' : 'i', reservation, addr); + */ + return reservation_valid && reservation == addr; +} unit cancel_reservation(unit u) -{ +{ /* fprintf(stderr, "reservation <- none\n"); */ reservation_valid = false; return UNIT; } diff --git a/model/riscv_platform.sail b/model/riscv_platform.sail index 0749de6..71ea9e9 100644 --- a/model/riscv_platform.sail +++ b/model/riscv_platform.sail @@ -267,7 +267,6 @@ function init_platform() -> unit = { } function tick_platform() -> unit = { - cancel_reservation(); htif_tick(); } @@ -285,6 +284,7 @@ function handle_illegal() -> unit = { /* Platform-specific wait-for-interrupt */ function platform_wfi() -> unit = { + cancel_reservation(); /* speed execution by getting the timer to fire at the next instruction, * since we currently don't have any other devices raising interrupts. */ |