On 6/9/21 7:10 AM, Philippe Mathieu-Daudé wrote:
+    oi = make_memop_idx(MO_UB, mmu_idx);
+    if (memop_big_endian(op)) {
+        for (i = 0; i < size; ++i) {
+            /* Big-endian load.  */
+            uint8_t val8 = helper_ret_ldub_mmu(env, addr + i, oi, retaddr);
+            val |= val8 << (((size - 1) * 8) - (i * 8));
+        }
+    } else {
+        for (i = 0; i < size; ++i) {
+            /* Little-endian load.  */
+            uint8_t val8 = helper_ret_ldub_mmu(env, addr + i, oi, retaddr);
+            val |= val8 << (i * 8);
+        }
+    }

This doesn't quite work. You can't just call helper_ret_ldub_mmu, as the other option is full_ldub_code. So, at present you've broken unaligned code loads.

We also need noinline markup for clang, like we do for helper_ret_stb_mmu. I've no proof of that, but it certainly makes sense to record how we expect the inline loop to be resolved.

Finally, you have to use uint64_t for val8, otherwise the shift fails for size == 8.

I'll fix these up and see how things go.


r~

Reply via email to