From patchwork Wed Sep 4 19:30:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 173008 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp393448ilq; Wed, 4 Sep 2019 13:16:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUafZU45bV6ninnNxgeMvfaMCzBh0dw6tV0AQb388RwerYY15BcYOAyrE4MVpsT71xw9Gx X-Received: by 2002:a17:906:a416:: with SMTP id l22mr29911998ejz.302.1567628202972; Wed, 04 Sep 2019 13:16:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567628202; cv=none; d=google.com; s=arc-20160816; b=ZNIqGBP48WMON/dZYkvO3nbR+2lgWg7X8eGafM6ldYrcnE2Z0cqy5a+OWlugdXXcUe raJf5yewdADRsmW97aeUyaVRWe/xuxJySqEGzN3CRTnrtFR8vGM8GZ1EAHQTrgKuv3Vv 9wpIFSSy+K2KA63k5Zry7ihdEVZFJj/BC5E7CloNNpqzq0wbw8iH/0m1eWmPHJIi2Svo +JmtUnQB7CwNpscrQy2UDspYVKkccOPk1ysGZ2yjRdmidViDxpEZ8oe4UwvD9NZbe4Rj KVg3lQZVa8h0uellltPXmL9tpnhcHSneu6Zvru/0a031GbID43rpOJeB9MnfzfZo6ESG YOfQ== 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=bRqYq2TLJ+WIjlJfH/2hIAtxOVh3ChiZfI3nAvVSmQE=; b=HK47fb0vv7retiI0U+iRC02d6pqsv6zZMMrIfsW+/GmaUJap8iKO3YUFW5qtwu6r8N e1G56qhmZj7PgcXsw3BcvqTIQyUTQ/2pEout6te7E82Om3vIHjKreI6V1y3IU+AtJfCy gEIWXlL4JJD1zgxdZgkD/v5spUveKm7502uWqSKZtmEid7VwhfhFN7viOidpGcsAALng bnboVLp6H/P1yqH9Xan8cKYPhNE233KKfFJk13OoQkGOE3NGVLGMVB2vOwC3nOdSZNTI XbwXEgPbBPFvDApceGyatHdWQM4ujZ42qMqb4XVyorvv25m8SDIVBIS1YyxFGuGIX0He TaSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="iRb1/wXK"; 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 y47si11251403edd.236.2019.09.04.13.16.42 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Sep 2019 13:16:42 -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="iRb1/wXK"; 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]:38560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5bhp-0001DZ-3c for patch@linaro.org; Wed, 04 Sep 2019 16:16:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40820) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5b0Y-0005De-38 for qemu-devel@nongnu.org; Wed, 04 Sep 2019 15:31:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5b0V-0002p0-Fu for qemu-devel@nongnu.org; Wed, 04 Sep 2019 15:31:57 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:36838) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5b0V-0002oD-6x for qemu-devel@nongnu.org; Wed, 04 Sep 2019 15:31:55 -0400 Received: by mail-pf1-x444.google.com with SMTP id y22so8278172pfr.3 for ; Wed, 04 Sep 2019 12:31:55 -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=bRqYq2TLJ+WIjlJfH/2hIAtxOVh3ChiZfI3nAvVSmQE=; b=iRb1/wXKxZU+WH6cNoOPPE5ajNFKlx1uJ2+hVuPfjqFHjBEk0jz1T+w9rM4cyydPB5 EgEVrmaGhx078DRYd78x9KDvO53i2785IeiT4DzWbP6t8gekmX2VPMGOY2/uK54d+WDg J7fUy/pmqBIlYfcuY3MH1HMHKSXYM9T1oHezV8zmvNZ/DCbBf+2DVe7zUYrjjlaNQuHG aooOtLGhp+zPkr4f3LsQVjKO2BOZlZ5K93OWB/seJNuKHBai4eZMTMZjRNIIwpegdwDI U/hNvDa+VSo1a2OtZIebBWTAfjZp9sq18l1iXQe03OFMyyjBqIpJFnYDVdPp8yO3nAcX jEKQ== 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=bRqYq2TLJ+WIjlJfH/2hIAtxOVh3ChiZfI3nAvVSmQE=; b=IXKT9TsvWbrE3SNIXrEJY3HBFTv++5aTblOhm+2tHAj9UwVg8P8YC1qA0r9jj8xFr2 VzWJa4piM5FKRmDQ1QVTHa1cutjjb5XQcwFSgyBnkRf0LCZA9QoxO77snm5Uxmc7cLio /a2KbLW9j62US67avM+PmNkog2AwJyivQtM5cWjhbFvj82oHdUH8l6CI2Zvylq1eeDbi 8C8WAZ7La3vHGbK00lA4/SAGhZaHTF+OD6AzzxZ9nlyQ9h6Y+VoRbbAbOVL6qSY/MtMq 4PouwrPfipxiguBpPJpptXt/nTF0+9FPsf6wCIW63awhRw8ALjEN68gEsq0gtBFWORgb JUVQ== X-Gm-Message-State: APjAAAXPdW7NSCjwIwlAWMmwUe6vf74u5VwkPgVpNhxGd/Fc5+jVFfE5 D18opc3P76V86ZQ8Hd4TCB+Gw8RH/ng= X-Received: by 2002:a63:1b66:: with SMTP id b38mr36618239pgm.54.1567625513742; Wed, 04 Sep 2019 12:31:53 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id f6sm18999174pga.50.2019.09.04.12.31.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 12:31:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 12:30:31 -0700 Message-Id: <20190904193059.26202-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190904193059.26202-1-richard.henderson@linaro.org> References: <20190904193059.26202-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::444 Subject: [Qemu-devel] [PATCH v4 41/69] target/arm: Convert SG 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" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate.c | 51 ++++++++++++++++++++++++------------------ target/arm/t32.decode | 5 ++++- 2 files changed, 33 insertions(+), 23 deletions(-) -- 2.17.1 diff --git a/target/arm/translate.c b/target/arm/translate.c index 96149eabf4..af7eddca48 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -8467,6 +8467,34 @@ static bool trans_SMC(DisasContext *s, arg_SMC *a) return true; } +static bool trans_SG(DisasContext *s, arg_SG *a) +{ + if (!arm_dc_feature(s, ARM_FEATURE_M) || + !arm_dc_feature(s, ARM_FEATURE_V8)) { + return false; + } + /* + * SG (v8M only) + * The bulk of the behaviour for this instruction is implemented + * in v7m_handle_execute_nsc(), which deals with the insn when + * it is executed by a CPU in non-secure state from memory + * which is Secure & NonSecure-Callable. + * Here we only need to handle the remaining cases: + * * in NS memory (including the "security extension not + * implemented" case) : NOP + * * in S memory but CPU already secure (clear IT bits) + * We know that the attribute for the memory this insn is + * in must match the current CPU state, because otherwise + * get_phys_addr_pmsav8 would have generated an exception. + */ + if (s->v8m_secure) { + /* Like the IT insn, we don't need to generate any code */ + s->condexec_cond = 0; + s->condexec_mask = 0; + } + return true; +} + /* * Load/store register index */ @@ -10553,28 +10581,7 @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) * - load/store doubleword, load/store exclusive, ldacq/strel, * table branch, TT. */ - if (insn == 0xe97fe97f && arm_dc_feature(s, ARM_FEATURE_M) && - arm_dc_feature(s, ARM_FEATURE_V8)) { - /* 0b1110_1001_0111_1111_1110_1001_0111_111 - * - SG (v8M only) - * The bulk of the behaviour for this instruction is implemented - * in v7m_handle_execute_nsc(), which deals with the insn when - * it is executed by a CPU in non-secure state from memory - * which is Secure & NonSecure-Callable. - * Here we only need to handle the remaining cases: - * * in NS memory (including the "security extension not - * implemented" case) : NOP - * * in S memory but CPU already secure (clear IT bits) - * We know that the attribute for the memory this insn is - * in must match the current CPU state, because otherwise - * get_phys_addr_pmsav8 would have generated an exception. - */ - if (s->v8m_secure) { - /* Like the IT insn, we don't need to generate any code */ - s->condexec_cond = 0; - s->condexec_mask = 0; - } - } else if (insn & 0x01200000) { + if (insn & 0x01200000) { /* load/store dual, in decodetree */ goto illegal_op; } else if ((insn & (1 << 23)) == 0) { diff --git a/target/arm/t32.decode b/target/arm/t32.decode index d05673ff3e..c956ddb254 100644 --- a/target/arm/t32.decode +++ b/target/arm/t32.decode @@ -487,7 +487,10 @@ STRD_ri_t32 1110 1001 .100 .... .... .... ........ @ldstd_ri8 w=0 p=1 LDRD_ri_t32 1110 1001 .101 .... .... .... ........ @ldstd_ri8 w=0 p=1 STRD_ri_t32 1110 1001 .110 .... .... .... ........ @ldstd_ri8 w=1 p=1 -LDRD_ri_t32 1110 1001 .111 .... .... .... ........ @ldstd_ri8 w=1 p=1 +{ + SG 1110 1001 0111 1111 1110 1001 01111111 + LDRD_ri_t32 1110 1001 .111 .... .... .... ........ @ldstd_ri8 w=1 p=1 +} # Load/Store Exclusive, Load-Acquire/Store-Release, and Table Branch