tools/pci: Replace memcpy on pci write with aligned copy
memcpy() does unaligned access. Using it for device memory causes
exception (SIGBUS).
Replace the memcpy in PciAccessBridge::write with aligned copy.
Signed-off-by: Vivekanand Veeracholan <vveerach@google.com>
Change-Id: I8e573715dc8971be547d882ce3cb6de31b2620e4
diff --git a/tools/pci.cpp b/tools/pci.cpp
index 224a619..150095f 100644
--- a/tools/pci.cpp
+++ b/tools/pci.cpp
@@ -23,6 +23,8 @@
#include <pciaccess.h>
} // extern "C"
+#include "helper.hpp"
+
#include <fmt/format.h>
#include <stdplus/handle/managed.hpp>
@@ -111,7 +113,7 @@
dataLength));
}
- std::memcpy(addr + dataOffset, data.data(), data.size());
+ memcpyAligned(addr + dataOffset, data.data(), data.size());
}
void NuvotonPciBridge::enableBridge()