From patchwork Tue Jun 19 20:42:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev\" via" X-Patchwork-Id: 10475433 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A235160230 for ; Tue, 19 Jun 2018 20:43:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94519287E8 for ; Tue, 19 Jun 2018 20:43:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8934C28877; Tue, 19 Jun 2018 20:43:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id C024F287E8 for ; Tue, 19 Jun 2018 20:43:43 +0000 (UTC) Received: from localhost ([::1]:44951 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVNTb-000341-36 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 19 Jun 2018 16:43:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVNSv-0002nP-8S for qemu-devel@nongnu.org; Tue, 19 Jun 2018 16:43:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVNSs-0003Su-2c for qemu-devel@nongnu.org; Tue, 19 Jun 2018 16:43:01 -0400 Received: from smtp62.i.mail.ru ([217.69.128.42]:33524) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fVNSr-0003RB-Ma for qemu-devel@nongnu.org; Tue, 19 Jun 2018 16:42:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Message-Id:Date:Subject:Cc:To:From; bh=YQaSsdVoZo4JyPCUuUxZxsRLtOd8ONzJHBWOVhVYSsg=; b=Shr4/8bFoqdmyuyFWnhrXKSBFALXiy+FdHGi5Eb6BnKMec5qw/UdpbMMFFVRCJdO2Id41i1uHRC/f4sJy5kmRQDrhSNxNp/1gWDBhCk0teJWCalvCko615vg/Ks2tyPRUkxUG9F0db9msezkTKcS25nZefzKm0wvYY7rrd4qoWE=; Received: by smtp62.i.mail.ru with esmtpa (envelope-from ) id 1fVNSp-0003TA-54; Tue, 19 Jun 2018 23:42:55 +0300 To: qemu-devel Date: Tue, 19 Jun 2018 23:42:37 +0300 Message-Id: <20180619204237.9931-1-jusual@mail.ru> X-Mailer: git-send-email 2.17.0 Authentication-Results: smtp62.i.mail.ru; auth=pass smtp.auth=jusual@mail.ru smtp.mailfrom=jusual@mail.ru X-7FA49CB5: 0D63561A33F958A5DE626CA71EE632E0BF29CFB9BB9A43EDC67AC315686ED4D30A6AB1C7CE11FEE3EB7D890E3377C531BA3038C0950A5D36B5C8C57E37DE458B4C7702A67D5C33162DBA43225CD8A89F0A35B161A8BF67C1DF8DB4D28FFA6F53754BDADB8594F4B043847C11F186F3C5E7DDDDC251EA7DABCC89B49CDF41148F458B267F216095A92623479134186CDE6BA297DBC24807EABDAD6C7F3747799A X-Mailru-Sender: 7766D515518070DE138AAC7428EA760DD8822C1D2024196340760EDE205B89F554FE240C5B5842527C4160E8B47E48163DDE9B364B0DF2898CB68AF7A628805D594FB4C9F0DBF412AE208404248635DF X-Mras: OK X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 217.69.128.42 Subject: [Qemu-devel] [PATCH] target/arm: Set strict alignment for ARMv6-M load/store 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: , X-Patchwork-Original-From: Julia Suvorova via Qemu-devel From: "Denis V. Lunev\" via" Reply-To: Julia Suvorova Cc: Peter Maydell , Jim Mussared , =?UTF-8?q?Steffen=20G=C3=B6rtz?= , Stefan Hajnoczi , Joel Stanley , Julia Suvorova Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Unlike ARMv7-M, ARMv6-M only supports naturally aligned memory accesses for 16-bit halfword and 32-bit word accesses using the LDR, LDRH, LDRSH, STR and STRH instructions. Signed-off-by: Julia Suvorova --- target/arm/translate.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index b988d379e7..d923cbe98e 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1100,7 +1100,14 @@ static inline TCGv gen_aa32_addr(DisasContext *s, TCGv_i32 a32, TCGMemOp op) static void gen_aa32_ld_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32, int index, TCGMemOp opc) { - TCGv addr = gen_aa32_addr(s, a32, opc); + TCGv addr; + + if (arm_dc_feature(s, ARM_FEATURE_M) && + !arm_dc_feature(s, ARM_FEATURE_V7)) { + opc |= MO_ALIGN; + } + + addr = gen_aa32_addr(s, a32, opc); tcg_gen_qemu_ld_i32(val, addr, index, opc); tcg_temp_free(addr); } @@ -1108,7 +1115,14 @@ static void gen_aa32_ld_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32, static void gen_aa32_st_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32, int index, TCGMemOp opc) { - TCGv addr = gen_aa32_addr(s, a32, opc); + TCGv addr; + + if (arm_dc_feature(s, ARM_FEATURE_M) && + !arm_dc_feature(s, ARM_FEATURE_V7)) { + opc |= MO_ALIGN; + } + + addr = gen_aa32_addr(s, a32, opc); tcg_gen_qemu_st_i32(val, addr, index, opc); tcg_temp_free(addr); }