From patchwork Tue Apr 19 18:07:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Sorokin X-Patchwork-Id: 8882531 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B840BBF29F for ; Tue, 19 Apr 2016 18:08:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 47EC0202A1 for ; Tue, 19 Apr 2016 18:08:28 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4775920115 for ; Tue, 19 Apr 2016 18:08:27 +0000 (UTC) Received: from localhost ([::1]:34225 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asa4Y-0001Xg-B3 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 19 Apr 2016 14:08:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asa4O-0001TK-Dh for qemu-devel@nongnu.org; Tue, 19 Apr 2016 14:08:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1asa4N-00010d-Gz for qemu-devel@nongnu.org; Tue, 19 Apr 2016 14:08:16 -0400 Received: from forward12j.cmail.yandex.net ([5.255.227.176]:51299) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asa4J-000101-75; Tue, 19 Apr 2016 14:08:11 -0400 Received: from smtp12.mail.yandex.net (smtp12.mail.yandex.net [IPv6:2a02:6b8:0:801:1::11]) by forward12j.cmail.yandex.net (Yandex) with ESMTP id AB62421861; Tue, 19 Apr 2016 21:08:08 +0300 (MSK) Received: from smtp12.mail.yandex.net (localhost [127.0.0.1]) by smtp12.mail.yandex.net (Yandex) with ESMTP id 3213B16A15E5; Tue, 19 Apr 2016 21:08:08 +0300 (MSK) Received: by smtp12.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id WNad2B8dFm-87BOwP3O; Tue, 19 Apr 2016 21:08:08 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1461089288; bh=gnRBjunzM5ZMpmmH6MDg9ts91RNNShT26yuj36L7elA=; h=From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To: References; b=Rft6K+JYTn6ck7MGVRSFu4KuasoeFxb9aA9i4jbtjUas9pgApPj9A0rt4ijRUcots ZMqoupiBlEMmA3jh61uONA13ffGdY0H6Fxq4Fwq1+Ob86jbMvKHM3qedl+7eq39G79 xydwMnmZp9hI8DaxuMME0vxzOc424EYRT69A3MMw= Authentication-Results: smtp12.mail.yandex.net; dkim=pass header.i=@yandex.ru X-Yandex-ForeignMX: US X-Yandex-Suid-Status: 1 0,1 0,1 0,1 37377968 From: Sergey Sorokin To: qemu-devel@nongnu.org Date: Tue, 19 Apr 2016 21:07:18 +0300 Message-Id: <1461089238-18314-3-git-send-email-afarallax@yandex.ru> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1461089238-18314-1-git-send-email-afarallax@yandex.ru> References: <1461089238-18314-1-git-send-email-afarallax@yandex.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 5.255.227.176 Subject: [Qemu-devel] [PATCH 2/2] target-arm: Fix an exception return on AArch32 instruction ADDS X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, Sergey Sorokin Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In AArch32 instruction ADDS r15, ... is used for exception return. Signed-off-by: Sergey Sorokin --- target-arm/translate.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/target-arm/translate.c b/target-arm/translate.c index 68671b7..3e64ba9 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -8512,12 +8512,21 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) store_reg_bx(s, rd, tmp); break; case 0x04: - if (set_cc) { + if (set_cc && rd == 15) { + /* ADDS r15, ... is used for exception return. */ + if (IS_USER(s)) { + goto illegal_op; + } gen_add_CC(tmp, tmp, tmp2); + gen_exception_return(s, tmp); } else { - tcg_gen_add_i32(tmp, tmp, tmp2); + if (set_cc) { + gen_add_CC(tmp, tmp, tmp2); + } else { + tcg_gen_add_i32(tmp, tmp, tmp2); + } + store_reg_bx(s, rd, tmp); } - store_reg_bx(s, rd, tmp); break; case 0x05: if (set_cc) {