summaryrefslogtreecommitdiff
path: root/src/arch/riscv/utility.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/riscv/utility.hh')
-rw-r--r--src/arch/riscv/utility.hh15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/arch/riscv/utility.hh b/src/arch/riscv/utility.hh
index fc67fc806..38109a208 100644
--- a/src/arch/riscv/utility.hh
+++ b/src/arch/riscv/utility.hh
@@ -12,7 +12,7 @@
* unmodified and in its entirety in all distributions of the software,
* modified or unmodified, in source code or in binary form.
*
- * Copyright (c) 2016 The University of Virginia
+ * Copyright (c) 2016-2017 The University of Virginia
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -48,8 +48,11 @@
#include <cmath>
#include <cstdint>
+#include <string>
+#include "arch/riscv/registers.hh"
#include "base/types.hh"
+#include "cpu/reg_class.hh"
#include "cpu/static_inst.hh"
#include "cpu/thread_context.hh"
@@ -126,6 +129,16 @@ copyRegs(ThreadContext *src, ThreadContext *dest)
dest->pcState(src->pcState());
}
+inline std::string
+registerName(RegId reg)
+{
+ if (reg.isIntReg()) {
+ return IntRegNames[reg.index()];
+ } else {
+ return FloatRegNames[reg.index()];
+ }
+}
+
inline void
skipFunction(ThreadContext *tc)
{