alpha: Implement simPalCheck within the ISA description.
authorGabe Black <gabeblack@google.com>
Sun, 28 Apr 2019 04:00:41 +0000 (21:00 -0700)
committerGabe Black <gabeblack@google.com>
Tue, 30 Apr 2019 07:37:51 +0000 (07:37 +0000)
This doesn't need to be plumbed through generic interfaces. If the
function/instruction got more complex in the future (unlikely since
Alpha doesn't really see development these days), it could be moved to
a helper function defined within Alpha files.

Change-Id: Ib746fad7bb13c5cc9c6ee555c3a46ce686771c12
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18433
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

src/arch/alpha/isa/decoder.isa
src/arch/alpha/isa/main.isa

index 5635d381abf2307656c8e8b3559e579d9858ab9c..8732d70ba2922aff973d60a1baab3839912b7972 100644 (file)
@@ -858,7 +858,30 @@ decode OPCODE default Unknown::unknown() {
             } else {
                 // check to see if simulator wants to do something special
                 // on this PAL call (including maybe suppress it)
-                bool dopal = xc->simPalCheck(palFunc);
+                bool dopal = true;
+                ThreadContext *tc = xc->tcBase();
+                auto *base_stats = tc->getKernelStats();
+                auto *stats = dynamic_cast<AlphaISA::Kernel::Statistics *>(
+                        base_stats);
+                assert(stats || !base_stats);
+                if (stats)
+                    stats->callpal(palFunc, tc);
+
+                System *sys = tc->getSystemPtr();
+
+                switch (palFunc) {
+                  case PAL::halt:
+                    xc->tcBase()->halt();
+                    if (--System::numSystemsRunning == 0)
+                        exitSimLoop("all cpus halted");
+                    break;
+
+                  case PAL::bpt:
+                  case PAL::bugchk:
+                    if (sys->breakpoint())
+                        dopal = false;
+                    break;
+                }
 
                 if (dopal) {
                     xc->setMiscReg(IPR_EXC_ADDR, NPC);
index f77b1f9c9fdc282c730b6f93ec41c5fd7d5b2bfa..3f7e1a39a76f95ebcf67507a0e30c092fbc1a9ae 100644 (file)
@@ -77,6 +77,7 @@ output exec {{
 
 #include "arch/alpha/decoder.hh"
 #include "arch/alpha/kernel_stats.hh"
+#include "arch/alpha/osfpal.hh"
 #include "arch/alpha/registers.hh"
 #include "arch/alpha/regredir.hh"
 #include "arch/generic/memhelpers.hh"