From 65648669c15343cb1aa6b102cf2eae0ed91024cd Mon Sep 17 00:00:00 2001 From: Marcus Comstedt Date: Sun, 18 Aug 2019 16:03:43 +0200 Subject: Implement support for big-endian hosts Signed-off-by: Chih-Min Chao --- fesvr/htif.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'fesvr/htif.cc') 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 #include #include @@ -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(); } } -- cgit v1.1