From bc2714ab2a9a505646e726304e7d8353e7597198 Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Thu, 15 Feb 2024 15:35:17 +0100 Subject: [PATCH] platinum: handle non-DWORD register accesses. --- devices/memctrl/platinum.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/devices/memctrl/platinum.cpp b/devices/memctrl/platinum.cpp index 8cc85d4..962c544 100644 --- a/devices/memctrl/platinum.cpp +++ b/devices/memctrl/platinum.cpp @@ -113,11 +113,10 @@ uint32_t PlatinumCtrl::read(uint32_t rgn_start, uint32_t offset, int size) { } } - if (size != 4) { - LOG_F(WARNING, "%s: unsupported register access size %d!", this->name.c_str(), - size); + // non-DWORD accesses will produce undefined results according with the ERS + // I believe we can safely return 0 in this case + if (size != 4) return 0; - } switch (offset) { case PlatinumReg::CPU_ID: @@ -169,6 +168,12 @@ void PlatinumCtrl::write(uint32_t rgn_start, uint32_t offset, uint32_t value, in return; } + if (size != 4) { + LOG_F(WARNING, "%s: non-DWORD write access, size %d!", this->name.c_str(), + size); + return; + } + switch (offset) { case PlatinumReg::ROM_TIMING: this->rom_timing = value;