From patchwork Fri Aug 28 14:19:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 248545 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp1136133ilg; Fri, 28 Aug 2020 07:35:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQe2rfoKJukqMAUgF6CrZg0WvmVBld0kyJTjjR1zQpv0YU/KllU9VcujO2IuMyKL1m6HAg X-Received: by 2002:a25:ae43:: with SMTP id g3mr2801973ybe.459.1598625353847; Fri, 28 Aug 2020 07:35:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598625353; cv=none; d=google.com; s=arc-20160816; b=uv4uSVumqqSOuT2qArzskwX8OrDAGLKgt51NpE8himnh27x//bkrUUTcd5InlszUCR KOFJbhOZIY1U/6LbjpmfO3SAVNSMj7KSUahI3pmVS3qVyFh3H9VpVQlT7TlqYmc3moRz YRFl84CumVyvuD37pGGKKh62K+0j+UcwhZ/+Qom5RGJbpOqFpS1N7c1zHAm+ggPdSRSi 5QI3epymlRxzlYkMl8TUHA0ds0XHDzM5yG9LPcxZU9Hikl219BlIdKBKQOEOkCGH0BBD PuV5F4usmXDTlg/ivj5YpeCgz5xEW5E8p83dfGC6leV+5NPYdt3xwmqq1nOp1ueDLAvi dn7w== 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=50E0hW76gnTgLCYM21b2+hcWFagS0hoFg/XoJTnl9H8=; b=XsU3LYvWRPgsgBDXHpELRPMuLprtmksycEgY0K9ZxToxBPi3yTZXfTdJyiinhhjyi8 +iL+hrsigmiRcOQ+q+GPjISVaejNfAaYMTdlOZZ3N+L56+c3WHjmDrYilA7DIHjiFhF7 jLnYezLDgc468bHGzLOTDYsfW2OYHhvrytkW+7q9QvBnny7QfHonMwG7KBtSncavsveD 5c+ZJC9K0wdcsrDyhZkc2QF7HGCIpSs/yGK0WYidupPqy8YAH3MduRt8mhEkUC31pj9x /oeDIvjrZ+auN0X2K9CWuxwkaFsGZgjZMAjkdtWZ5p6srxMTfU68k5Fc2Whul+iFHZMx 4/Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aMD0vn7Y; 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=pass (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 l4si1234262ybc.52.2020.08.28.07.35.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Aug 2020 07:35:53 -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=pass header.i=@linaro.org header.s=google header.b=aMD0vn7Y; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBfTt-0006J0-6Z for patch@linaro.org; Fri, 28 Aug 2020 10:35:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBfFF-0001gy-6S for qemu-devel@nongnu.org; Fri, 28 Aug 2020 10:20:45 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:34218) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBfFC-0005L5-Bl for qemu-devel@nongnu.org; Fri, 28 Aug 2020 10:20:44 -0400 Received: by mail-pl1-x644.google.com with SMTP id v16so539343plo.1 for ; Fri, 28 Aug 2020 07:20: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 :mime-version:content-transfer-encoding; bh=50E0hW76gnTgLCYM21b2+hcWFagS0hoFg/XoJTnl9H8=; b=aMD0vn7YXNiI7oXmxipwC3oGnTBSwqApyOeZgc8vZfIwMEgqgpwlzMo3el4S3H2bdG F08uIXSUUsiNOhf12sZhzgvk967B5L476cJGA1Lhs/oEl9Of0RtcpTwiPdy+KyF0EWdS i+CaBvX+D5Iihfh3/6gDr15zBNp9Mvc255+rxeyVz3Lx11t4jYvWTqraIaO7urI1PmIr c7KCdaACYl64BqfkC3Rwklevw/+Yyz2bOayZ8n0OCfGP6bALyld9xqX83g4U/g5uh5Ow wwfeiofDBHhxYXub/4aOkYYFAyyvVYKjyVOsGisHbRJf1+70zsvaEZSpHOsu+SqkSiaC aMpQ== 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=50E0hW76gnTgLCYM21b2+hcWFagS0hoFg/XoJTnl9H8=; b=h+wH/bwtRw7ymLex99KqbwCx9OZCqwQja2nqf3yAnzH1LlT+b2VTelnLnGvh7AkFpS 1+Flm4cmEm1RKEL63kRDBRJxfYEm4zeTR412rWlAFmsa7HeI6N7Xh4vhUaYJinqUPCnl Pd2o509AP402Dhdvw1tE0X9ZKRjJsqWUofzWjqz6TT/SUdAewy3Lwj7lwbC0THve4aL8 rJIRKgEa5c8wcJcTPOddRqrZb/fT/g+3DS8dwf0m4NbWgR3JBN0puMg/PaSX4JT4rqxN LrpfE6EkK6lE4Rf8xaOLGhAuuMECXoS+3DnK19iOPdQDdy2oOtumPJh4VdzsVtsVrhXL ngtg== X-Gm-Message-State: AOAM5307r6AIn6SomtIVnRT1TBZF3OKGKXLUbC6X7+6XoK/sI/xCb1bo KD0e81S5rL8lLjchTVLhoii0XVA/Ik/3nA== X-Received: by 2002:a17:902:b60d:: with SMTP id b13mr1490296pls.48.1598624439819; Fri, 28 Aug 2020 07:20:39 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id j3sm1403080pjw.23.2020.08.28.07.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 07:20:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 54/76] target/microblaze: Assert no overlap in flags making up tb_flags Date: Fri, 28 Aug 2020 07:19:07 -0700 Message-Id: <20200828141929.77854-55-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200828141929.77854-1-richard.henderson@linaro.org> References: <20200828141929.77854-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::644; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x644.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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=ham 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: edgar.iglesias@xilinx.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Create MSR_TB_MASK. Use it in cpu_get_tb_cpu_state, and check that IFLAGS_TB_MASK does not overlap. Signed-off-by: Richard Henderson --- target/microblaze/cpu.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index 594501e4e7..2fc7cf26f1 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -261,8 +261,11 @@ struct CPUMBState { #define DRTE_FLAG (1 << 17) #define DRTB_FLAG (1 << 18) #define D_FLAG (1 << 19) /* Bit in ESR. */ + /* TB dependent CPUMBState. */ #define IFLAGS_TB_MASK (D_FLAG | IMM_FLAG | DRTI_FLAG | DRTE_FLAG | DRTB_FLAG) +#define MSR_TB_MASK (MSR_UM | MSR_VM | MSR_EE) + uint32_t iflags; #if !defined(CONFIG_USER_ONLY) @@ -372,12 +375,14 @@ typedef MicroBlazeCPU ArchCPU; #include "exec/cpu-all.h" +/* Ensure there is no overlap between the two masks. */ +QEMU_BUILD_BUG_ON(MSR_TB_MASK & IFLAGS_TB_MASK); + static inline void cpu_get_tb_cpu_state(CPUMBState *env, target_ulong *pc, target_ulong *cs_base, uint32_t *flags) { *pc = env->pc; - *flags = (env->iflags & IFLAGS_TB_MASK) | - (env->msr & (MSR_UM | MSR_VM | MSR_EE)); + *flags = (env->iflags & IFLAGS_TB_MASK) | (env->msr & MSR_TB_MASK); *cs_base = (*flags & IMM_FLAG ? env->imm : 0); }