[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/13] tcg-sparc: Mask shift immediates to avoid ill
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH 09/13] tcg-sparc: Mask shift immediates to avoid illegal insns. |
Date: |
Mon, 17 Sep 2012 08:28:48 -0700 |
The xtensa-test image generates a sra_i32 with count 0x40.
Whether this is accident of tcg constant propagation or
originating directly from the instruction stream is immaterial.
Signed-off-by: Richard Henderson <address@hidden>
---
tcg/sparc/tcg-target.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/tcg/sparc/tcg-target.c b/tcg/sparc/tcg-target.c
index e625aa3..be5c170 100644
--- a/tcg/sparc/tcg-target.c
+++ b/tcg/sparc/tcg-target.c
@@ -1154,13 +1154,16 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode
opc, const TCGArg *args,
goto gen_arith;
case INDEX_op_shl_i32:
c = SHIFT_SLL;
- goto gen_arith;
+ do_shift32:
+ /* Limit immediate shift count lest we create an illegal insn. */
+ tcg_out_arithc(s, args[0], args[1], args[2] & 31, const_args[2], c);
+ break;
case INDEX_op_shr_i32:
c = SHIFT_SRL;
- goto gen_arith;
+ goto do_shift32;
case INDEX_op_sar_i32:
c = SHIFT_SRA;
- goto gen_arith;
+ goto do_shift32;
case INDEX_op_mul_i32:
c = ARITH_UMUL;
goto gen_arith;
@@ -1281,13 +1284,16 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode
opc, const TCGArg *args,
break;
case INDEX_op_shl_i64:
c = SHIFT_SLLX;
- goto gen_arith;
+ do_shift64:
+ /* Limit immediate shift count lest we create an illegal insn. */
+ tcg_out_arithc(s, args[0], args[1], args[2] & 63, const_args[2], c);
+ break;
case INDEX_op_shr_i64:
c = SHIFT_SRLX;
- goto gen_arith;
+ goto do_shift64;
case INDEX_op_sar_i64:
c = SHIFT_SRAX;
- goto gen_arith;
+ goto do_shift64;
case INDEX_op_mul_i64:
c = ARITH_MULX;
goto gen_arith;
--
1.7.11.4
- Re: [Qemu-devel] [PATCH 01/13] linux-user: Use memcpy in get_user/put_user., (continued)
- Re: [Qemu-devel] [PATCH 01/13] linux-user: Use memcpy in get_user/put_user., Richard Henderson, 2012/09/17
- Re: [Qemu-devel] [PATCH 01/13] linux-user: Use memcpy in get_user/put_user., Peter Maydell, 2012/09/17
- [Qemu-devel] [PATCH 02/13] tcg-sparc: Hack in qemu_ld/st64 for 32-bit., Richard Henderson, 2012/09/17
- [Qemu-devel] [PATCH 06/13] tcg-sparc: Support GUEST_BASE., Richard Henderson, 2012/09/17
- [Qemu-devel] [PATCH 03/13] tcg-sparc: Fix ADDX opcode., Richard Henderson, 2012/09/17
- [Qemu-devel] [PATCH 04/13] tcg-sparc: Assume v9 cpu always, i.e. force v8plus in 32-bit mode., Richard Henderson, 2012/09/17
- Re: [Qemu-devel] [PATCH 04/13] tcg-sparc: Assume v9 cpu always, i.e. force v8plus in 32-bit mode., Andreas Färber, 2012/09/17
- Re: [Qemu-devel] [PATCH 04/13] tcg-sparc: Assume v9 cpu always, i.e. force v8plus in 32-bit mode., Richard Henderson, 2012/09/17
- Re: [Qemu-devel] [PATCH 04/13] tcg-sparc: Assume v9 cpu always, i.e. force v8plus in 32-bit mode., Blue Swirl, 2012/09/17
- Re: [Qemu-devel] [PATCH 04/13] tcg-sparc: Assume v9 cpu always, i.e. force v8plus in 32-bit mode., Richard Henderson, 2012/09/17
- [Qemu-devel] [PATCH 09/13] tcg-sparc: Mask shift immediates to avoid illegal insns.,
Richard Henderson <=
- [Qemu-devel] [PATCH 05/13] tcg-sparc: Fix qemu_ld/st to handle 32-bit host., Richard Henderson, 2012/09/17
- [Qemu-devel] [PATCH 08/13] tcg-sparc: Clean up cruft stemming from attempts to use global registers., Richard Henderson, 2012/09/17
- [Qemu-devel] [PATCH 12/13] tcg-sparc: Fix and enable direct TB chaining., Richard Henderson, 2012/09/17
- [Qemu-devel] [PATCH 13/13] tcg: Fix !USE_DIRECT_JUMP, Richard Henderson, 2012/09/17
- Re: [Qemu-devel] [PATCH 13/13] tcg: Fix !USE_DIRECT_JUMP, Andreas Färber, 2012/09/17
- Re: [Qemu-devel] [PATCH 13/13] tcg: Fix !USE_DIRECT_JUMP, Stefan Weil, 2012/09/21
- Re: [Qemu-devel] [PATCH 13/13] tcg: Fix !USE_DIRECT_JUMP, Aurelien Jarno, 2012/09/21
- Re: [Qemu-devel] [PATCH 13/13] tcg: Fix !USE_DIRECT_JUMP, Aurelien Jarno, 2012/09/21
- [Qemu-devel] [PATCH 07/13] tcg-sparc: Change AREG0 in generated code to %i0., Richard Henderson, 2012/09/17
- [Qemu-devel] [PATCH 10/13] tcg-sparc: Use defines for temporaries., Richard Henderson, 2012/09/17