summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2006-04-28 13:13:58 -0400
committerGabe Black <gblack@eecs.umich.edu>2006-04-28 13:13:58 -0400
commit7a9c65b7b6f4471c856bf009179c3231074a3930 (patch)
tree14c28b5ad4428d30b27f4014ab2a77fd89916ade
parent9eaedf314b5166ef52e7dd4be81b8a3c40276025 (diff)
downloadgem5-7a9c65b7b6f4471c856bf009179c3231074a3930.tar.xz
Added byteswapping code
--HG-- extra : convert_revision : 67bf0689399328a728a0f3130d58d483e5f2f06e
-rw-r--r--cpu/simple/cpu.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/cpu/simple/cpu.cc b/cpu/simple/cpu.cc
index 0f1f9574a..1a737fa6a 100644
--- a/cpu/simple/cpu.cc
+++ b/cpu/simple/cpu.cc
@@ -475,6 +475,7 @@ SimpleCPU::read(Addr addr, T &data, unsigned flags)
// Not sure what to check for no fault...
if (data_read_pkt->result == Success) {
memcpy(&data, data_read_pkt->data, sizeof(T));
+ data = gtoh(data);
}
if (traceData) {
@@ -518,6 +519,7 @@ SimpleCPU::read(Addr addr, T &data, unsigned flags)
if (data_read_pkt->result == Success) {
memcpy(&data, data_read_pkt->data, sizeof(T));
+ data = gtoh(data);
}
if (traceData) {
@@ -622,9 +624,11 @@ SimpleCPU::write(T data, Addr addr, unsigned flags, uint64_t *res)
data_write_pkt->cmd = Write;
data_write_pkt->req = data_write_req;
data_write_pkt->data = new uint8_t[64];
- memcpy(data_write_pkt->data, &data, sizeof(T));
+ T hostData = htog(data);
+ memcpy(data_write_pkt->data, &hostData, sizeof(T));
#else
data_write_pkt->reset();
+ data = htog(data);
data_write_pkt->data = (uint8_t *)&data;
#endif
data_write_pkt->addr = data_write_req->getPaddr();