From 2285427a4c949d4739ef2db38b2c4830c0dc5aa6 Mon Sep 17 00:00:00 2001 From: Lars Rademacher Date: Mon, 25 Nov 2013 22:40:05 +0100 Subject: [PATCH] panda: invalidate cache by default When writing to memory, related cache-lines should by default be invalidated. Change-Id: I5477fa86c75d512f483a5b61f147666d3d845ea2 --- src/core/sal/panda/PandaMemory.hpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/core/sal/panda/PandaMemory.hpp b/src/core/sal/panda/PandaMemory.hpp index 51542b03..f0c80603 100644 --- a/src/core/sal/panda/PandaMemory.hpp +++ b/src/core/sal/panda/PandaMemory.hpp @@ -88,7 +88,7 @@ public: */ void setByte(guest_address_t addr, byte_t data) { - oocdw_write_to_memory(addr, 1, 1, &data, false); + oocdw_write_to_memory(addr, 1, 1, &data, true); } /** @@ -101,11 +101,18 @@ public: */ void setBytes(guest_address_t addr, size_t cnt, void const *src) { - // ToDo (PORT): This works, but may be slower than writing a whole block uint8_t const *s = static_cast(src); - // ToDo: Check Endianess? - oocdw_write_to_memory(addr, 1, cnt, s, false); + // Write in 4-Byte chunks + + // ToDo: Correct byte ordering? + if (cnt >= 4) { + oocdw_write_to_memory(addr, 4, cnt / 4, s, true); + } + + if ((cnt % 4) != 0) { + oocdw_write_to_memory(addr + (cnt/4) * 4, 1, cnt % 4, s, true); + } } };