Received: from [140.186.70.92] (port=54453 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q9J0i-0004L8-3d for qemu-devel@nongnu.org; Mon, 11 Apr 2011 11:26:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q9J0e-0007i2-Ok for qemu-devel@nongnu.org; Mon, 11 Apr 2011 11:26:37 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]:38275) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9J0e-0007bo-F2 for qemu-devel@nongnu.org; Mon, 11 Apr 2011 11:26:36 -0400 From: Peter Maydell Date: Mon, 11 Apr 2011 16:26:22 +0100 Message-Id: <1302535583-15733-13-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1302535583-15733-1-git-send-email-peter.maydell@linaro.org> References: <1302535583-15733-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 12/13] target-arm: Treat UNPREDICTABLE VTBL, VTBX case as UNDEF List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: patches@linaro.org Catch the UNPREDICTABLE case for Neon VTBL,VTBX, and UNDEF it rather than allowing the helper function to index off the end of the register file. Signed-off-by: Peter Maydell --- target-arm/translate.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/target-arm/translate.c b/target-arm/translate.c index b647c7b..be25c8f 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -6023,7 +6023,14 @@ static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn) } } else if ((insn & (1 << 10)) == 0) { /* VTBL, VTBX. */ - int n = ((insn >> 5) & 0x18) + 8; + int n = ((insn >> 8) & 3) + 1; + if ((rn + n) > 32) { + /* This is UNPREDICTABLE; we choose to UNDEF to avoid the + * helper function running off the end of the register file. + */ + return 1; + } + n <<= 3; if (insn & (1 << 6)) { tmp = neon_load_reg(rd, 0); } else { -- 1.7.1