]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
cputlb: use uint64_t for interim values for unaligned load
authorAlex Bennée <alex.bennee@linaro.org>
Mon, 3 Jun 2019 14:56:32 +0000 (15:56 +0100)
committerAlex Bennée <alex.bennee@linaro.org>
Wed, 12 Jun 2019 16:53:22 +0000 (17:53 +0100)
When running on 32 bit TCG backends a wide unaligned load ends up
truncating data before returning to the guest. We specifically have
the return type as uint64_t to avoid any premature truncation so we
should use the same for the interim types.

Fixes: https://bugs.launchpad.net/qemu/+bug/1830872
Fixes: eed5664238e
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
accel/tcg/cputlb.c

index baa3eb8f92ad6a58ea468cf7bb9a3d6aa4fdeea8..8d6891931e8f378fe9646423120a46b24568acb7 100644 (file)
@@ -1315,7 +1315,7 @@ load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi,
         && unlikely((addr & ~TARGET_PAGE_MASK) + size - 1
                     >= TARGET_PAGE_SIZE)) {
         target_ulong addr1, addr2;
-        tcg_target_ulong r1, r2;
+        uint64_t r1, r2;
         unsigned shift;
     do_unaligned_access:
         addr1 = addr & ~(size - 1);