summaryrefslogtreecommitdiff
path: root/src/sim/pseudo_inst.cc
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2019-11-25 02:53:47 -0800
committerGabe Black <gabeblack@google.com>2020-01-06 23:45:53 +0000
commit46117ecdc9eedbf060f32b9e7fb53f509245332d (patch)
treeabed15594dd10663de56deda0665f3f17140b407 /src/sim/pseudo_inst.cc
parent4936474c2cb47528deaeb1b0e8ebca1ffb5b8426 (diff)
downloadgem5-46117ecdc9eedbf060f32b9e7fb53f509245332d.tar.xz
arch,sim: Use the guest ABI mechanism with pseudo instructions.
Right now, there are only two places which call the pseudoInst function directly, the ARM KVM CPU and the generic mmapped IPR. These two callers currently use the generic "PseudoInstABI" which is just a wrapper around the existing getArgument function. In the future, this getArgument function will be disolved, and the PseudoInstABI will be defined for each ABI. Since it currently mimics the Linux ABI since gem5 can only handle one ABI at a time right now, this implementation will probably be shared by linux system calls, except that the pseudo inst implementation will eat return values since those are returned through other means when the pseudo inst is based on magic address ranges. Jira Issue: https://gem5.atlassian.net/browse/GEM5-187 Change-Id: Ied97e4a968795158873e492289a1058c8e4e411b Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23178 Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu> Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Maintainer: Gabe Black <gabeblack@google.com> Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/sim/pseudo_inst.cc')
-rw-r--r--src/sim/pseudo_inst.cc144
1 files changed, 2 insertions, 142 deletions
diff --git a/src/sim/pseudo_inst.cc b/src/sim/pseudo_inst.cc
index 53892b5d1..bd2c64e04 100644
--- a/src/sim/pseudo_inst.cc
+++ b/src/sim/pseudo_inst.cc
@@ -51,10 +51,6 @@
#include <string>
#include <vector>
-#include <gem5/asm/generic/m5ops.h>
-
-#include "arch/pseudo_inst.hh"
-#include "arch/utility.hh"
#include "arch/vtophys.hh"
#include "base/debug.hh"
#include "base/output.hh"
@@ -63,7 +59,6 @@
#include "cpu/quiesce_event.hh"
#include "cpu/thread_context.hh"
#include "debug/Loader.hh"
-#include "debug/PseudoInst.hh"
#include "debug/Quiesce.hh"
#include "debug/WorkItems.hh"
#include "dev/net/dist_iface.hh"
@@ -81,11 +76,10 @@
#include "sim/vptr.hh"
using namespace std;
-
using namespace Stats;
-using namespace TheISA;
-namespace PseudoInst {
+namespace PseudoInst
+{
static inline void
panicFsOnlyPseudoInst(const char *name)
@@ -93,140 +87,6 @@ panicFsOnlyPseudoInst(const char *name)
panic("Pseudo inst \"%s\" is only available in Full System mode.");
}
-uint64_t
-pseudoInst(ThreadContext *tc, uint8_t func, uint8_t subfunc)
-{
- uint64_t args[4];
-
- DPRINTF(PseudoInst, "PseudoInst::pseudoInst(%i, %i)\n", func, subfunc);
-
- // We need to do this in a slightly convoluted way since
- // getArgument() might have side-effects on arg_num. We could have
- // used the Argument class, but due to the possible side effects
- // from getArgument, it'd most likely break.
- int arg_num(0);
- for (int i = 0; i < sizeof(args) / sizeof(*args); ++i) {
- args[arg_num] = getArgument(tc, arg_num, sizeof(uint64_t), false);
- ++arg_num;
- }
-
- switch (func) {
- case M5OP_ARM:
- arm(tc);
- break;
-
- case M5OP_QUIESCE:
- quiesce(tc);
- break;
-
- case M5OP_QUIESCE_NS:
- quiesceNs(tc, args[0]);
- break;
-
- case M5OP_QUIESCE_CYCLE:
- quiesceCycles(tc, args[0]);
- break;
-
- case M5OP_QUIESCE_TIME:
- return quiesceTime(tc);
-
- case M5OP_RPNS:
- return rpns(tc);
-
- case M5OP_WAKE_CPU:
- wakeCPU(tc, args[0]);
- break;
-
- case M5OP_EXIT:
- m5exit(tc, args[0]);
- break;
-
- case M5OP_FAIL:
- m5fail(tc, args[0], args[1]);
- break;
-
- case M5OP_INIT_PARAM:
- return initParam(tc, args[0], args[1]);
-
- case M5OP_LOAD_SYMBOL:
- loadsymbol(tc);
- break;
-
- case M5OP_RESET_STATS:
- resetstats(tc, args[0], args[1]);
- break;
-
- case M5OP_DUMP_STATS:
- dumpstats(tc, args[0], args[1]);
- break;
-
- case M5OP_DUMP_RESET_STATS:
- dumpresetstats(tc, args[0], args[1]);
- break;
-
- case M5OP_CHECKPOINT:
- m5checkpoint(tc, args[0], args[1]);
- break;
-
- case M5OP_WRITE_FILE:
- return writefile(tc, args[0], args[1], args[2], args[3]);
-
- case M5OP_READ_FILE:
- return readfile(tc, args[0], args[1], args[2]);
-
- case M5OP_DEBUG_BREAK:
- debugbreak(tc);
- break;
-
- case M5OP_SWITCH_CPU:
- switchcpu(tc);
- break;
-
- case M5OP_ADD_SYMBOL:
- addsymbol(tc, args[0], args[1]);
- break;
-
- case M5OP_PANIC:
- panic("M5 panic instruction called at %s\n", tc->pcState());
-
- case M5OP_WORK_BEGIN:
- workbegin(tc, args[0], args[1]);
- break;
-
- case M5OP_WORK_END:
- workend(tc, args[0], args[1]);
- break;
-
- case M5OP_ANNOTATE:
- case M5OP_RESERVED2:
- case M5OP_RESERVED3:
- case M5OP_RESERVED4:
- case M5OP_RESERVED5:
- warn("Unimplemented m5 op (0x%x)\n", func);
- break;
-
- /* SE mode functions */
- case M5OP_SE_SYSCALL:
- m5Syscall(tc);
- break;
-
- case M5OP_SE_PAGE_FAULT:
- m5PageFault(tc);
- break;
-
- /* dist-gem5 functions */
- case M5OP_DIST_TOGGLE_SYNC:
- togglesync(tc);
- break;
-
- default:
- warn("Unhandled m5 op: 0x%x\n", func);
- break;
- }
-
- return 0;
-}
-
void
arm(ThreadContext *tc)
{