See commit 852d481faf7 ("SH: Improve movca.l/ocbi emulation")
for more context on this code.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
 target/sh4/op_helper.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/target/sh4/op_helper.c b/target/sh4/op_helper.c
index 557b1bf4972..63515cc5e6c 100644
--- a/target/sh4/op_helper.c
+++ b/target/sh4/op_helper.c
@@ -143,7 +143,11 @@ void helper_ocbi(CPUSH4State *env, uint32_t address)
         if ((a & ~0x1F) == (address & ~0x1F))
         {
             memory_content *next = (*current)->next;
-            cpu_stl_data(env, a, (*current)->value);
+            if (TARGET_BIG_ENDIAN) {
+                cpu_stl_be_data(env, a, (*current)->value);
+            } else {
+                cpu_stl_le_data(env, a, (*current)->value);
+            }
 
             if (next == NULL)
             {
-- 
2.51.0


Reply via email to