arch-riscv: make uret,sret,mret SerializeAfter,NonSpeculative.
authorNils Asmussen <nils.asmussen@barkhauseninstitut.org>
Fri, 21 Feb 2020 12:51:11 +0000 (13:51 +0100)
committerNils Asmussen <nils.asmussen@barkhauseninstitut.org>
Wed, 29 Apr 2020 11:41:55 +0000 (11:41 +0000)
These instructions potentially change the privilege level, upon which
the execution of other instructions depends. For that reason, we need to
make *ret SerializeAfter and we also don't want to execute them
speculatively.

Change-Id: If3b5ba6ec3b4102d53c51cf723eba5d5da3eaa2f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25656
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Gem5 Cloud Project GCB service account <345032938727@cloudbuild.gserviceaccount.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>

src/arch/riscv/isa/decoder.isa

index 9e65ecf5c5047f0ead381dc61cad75d312864f80..35d08ecb3963a984bae38f1c80640a5aef39d21a 100644 (file)
@@ -1775,7 +1775,7 @@ decode QUADRANT default Unknown::unknown() {
                             status.upie = 1;
                             xc->setMiscReg(MISCREG_STATUS, status);
                             NPC = xc->readMiscReg(MISCREG_UEPC);
-                        }}, IsReturn);
+                        }}, IsSerializeAfter, IsNonSpeculative, IsReturn);
                     }
                     0x8: decode RS2 {
                         0x2: sret({{
@@ -1796,7 +1796,7 @@ decode QUADRANT default Unknown::unknown() {
                                 xc->setMiscReg(MISCREG_STATUS, status);
                                 NPC = xc->readMiscReg(MISCREG_SEPC);
                             }
-                        }}, IsReturn);
+                        }}, IsSerializeAfter, IsNonSpeculative, IsReturn);
                         0x5: wfi({{
                             STATUS status = xc->readMiscReg(MISCREG_STATUS);
                             auto pm = (PrivilegeMode)xc->readMiscReg(
@@ -1835,7 +1835,7 @@ decode QUADRANT default Unknown::unknown() {
                             xc->setMiscReg(MISCREG_STATUS, status);
                             NPC = xc->readMiscReg(MISCREG_MEPC);
                         }
-                    }}, IsReturn);
+                    }}, IsSerializeAfter, IsNonSpeculative, IsReturn);
                 }
             }
             format CSROp {