qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH v2 2/2] cputlb: implement load_helper_unaligned() for una


From: Richard Henderson
Subject: Re: [RFC PATCH v2 2/2] cputlb: implement load_helper_unaligned() for unaligned loads
Date: Thu, 10 Jun 2021 14:41:28 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

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

[Prev in Thread] Current Thread [Next in Thread]