aboutsummaryrefslogtreecommitdiff
path: root/riscv/sim.cc
diff options
context:
space:
mode:
authorMarcus Comstedt <marcus@mc.pp.se>2019-08-18 16:03:43 +0200
committerMarcus Comstedt <marcus@mc.pp.se>2019-10-28 09:23:32 +0100
commitf437e6a4e9983be0583ee1bf34512f80f3cc0162 (patch)
treef3ac0efc442019566f31aa5ba26c78915e80a0b6 /riscv/sim.cc
parent5652b9dd6298c7b61fe80bc2a508bbd3c9e5c5ef (diff)
downloadspike-f437e6a4e9983be0583ee1bf34512f80f3cc0162.zip
spike-f437e6a4e9983be0583ee1bf34512f80f3cc0162.tar.gz
spike-f437e6a4e9983be0583ee1bf34512f80f3cc0162.tar.bz2
Implement support for big-endian hosts
Diffstat (limited to 'riscv/sim.cc')
-rw-r--r--riscv/sim.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/riscv/sim.cc b/riscv/sim.cc
index cffc037..eca7057 100644
--- a/riscv/sim.cc
+++ b/riscv/sim.cc
@@ -4,6 +4,7 @@
#include "mmu.h"
#include "dts.h"
#include "remote_bitbang.h"
+#include "byteorder.h"
#include <map>
#include <iostream>
#include <sstream>
@@ -194,6 +195,8 @@ void sim_t::make_dtb()
(uint32_t) (start_pc & 0xffffffff),
(uint32_t) (start_pc >> 32)
};
+ for(int i = 0; i < reset_vec_size; i++)
+ reset_vec[i] = to_le(reset_vec[i]);
std::vector<char> rom((char*)reset_vec, (char*)reset_vec + sizeof(reset_vec));
@@ -234,7 +237,7 @@ void sim_t::idle()
void sim_t::read_chunk(addr_t taddr, size_t len, void* dst)
{
assert(len == 8);
- auto data = debug_mmu->load_uint64(taddr);
+ auto data = to_le(debug_mmu->load_uint64(taddr));
memcpy(dst, &data, sizeof data);
}
@@ -243,7 +246,7 @@ void sim_t::write_chunk(addr_t taddr, size_t len, const void* src)
assert(len == 8);
uint64_t data;
memcpy(&data, src, sizeof data);
- debug_mmu->store_uint64(taddr, data);
+ debug_mmu->store_uint64(taddr, from_le(data));
}
void sim_t::proc_reset(unsigned id)