aboutsummaryrefslogtreecommitdiff
path: root/fesvr/htif.cc
diff options
context:
space:
mode:
authorMarcus Comstedt <marcus@mc.pp.se>2019-08-18 16:03:43 +0200
committerChih-Min Chao <chihmin.chao@sifive.com>2019-10-29 03:33:45 -0700
commit65648669c15343cb1aa6b102cf2eae0ed91024cd (patch)
tree4530bee628e72cf17adeca999e9826ea4a0f88a9 /fesvr/htif.cc
parent7c85cc44d13547ab7260438d97671d7f423e5d6c (diff)
downloadspike-65648669c15343cb1aa6b102cf2eae0ed91024cd.zip
spike-65648669c15343cb1aa6b102cf2eae0ed91024cd.tar.gz
spike-65648669c15343cb1aa6b102cf2eae0ed91024cd.tar.bz2
Implement support for big-endian hosts
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
Diffstat (limited to 'fesvr/htif.cc')
-rw-r--r--fesvr/htif.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/fesvr/htif.cc b/fesvr/htif.cc
index d9ff341..d9e884f 100644
--- a/fesvr/htif.cc
+++ b/fesvr/htif.cc
@@ -4,6 +4,7 @@
#include "rfb.h"
#include "elfloader.h"
#include "encoding.h"
+#include "byteorder.h"
#include <algorithm>
#include <assert.h>
#include <vector>
@@ -183,7 +184,7 @@ int htif_t::run()
while (!signal_exit && exitcode == 0)
{
- if (auto tohost = mem.read_uint64(tohost_addr)) {
+ if (auto tohost = from_le(mem.read_uint64(tohost_addr))) {
mem.write_uint64(tohost_addr, 0);
command_t cmd(mem, tohost, fromhost_callback);
device_list.handle_command(cmd);
@@ -194,7 +195,7 @@ int htif_t::run()
device_list.tick();
if (!fromhost_queue.empty() && mem.read_uint64(fromhost_addr) == 0) {
- mem.write_uint64(fromhost_addr, fromhost_queue.front());
+ mem.write_uint64(fromhost_addr, to_le(fromhost_queue.front()));
fromhost_queue.pop();
}
}