aboutsummaryrefslogtreecommitdiff
path: root/fesvr/memif.h
diff options
context:
space:
mode:
authorIman Hosseini <hosseini.iman@yahoo.com>2022-09-20 00:05:00 -0400
committerIman Hosseini <hosseini.iman@yahoo.com>2022-09-20 00:05:00 -0400
commitdfd191367991cb157b53767dcc05824c826b5abd (patch)
tree8891eff92502ba3d42a9ddf372f0f2f6e5a5e44c /fesvr/memif.h
parenta0972c82d022f6f7c337b06b27c89a60af52202a (diff)
downloadspike-dfd191367991cb157b53767dcc05824c826b5abd.zip
spike-dfd191367991cb157b53767dcc05824c826b5abd.tar.gz
spike-dfd191367991cb157b53767dcc05824c826b5abd.tar.bz2
detects the loading of isa-incompatible (i.e. 32 bit code to 64bit HART) code and emits an error message to help avoid unintentionally loading wrong elf.
Diffstat (limited to 'fesvr/memif.h')
-rw-r--r--fesvr/memif.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/fesvr/memif.h b/fesvr/memif.h
index 001c425..3f9bd2d 100644
--- a/fesvr/memif.h
+++ b/fesvr/memif.h
@@ -5,6 +5,7 @@
#include <stdint.h>
#include <stddef.h>
+#include <stdexcept>
#include "byteorder.h"
typedef uint64_t reg_t;
@@ -79,4 +80,11 @@ protected:
chunked_memif_t* cmemif;
};
+class incompat_xlen : public std::exception {
+public:
+ const unsigned expected_xlen;
+ const unsigned actual_xlen;
+ incompat_xlen(unsigned _expected_xlen, unsigned _actual_xlen) : expected_xlen(_expected_xlen), actual_xlen(_actual_xlen) {}
+};
+
#endif // __MEMIF_H