From patchwork Wed Aug 28 04:39:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 270326 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DD87D2C00C5 for ; Wed, 28 Aug 2013 14:40:20 +1000 (EST) Received: from localhost ([::1]:60295 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEXYH-0007de-Dq for incoming@patchwork.ozlabs.org; Wed, 28 Aug 2013 00:40:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEXY1-0007cb-Rl for qemu-devel@nongnu.org; Wed, 28 Aug 2013 00:40:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VEXY0-0005Rr-Oz for qemu-devel@nongnu.org; Wed, 28 Aug 2013 00:40:01 -0400 Received: from [2a03:4000:2:362::1] (port=46711 helo=v2201305906712890.yourvserver.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEXY0-0005Rg-IP; Wed, 28 Aug 2013 00:40:00 -0400 Received: by v2201305906712890.yourvserver.net (Postfix, from userid 1000) id 4284B17FCC5; Wed, 28 Aug 2013 06:39:57 +0200 (CEST) From: Stefan Weil To: qemu-devel , qemu-trivial Date: Wed, 28 Aug 2013 06:39:56 +0200 Message-Id: <1377664796-11698-1-git-send-email-sw@weilnetz.de> X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a03:4000:2:362::1 Cc: Peter Maydell , Paul Brook , Stefan Weil Subject: [Qemu-devel] [PATCH] target-arm: Report unimplemented opcodes (LOG_UNIMP) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org These unimplemented opcodes are handled like illegal opcodes, but they are used in existing code. We should at least report when they are executed. Signed-off-by: Stefan Weil Reviewed-by: Peter Maydell --- When running a QEMU system emulation of an ARM system (Raspberry PI), Linux booted, but when I tried to run a user session, it terminated without error message. It took me some time to see that bash got an illegal instruction exception. It was caused by ARM opcode 'setend' which is not implemented in QEMU's ARM emulation. The patch should help detecting similar scenarios in the future. Raspberry PI uses 'setend' in an optimized version of memcmp, so lots of other executables also fail with QEMU. As a workaround, the preloading of that optimized code can be removed. Of course an improved QEMU emulation would be better. Regards, Stefan target-arm/translate.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target-arm/translate.c b/target-arm/translate.c index d1e8538..92d9f16 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -6715,6 +6715,7 @@ static void disas_arm_insn(CPUARMState * env, DisasContext *s) /* setend */ if (((insn >> 9) & 1) != s->bswap_code) { /* Dynamic endianness switching not implemented. */ + qemu_log_mask(LOG_UNIMP, "arm: unimplemented setend\n"); goto illegal_op; } return; @@ -8740,6 +8741,8 @@ static int disas_thumb2_insn(CPUARMState *env, DisasContext *s, uint16_t insn_hw if (insn & (1 << 26)) { /* Secure monitor call (v6Z) */ + qemu_log_mask(LOG_UNIMP, + "arm: unimplemented secure monitor call\n"); goto illegal_op; /* not implemented. */ } else { op = (insn >> 20) & 7; @@ -9779,6 +9782,7 @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s) ARCH(6); if (((insn >> 3) & 1) != s->bswap_code) { /* Dynamic endianness switching not implemented. */ + qemu_log_mask(LOG_UNIMP, "arm: unimplemented setend\n"); goto illegal_op; } break;