cputlb: use uint64_t for interim values for unaligned load
RFC PATCH 1/1 cputlb: use uint64_t for interim values for unaligned load
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.
Hopefully fixes #1830872
--- accel/tcg/cputlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
accel/tcg/cputlb.c +1 -1
@@ -1303,7 +1303,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 );
Signature · 1 line
2.20.1
В сообщении от Monday 03 June 2019 18:01:20 Alex Bennée написал(а):
Quoted 17 lines
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_tto avoid any premature truncation so we should use the same for the interim types.Hopefully fixes #1830872
Signed-off-by Alex Bennée <[email protected]>--- accel/tcg/cputlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)accel/tcg/cputlb.c +0
-0
accel/tcg/cputlb.c load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi, · line 1309
Quoted 8 lines
accel/tcg/cputlb.c +1
-1@@ -1303,7 +1303,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 );
Unfortunatly, this doesn't fix 32-bit qemu-system-x86_64 .... so, my bug is separate from #1830872 ?
I also was unable to convince qemu to use my kernel-only x86_64 gcc 6.5.0 cross-compiler .. probably x86-64 testing on i686 requires either docker (I don't have this
) or 'real' cross-compiler (build with glibc support).
Quoted 13 lines · Andrew Randrianasulu
В сообщении от Monday 03 June 2019 18:01:20 Alex Bennée написал(а):
Quoted 12 lines
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_tto avoid any premature truncation so we should use the same for the interim types.Hopefully fixes #1830872
Signed-off-by Alex Bennée <[email protected]>--- accel/tcg/cputlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
accel/tcg/cputlb.c load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi, · line 1309
Quoted 13 lines
accel/tcg/cputlb.c +1
-1@@ -1303,7 +1303,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 );Unfortunatly, this doesn't fix 32-bit qemu-system-x86_64 .... so, my bug is separate from #1830872 ?
I think you've hit two - one of which we have just fixed. With my expanded memory test on i386 I'm seeing a hang but it's ok @ pull-demacro-softmmu-100519-1. Unfortunately bisecting through the slirp move and other i386 Werror stuff is proving painful.
Quoted 4 lines
I also was unable to convince qemu to use my kernel-only
x86_64gcc 6.5.0 cross-compiler .. probably x86-64 testing on i686 requires either docker (I don't have this
) or 'real' cross-compiler (build with glibc support).
--
Alex Bennée
(+Igor)
Quoted 18 lines · Alex Bennée
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_tto avoid any premature truncation so we should use the same for the interim types.Hopefully fixes #1830872
Signed-off-by Alex Bennée <[email protected]>--- accel/tcg/cputlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)accel/tcg/cputlb.c +0
-0
accel/tcg/cputlb.c load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi, · line 1309
Quoted 8 lines
accel/tcg/cputlb.c +1
-1@@ -1303,7 +1303,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 );
Applied on top of commit ad88e4252f09c2956b99c90de39e95bab2e8e7af:
Thanks!
Laszlo
Quoted 11 lines · Alex Bennée
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_tto avoid any premature truncation so we should use the same for the interim types.Hopefully fixes #1830872
Signed-off-by Alex Bennée <[email protected]>--- accel/tcg/cputlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
Quoted 6 lines · Alex Bennée
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_tto avoid any premature truncation so we should use the same for the interim types.Hopefully fixes #1830872
Maybe clearer as:
Quoted 12 lines
Signed-off-by Alex Bennée <[email protected]>--- accel/tcg/cputlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)accel/tcg/cputlb.c +0
-0
accel/tcg/cputlb.c load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi, · line 1309
Quoted 8 lines
accel/tcg/cputlb.c +1
-1@@ -1303,7 +1303,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 );
Quoted 8 lines · On Mon, 3 Jun 2019 16:01:20 +0100 Alex Bennée <[email protected]> wrote:
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_tto avoid any premature truncation so we should use the same for the interim types.Hopefully fixes #1830872
Signed-off-by Alex Bennée <[email protected]>
Fixes arm/virt bios-tables-test for me, so
Quoted 17 lines
--- accel/tcg/cputlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)accel/tcg/cputlb.c +1
-1@@ -1303,7 +1303,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 );