From patchwork Wed Aug 28 19:04:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 172444 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1204897ily; Wed, 28 Aug 2019 12:37:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqyAF2iof7Uc+bj6KH/3oIhK9M/G6ygNBIpzv4/UhFN5I91X3sl401vLMCMI3io0u9aLgRGs X-Received: by 2002:ac8:4542:: with SMTP id z2mr6128810qtn.265.1567021058110; Wed, 28 Aug 2019 12:37:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567021058; cv=none; d=google.com; s=arc-20160816; b=pe7yoWZTKcCQz7+zhmHgPzA2tCKWqZk8HFHQLQ8UuxUp8Lqn0Wm8taaDnpdOl0GudF LTdl36e4PqEaCfPmpIkMVuCVWVYvo+gR2qYJ1TeumVe9giI75N7vNh5Wub7qjOJdYjO6 +YrFhAv7ainkwfIURUVn7Yia8neVyEMdF7HG87D1yYcRM+51GiYIoEuq38COGXpxvqfG cdTzfNETK/m88Ylk9B0Z3ZCF3d76JlUIFcxC4gXhEnAG/vc7u99Q4S26vnaww6U5z4J5 KHpmclpqAlKem9OB8PH8FiWAwvLRm4cmCLbo+jmQY/EXtTHSebbz0OIon7uqLS9PL4st 83gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=VWPLfRHZRw0RKor1YnAoLBlyaxXRqknq8DXuCG18/ZI=; b=XVI0QupWaVhOrtLO3wobL/gt5wSbxyFOhyx/JmL5ixLEnbr33cxSgbJQuvCAoqRtfS tTJNb8MqtoylCbXRBuCEPcXgWE7Bs6WQsfIvBaauB8rlbmNrxE9jdXL4XFRlbakBsvN2 ziyHrWPAEco65MYYhu/0g5xV2nL/GXqaAYXE6Sdw43bVyZceB2Ba6SVK7FiRXe6RWuCw 9xNKkLPnJstt8ptqTE8i/f+Ik3KJusssuXEKpMThN1/kFr1lEVLZA50KygfaKN4Ltmpe NKF48uLntkualggTebqdZEtgoXtGXcfVlDpJ1Nyr7qiXYYqhiglQGYLPKGLdAo8mH52s cX1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="Sj/JLM41"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o17si210492qkm.163.2019.08.28.12.37.38 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Aug 2019 12:37:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="Sj/JLM41"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i33lB-0000ds-75 for patch@linaro.org; Wed, 28 Aug 2019 15:37:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38144) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i33GP-0003kc-Lh for qemu-devel@nongnu.org; Wed, 28 Aug 2019 15:05:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i33GI-0000II-HG for qemu-devel@nongnu.org; Wed, 28 Aug 2019 15:05:47 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:36254) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i33GH-0000HX-SH for qemu-devel@nongnu.org; Wed, 28 Aug 2019 15:05:42 -0400 Received: by mail-pl1-x643.google.com with SMTP id f19so404613plr.3 for ; Wed, 28 Aug 2019 12:05:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VWPLfRHZRw0RKor1YnAoLBlyaxXRqknq8DXuCG18/ZI=; b=Sj/JLM41doP0b6Im247Oh2934+pcd7CxM6+x2kZ4gm0v5hATARvOeHHCraiycrJFil PFW9l82pDwBcbIe2MVIoonKZw4WF2aisrLAtUxHvpO8vcmyEYxP1zbLUOctTivDE85Ok 4PVJ9VU3DrVtYa4GHk05jOzNr3OrQQxWhWGM//rctDzKfnVo6RmN7GNO6gqrU6aUSmC9 5lE8QvXlJCx9y+jU9CJebiZjDTkNEjcIvado98W8wa1L/qHnHeypRcebUAL+y2lB2NzA RIgoqxpFZy5GzDeuJdzAKXqeLE3AeTEIHM6XPSma8+n5NreZ1WTIXaB5RTU6z8+iFy/o ssSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VWPLfRHZRw0RKor1YnAoLBlyaxXRqknq8DXuCG18/ZI=; b=aBBlq2q9+4tJxk9VbnoLQDyY4yP70c0tGpwD8Y0UwJ02F2zdWomrtTlyi0k9wcrmYg 8TxU/OhlJSCZRTsM0m+sZR7+6myIcUpcLj6o+MLJuMZlD0H7JQPXaIlZDHQzHYj1Ku+W ltK328/E/163t0C7yf5yibYeseUIAvUr5m07fUlrfBgeW3MmvlZTP5jgoyyygd5WyqRr RrivauE9cNVNj4H7OAq97lYFQHdQHBk3AEdMnzpstoNOFP7rZ/IUDz4RxK5A4YepWvIA sSsSvux0SaqHe2Q/i7audH0/I0jr2Qnw7Oo67EwLGJg8x1Yovx0lw/w6bU9MT/hIjXA9 xRAg== X-Gm-Message-State: APjAAAW0QNOBarsaQMtM60YoXzj+q/lBr8UaiV7SNrTdkUQtZFAVnq43 N6XC88jaGza3wB/D0QMtBPAn4B1FBHw= X-Received: by 2002:a17:902:7b97:: with SMTP id w23mr5838844pll.283.1567019140318; Wed, 28 Aug 2019 12:05:40 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id f27sm2967944pgm.60.2019.08.28.12.05.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2019 12:05:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 28 Aug 2019 12:04:18 -0700 Message-Id: <20190828190456.30315-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190828190456.30315-1-richard.henderson@linaro.org> References: <20190828190456.30315-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 Subject: [Qemu-devel] [PATCH v3 31/69] target/arm: Diagnose base == pc for LDM/STM X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We have been using store_reg and not store_reg_for_load when writing back a loaded value into the base register. At first glance this is incorrect when base == pc, however that case is UNPREDICTABLE. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/target/arm/translate.c b/target/arm/translate.c index bfc4508321..812ce5037f 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -9830,7 +9830,7 @@ static bool op_stm(DisasContext *s, arg_ldst_block *a, int min_n) list = a->list; n = ctpop16(list); - if (n < min_n) { + if (n < min_n || a->rn == 15) { unallocated_encoding(s); return true; } @@ -9910,7 +9910,7 @@ static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n) list = a->list; n = ctpop16(list); - if (n < min_n) { + if (n < min_n || a->rn == 15) { unallocated_encoding(s); return true; } @@ -9950,6 +9950,7 @@ static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n) op_addr_block_post(s, a, addr, n); if (loaded_base) { + /* Note that we reject base == pc above. */ store_reg(s, a->rn, loaded_var); }