tcg: fix deposit_i64 op on 32-bit targets
PATCH 1/1 tcg: fix deposit_i64 op on 32-bit targets
On 32-bit TCG targets, when emulating deposit_i64 with a mov_i32 + deposit_i32, care should be taken to not overwrite the low part of the second argument before the deposit when it is the same the destination.
This fixes the shld instruction in qemu-system-x86_64, which in turns fixes booting "system rescue CD version 2.8.0" on this target.
Reported-by Michael S. Tsirkin <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Paolo Bonzini <[email protected]>
Signed-off-by Aurelien Jarno <[email protected]>
--- tcg/tcg-op.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tcg/tcg-op.h +1 -1
@@ -2188,9 +2188,9 @@ static inline void tcg_gen_deposit_i64(TCGv_i64 ret, TCGv_i64 arg1,#if TCG_TARGET_REG_BITS ==32 if (ofs >=32 ) { -tcg_gen_mov_i32 (TCGV_LOW (ret),TCGV_LOW (arg1));tcg_gen_deposit_i32 (TCGV_HIGH (ret),TCGV_HIGH (arg1),TCGV_LOW (arg2), ofs -32 , len); +tcg_gen_mov_i32 (TCGV_LOW (ret),TCGV_LOW (arg1));return ; }if (ofs + len <=32 ) {
Signature · 1 line
1.7.10.4
Quoted 5 lines · Aurelien Jarno
On 32-bit TCG targets, when emulating
deposit_i64with amov_i32+deposit_i32, care should be taken to not overwrite the low part of the second argument before the deposit when it is the same the destination.
Quoted 7 lines
This fixes the shld instruction in qemu-system-x86_64, which in turns fixes booting "system rescue CD version 2.8.0" on this target.
Reported-by Michael S. Tsirkin<[email protected]>Cc Richard Henderson<[email protected]>Cc Paolo Bonzini<[email protected]>Signed-off-by Aurelien Jarno<[email protected]>
Nice catch.
Reviewed-by Richard Henderson <[email protected]>
r~