From patchwork Mon Jan 11 19:00:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 360527 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp3132709jai; Mon, 11 Jan 2021 11:09:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJwcU/x0LWS7DUCaK0XSsJqCLJS0VG8bkfD1wvtOWHAb60JZRO/f7SQCM+IqohcAFuNctEu0 X-Received: by 2002:a25:1004:: with SMTP id 4mr1748300ybq.137.1610392175357; Mon, 11 Jan 2021 11:09:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610392175; cv=none; d=google.com; s=arc-20160816; b=TzG60qrYBCiTudJd9LJuRXzvCaraFqP/6rQaAE+q7kdvScb4RamaG6EAxZeLlrarmf Ki3gMht9NvNYWkSLM3hTlu5hzshf14K1H4z/LkQNILNa2YvswyJnITE7Zf5F1rpXuV4G RavItmSkaesFJI3DdfO4avdJlLbzW1yThrR2jSpO5R30EVdqqzRNWFRyoxjigzowC/e9 spdOX6gdFsvR+h/2EPCI7go6I9rW3/wkPztjcZN0OL0hFRe7bs9yuRoVU5+1umTugSim /R3XTK+nVXiPTGtuJ94VhDeuLywXCs3WwMMpvGMrePtz2weGjvtkW6Tob7cm99LBAHqu 1Jdw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=5Vo6hKG+XeXChWCO/nvW6DJ7PoxmnMyeEjcU9Aitm8k=; b=MPrqUB4YQbziyiSVOQ6NxtDaM4uYvgmlGJ2Kh/7FdQ3OmWWZTtC2vkqyH4NgfT8YZP 8s/+dB2xryq6OL0S/1AcB2eAmyEVF6Spa1+0pUspOxPgdJPmLitBOiu0X5v6scRSvFNk KzbUfB8RUCiBwaWsYaNjkVPSk/CfYnTI/sNpPWBP1pgvSNphnf3GFogPxQd0CwHw/z1/ LIzaopvISSycr9vPVFtICJUjY5oc5TVYpuSNPdbaOX8EL+dIHuvCYBSjQSx/F7nrNKaI YLYti9bDEqlNOcp2PATQ9HHNh61au+IvlQDR0ENFAQqg3daCFeO+dOX6K1zo9YDYm8ji qdmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wB8QbFzC; 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 w138si587506ybe.277.2021.01.11.11.09.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jan 2021 11:09:35 -0800 (PST) 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=wB8QbFzC; 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]:37876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kz2ZJ-0005Uv-D6 for patch@linaro.org; Mon, 11 Jan 2021 14:09:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47002) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kz2RW-0005sE-I6 for qemu-devel@nongnu.org; Mon, 11 Jan 2021 14:01:30 -0500 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:43268) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kz2RU-0006Oj-OF for qemu-devel@nongnu.org; Mon, 11 Jan 2021 14:01:30 -0500 Received: by mail-pf1-x429.google.com with SMTP id c12so483910pfo.10 for ; Mon, 11 Jan 2021 11:01:28 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=5Vo6hKG+XeXChWCO/nvW6DJ7PoxmnMyeEjcU9Aitm8k=; b=wB8QbFzCmsJAZTXrsgIP+l7TBsqQDhPTNBcXt3a68iZP+fMcz5sVl/XBacPT/dFsCo r6N+1UvTNvw/Q0xtA5/G+5LU6elom4o2h9D/p8x/9cTWFsDxFl56CCgl8/zhRSGsZep2 vkHwd+cw059z5Atmu8r7ZvJHIRuauWu9j81OHN1Glr2BNy8R2E8BscB5Qz6zmAoAL+Gj XKOxnbjAhzVCJGKu43BM3ZEy+g6P0jARQZqAQpXMb9DRc7tYS2wTAfsc5r9iVHBW7Wny 4rm4UNgPSYBl13HzA3HXiEZq8+kzCKydRscVlDPQvfz9vuEWiww0+vZ2KcZWQU0MsWHJ iKag== 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:mime-version:content-transfer-encoding; bh=5Vo6hKG+XeXChWCO/nvW6DJ7PoxmnMyeEjcU9Aitm8k=; b=NdKjjy69AThVFrBcYdHyUcmcf00VIYcID/dSMjFKZrkvxnB/r0ZpstcTE7HyOAkxp3 eBdzJ9EWwt9K76O+a7ViqyQErryGPVxdlqonSVrMPpiLKSuYy+lPbqW0nVR/7NAs/BLX 2giAUhy7ePhPPmfMi+WmEXPtC48TJF1RxzQipULCRSHxsQ4iuO4360gkyQyuQn0zZ9Xl 7mXrx3CjsRA0v3ZwxZvcu3R1UYuGpMy8xW1yr4zCHuiYuM3XPjyYZryO6+NsMNUPw5W1 9X9ybTaYiMwPOVC3tnBfoB0IdoJV+Gofp80pcIlU8nRBb/QRhmuQ8jQj78muHKtpn9lT kOfQ== X-Gm-Message-State: AOAM531dmBTG2qT+uAV2R50nIhYQNquodnGbbQPhW3y7svQOCw+T1rbz N1XXovJOEzPsdLY7txkiFwwgyoGcJvu2LA== X-Received: by 2002:aa7:860b:0:b029:19e:2827:93b7 with SMTP id p11-20020aa7860b0000b029019e282793b7mr827804pfn.22.1610391686700; Mon, 11 Jan 2021 11:01:26 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id n195sm350395pfd.169.2021.01.11.11.01.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 11:01:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 06/30] target/arm: Move mode specific TB flags to tb->cs_base Date: Mon, 11 Jan 2021 09:00:49 -1000 Message-Id: <20210111190113.303726-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210111190113.303726-1-richard.henderson@linaro.org> References: <20210111190113.303726-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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" Now that we have all of the proper macros defined, expanding the CPUARMTBFlags structure and populating the two TB fields is relatively simple. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 49 ++++++++++++++++++++++++------------------ target/arm/translate.h | 2 +- target/arm/helper.c | 2 +- 3 files changed, 30 insertions(+), 23 deletions(-) -- 2.25.1 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index c7700c9c85..af70462cfa 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -221,6 +221,7 @@ typedef struct ARMPACKey { /* See the commentary above the TBFLAG field definitions. */ typedef struct CPUARMTBFlags { uint32_t flags; + target_ulong flags2; } CPUARMTBFlags; typedef struct CPUARMState { @@ -3251,20 +3252,26 @@ typedef ARMCPU ArchCPU; #include "exec/cpu-all.h" /* - * Bit usage in the TB flags field: bit 31 indicates whether we are - * in 32 or 64 bit mode. The meaning of the other bits depends on that. - * We put flags which are shared between 32 and 64 bit mode at the top - * of the word, and flags which apply to only one mode at the bottom. + * We have more than 32-bits worth of state per TB, so we split the data + * between tb->flags and tb->cs_base, which is otherwise unused for ARM. + * We collect these two parts in CPUARMTBFlags where they are named + * flags and flags2 respectively. * - * 31 20 18 14 9 0 - * +--------------+-----+-----+----------+--------------+ - * | | | TBFLAG_A32 | | - * | | +-----+----------+ TBFLAG_AM32 | - * | TBFLAG_ANY | |TBFLAG_M32| | - * | +-----------+----------+--------------| - * | | TBFLAG_A64 | - * +--------------+-------------------------------------+ - * 31 20 0 + * The flags that are shared between all execution modes, TBFLAG_ANY, + * are stored in flags. The flags that are specific to a given mode + * are stores in flags2. Since cs_base is sized on the configured + * address size, flags2 always has 64-bits for A64, and a minimum of + * 32-bits for A32 and M32. + * + * The bits for 32-bit A-profile and M-profile partially overlap: + * + * 18 9 0 + * +----------------+--------------+ + * | TBFLAG_A32 | | + * +-----+----------+ TBFLAG_AM32 | + * | |TBFLAG_M32| | + * +-----+----------+--------------+ + * 14 9 0 * * Unless otherwise noted, these bits are cached in env->hflags. */ @@ -3342,19 +3349,19 @@ FIELD(TBFLAG_A64, MTE0_ACTIVE, 19, 1) #define DP_TBFLAG_ANY(DST, WHICH, VAL) \ (DST.flags = FIELD_DP32(DST.flags, TBFLAG_ANY, WHICH, VAL)) #define DP_TBFLAG_A64(DST, WHICH, VAL) \ - (DST.flags = FIELD_DP32(DST.flags, TBFLAG_A64, WHICH, VAL)) + (DST.flags2 = FIELD_DP32(DST.flags2, TBFLAG_A64, WHICH, VAL)) #define DP_TBFLAG_A32(DST, WHICH, VAL) \ - (DST.flags = FIELD_DP32(DST.flags, TBFLAG_A32, WHICH, VAL)) + (DST.flags2 = FIELD_DP32(DST.flags2, TBFLAG_A32, WHICH, VAL)) #define DP_TBFLAG_M32(DST, WHICH, VAL) \ - (DST.flags = FIELD_DP32(DST.flags, TBFLAG_M32, WHICH, VAL)) + (DST.flags2 = FIELD_DP32(DST.flags2, TBFLAG_M32, WHICH, VAL)) #define DP_TBFLAG_AM32(DST, WHICH, VAL) \ - (DST.flags = FIELD_DP32(DST.flags, TBFLAG_AM32, WHICH, VAL)) + (DST.flags2 = FIELD_DP32(DST.flags2, TBFLAG_AM32, WHICH, VAL)) #define EX_TBFLAG_ANY(IN, WHICH) FIELD_EX32(IN.flags, TBFLAG_ANY, WHICH) -#define EX_TBFLAG_A64(IN, WHICH) FIELD_EX32(IN.flags, TBFLAG_A64, WHICH) -#define EX_TBFLAG_A32(IN, WHICH) FIELD_EX32(IN.flags, TBFLAG_A32, WHICH) -#define EX_TBFLAG_M32(IN, WHICH) FIELD_EX32(IN.flags, TBFLAG_M32, WHICH) -#define EX_TBFLAG_AM32(IN, WHICH) FIELD_EX32(IN.flags, TBFLAG_AM32, WHICH) +#define EX_TBFLAG_A64(IN, WHICH) FIELD_EX32(IN.flags2, TBFLAG_A64, WHICH) +#define EX_TBFLAG_A32(IN, WHICH) FIELD_EX32(IN.flags2, TBFLAG_A32, WHICH) +#define EX_TBFLAG_M32(IN, WHICH) FIELD_EX32(IN.flags2, TBFLAG_M32, WHICH) +#define EX_TBFLAG_AM32(IN, WHICH) FIELD_EX32(IN.flags2, TBFLAG_AM32, WHICH) /** * cpu_mmu_index: diff --git a/target/arm/translate.h b/target/arm/translate.h index f30287e554..50c2aba066 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -402,7 +402,7 @@ typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp); */ static inline CPUARMTBFlags arm_tbflags_from_tb(const TranslationBlock *tb) { - return (CPUARMTBFlags){ tb->flags }; + return (CPUARMTBFlags){ tb->flags, tb->cs_base }; } /* diff --git a/target/arm/helper.c b/target/arm/helper.c index cc73acc927..0d7c8817b6 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -13030,7 +13030,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, CPUARMTBFlags flags; uint32_t pstate_for_ss; - *cs_base = 0; assert_hflags_rebuild_correctly(env); flags = env->hflags; @@ -13101,6 +13100,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, } *pflags = flags.flags; + *cs_base = flags.flags2; } #ifdef TARGET_AARCH64