From patchwork Wed Nov 3 04:03:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516707 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp179120iml; Tue, 2 Nov 2021 21:06:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZRFh+xAdV+uwStDR7JjJjPbnMuIb1xtvyIk8dOvYdPiCTljGSfXUxgPFZZHzwwBK1fmXG X-Received: by 2002:a05:6830:448e:: with SMTP id r14mr18936888otv.171.1635912398984; Tue, 02 Nov 2021 21:06:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635912398; cv=none; d=google.com; s=arc-20160816; b=lBsIoz76C0Bfi2Rrd7dCHVLG9dmXSOIdTh4WnTjq2y28LpygKRoJXtZoQ5hSqXNHEP UeJwfVxxP5BtE5ziI8zONJe48WMxMImdXU6/Rk0JqupgXoJ098gwhFidfKkgSwfGCPp/ Z2w0R4WX49OD6I9h1Re1f3dJerWTWxb/m6666BvMUmriY6ILMBBiuvcyEIU4rjqbYpoE iywbMMmwnIU9Z1Vl+pv/BKqKCpRX1ziUMOKJ3JeazNTUDl0FdVoLj/ZMQtwgQP0acDGH wP19CmiHbND9bnOwDP4YfKnrMn9CTGaMS93W7Pu8S0qttXpwDbxL8/HtHby2MSPlRrOf 4Vgg== 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=ztwm/zJmHHIzh4HcML3vD8itiNyqlXeIngv750qW5RU=; b=VbJvGJ4oBFfoKEdbL9idXX06QA8+MAKOQFwDIV8xiKAEQfWb9KtHL86pxsGs/raQnn Bfv8/bvXLJ0F0NcGu4d0BPa1+0ndWL7ZdBgmK06vhP+R8/gSYSswRDNvzkfbTAJF6ClA OZXdvA1RdZOsSPtqdur3b+B+NtQWHkb2p586eAOXx4Sc/m6YQI0e2l0ENnThLphkkVns 40PvJA1osICnOMgmHVUGi9AFSj0P8UE/5mJcK+3QEyH93IAOjNv0X29vk+p3C09vO1ph HF0OvoHLEmdh5ZC/I2UUMNAkxujPTI3PqHC0wBnKWllti/5i0iGZ+AH2zFDB2VmHuqiT jNTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="wKWi/ht9"; 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 b187si1132892oia.3.2021.11.02.21.06.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Nov 2021 21:06: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=pass header.i=@linaro.org header.s=google header.b="wKWi/ht9"; 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]:38216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mi7Xq-00065j-9U for patch@linaro.org; Wed, 03 Nov 2021 00:06:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mi7VI-00057S-0x for qemu-devel@nongnu.org; Wed, 03 Nov 2021 00:04:00 -0400 Received: from mail-qv1-xf32.google.com ([2607:f8b0:4864:20::f32]:44638) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mi7VF-0000uH-Ku for qemu-devel@nongnu.org; Wed, 03 Nov 2021 00:03:59 -0400 Received: by mail-qv1-xf32.google.com with SMTP id v2so1470254qve.11 for ; Tue, 02 Nov 2021 21:03:57 -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=ztwm/zJmHHIzh4HcML3vD8itiNyqlXeIngv750qW5RU=; b=wKWi/ht91swZXZ9MgbRYW1cIHg1UDoucdL4PhT0B1oxyOL0thai9m5NWbPn6hB6jld B4jXntWQlxGkjflg3CeiaC4vyvF4xNZ1Czt5cc8UBWD8u97P+7AIXT72FJweaRBWaIiW WlzUYC3EBBxKlYLVAEoP4hiSCq1ARO/jyNEsTfjQNNbXTsi/e30A3J3rbuHTtcM8Azh0 /riDzkuq0EpfGwbZxhYj/hLGYSSa+uhSWTC2iCns8UCKyJhh3gTX65DTjgvku/QN8M3g y2/qY69bjoghrd1nYCoja2GMESOIE8BhI6p+KFbZ8Rm+tEh07UtcFA/i8fhYdHdNOcvN fNdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ztwm/zJmHHIzh4HcML3vD8itiNyqlXeIngv750qW5RU=; b=GwJP3Jr45lr9hs8fop267N5vxD/lZGCaCcYZIXcAmg/Xpp0eWkJ52Gw5K0MF2bobeL eUzraHoYgfaTwd90A6TsVlhxu8OJTtBXNY6i1/Fg+xs0bos+5Rtcw1pRY+6dZ2qmlW4e 5TLwLLv4TcOYMFP3THHrgFhIW0Vsxd+jN9j6Ra99768F7yVr5DMOHA5fKrdRMER38/KP yClNrZbzmI0+XWKeUXLBhskO4ADbDLoanifm3/mZKmmSU168v/yy+Qs/EQWwRJe3QeaO BUEwJ/860rt4TzEIo1NwqCd0OJVsc4zjBEpIwrbwEGV9bDudn16hiB7CqgJyj2zdaA// a4AQ== X-Gm-Message-State: AOAM532bNvthgtDmCHoJqUEiEn/z6Bj9qQm4/sInqxDe/llOUk9yRK05 F2DZta6pOYaJ+L1+agAwPYcz/exEMams5Q== X-Received: by 2002:a0c:eec3:: with SMTP id h3mr33999810qvs.17.1635912236757; Tue, 02 Nov 2021 21:03:56 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-57.nyc.biz.rr.com. [172.254.253.57]) by smtp.gmail.com with ESMTPSA id br20sm730408qkb.104.2021.11.02.21.03.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 21:03:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 04/10] target/arm: Split arm_pre_translate_insn Date: Wed, 3 Nov 2021 00:03:46 -0400 Message-Id: <20211103040352.373688-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211103040352.373688-1-richard.henderson@linaro.org> References: <20211103040352.373688-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f32; envelope-from=richard.henderson@linaro.org; helo=mail-qv1-xf32.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=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Create arm_check_ss_active and arm_check_kernelpage. Reverse the order of the tests. While it doesn't matter in practice, because only user-only has a kernel page and user-only never sets ss_active, ss_active has priority over execution exceptions and it is best to keep them in the proper order. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/target/arm/translate.c b/target/arm/translate.c index a39456ea98..82d4e24c27 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -9513,7 +9513,7 @@ static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) dc->insn_start = tcg_last_op(); } -static bool arm_pre_translate_insn(DisasContext *dc) +static bool arm_check_kernelpage(DisasContext *dc) { #ifdef CONFIG_USER_ONLY /* Intercept jump to the magic kernel page. */ @@ -9525,7 +9525,11 @@ static bool arm_pre_translate_insn(DisasContext *dc) return true; } #endif + return false; +} +static bool arm_check_ss_active(DisasContext *dc) +{ if (dc->ss_active && !dc->pstate_ss) { /* Singlestep state is Active-pending. * If we're in this state at the start of a TB then either @@ -9562,7 +9566,7 @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) uint32_t pc = dc->base.pc_next; unsigned int insn; - if (arm_pre_translate_insn(dc)) { + if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { dc->base.pc_next = pc + 4; return; } @@ -9633,7 +9637,7 @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) uint32_t insn; bool is_16bit; - if (arm_pre_translate_insn(dc)) { + if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { dc->base.pc_next = pc + 2; return; }