From patchwork Wed Sep 6 16:06:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 111832 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp1156608qge; Wed, 6 Sep 2017 09:35:20 -0700 (PDT) X-Received: by 10.200.3.195 with SMTP id z3mr4689192qtg.259.1504715720231; Wed, 06 Sep 2017 09:35:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504715720; cv=none; d=google.com; s=arc-20160816; b=OAU8f+9HSU+XAU0vKNzRWqYT0Zgfda3+vCrE0UlvKdh8HMk6MrYUIecQc6qCEe1pLP 7Zl0j+kTqjj4jxctPxwbdFzHf+t9nW4At8e1FUKGBfZvp+K4xlGvSJCDSyCoUmRqIMUG n1j5swU2HJ2frsgyiHQ3twQ+9lI7yYbXz9lmE/TDguensvaX+HyqlCEWDt30g4BRxiO9 dy0bxFE/PtdrtCJ3PTCuNuVpK20DcnMy1XVeWqsZV+P2eiO3jSIN39qWw70yUbRqXbai D3qzoZeoyYzlxw6jwmuij/u0qpMvbuKLox41w8rZR2boy6ufDON9BUIw+QEKtOVuxt7b oXjw== 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:arc-authentication-results; bh=Ha1eJVC/XlLZUGzBl9MJWLKgoWQzuKY2EFfYjP9LFKQ=; b=ulOdROeU95hA2gsCS4P0TeGF9m796XgDZd/OQuGydlstSFWkiSF2VmmlolxfC2uJt3 Cm35ZDQn/h5zzJyVToJ6eg8UmA9TkSyWcsf+4h88ztjDifYn13843tCw0d5KxB9l/D2M VlklLsQYr9aguUx9L1inrryLe1bp6TveIFy0yaB+sHyiSho0Sotz5Nf9lAYgJMyDUGo3 ciKwTSV5GQ9QEvY1jiFfEm00CQmKW+MnQ5UxYo3u0bkjO54J5GQVX1RqYBRFfHhpOVcK mKs5vF2AGf8KrqseTpUFZ+y5X3a96/VXlTD3R8KghE0JUbaJdHeR/VIKs4Z2lDn6it1Z soFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fKjXdkKI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id b3si268193qkd.51.2017.09.06.09.35.19 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 06 Sep 2017 09:35:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fKjXdkKI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:37088 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpdIL-0007NL-S2 for patch@linaro.org; Wed, 06 Sep 2017 12:35:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpcqy-0000ad-0M for qemu-devel@nongnu.org; Wed, 06 Sep 2017 12:07:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpcqs-00031D-Bd for qemu-devel@nongnu.org; Wed, 06 Sep 2017 12:07:00 -0400 Received: from mail-pf0-x236.google.com ([2607:f8b0:400e:c00::236]:35367) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dpcqs-000304-5D for qemu-devel@nongnu.org; Wed, 06 Sep 2017 12:06:54 -0400 Received: by mail-pf0-x236.google.com with SMTP id g13so13484313pfm.2 for ; Wed, 06 Sep 2017 09:06:54 -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=Ha1eJVC/XlLZUGzBl9MJWLKgoWQzuKY2EFfYjP9LFKQ=; b=fKjXdkKI8Q+4xPflwbSboF8E28IrJYd3ZvRnAm1ggGa2EdVo3A68HaoK1H2mZlDqLr ynC7l2S8DPoC+HfdVd8SBH/6Pi9fh3CIe8GVI/tHuXoWG5YuXUuC4cZBNpz++vErPhcv 7SI11KdcRGzopenikqEQDUojNEJ7NMDXXs7RE= 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=Ha1eJVC/XlLZUGzBl9MJWLKgoWQzuKY2EFfYjP9LFKQ=; b=QUZCw8/JHzNUVQh1yaVu+ef0JDgUP+Rlp6ObFPh1DH1LmyYaKQyu9beOOCn9f695Ws F8DQAk8HQU0Ql+vRweNY84uPZN8TlYEFGvrtdcR44wKDIn5K+Fj+ffX7uEtSsUohmd5K vMccruFZekqYtHhmK2vRimGufk/K88N3qd06xwg/PerM/szthUVU3IMhNiOmDUgRtUZ/ PudpgeFQ5Vmprq8d9VkmV4HtYD60uquvjo3hgWQasffKdKD6Kjg4lavakk2A2/WCzi78 FqwjuvsAWCmB2bb4Ocs3OIz72fSYqEgKk/FXYBdX+Y8Kqvxnz/XU8BWFJUzMzP5dNxDH Usmw== X-Gm-Message-State: AHPjjUg+2q6sZUX/HoITF8RB7puIC4Qi0pOOSrdwL3TUzfz7Ipd8pmI3 TO5IeEx/QeSwc4aHLfYGKA== X-Google-Smtp-Source: ADKCNb4Vp7cOPnQfM83w4ymfDGY7YLTCnrAb/85romrbVW45iyDF+xRZjjwuR54wmEfjzLjDBmjVQw== X-Received: by 10.84.216.6 with SMTP id m6mr8719965pli.143.1504714013015; Wed, 06 Sep 2017 09:06:53 -0700 (PDT) Received: from bigtime.twiddle.net (97-126-108-236.tukw.qwest.net. [97.126.108.236]) by smtp.gmail.com with ESMTPSA id t65sm262863pfk.59.2017.09.06.09.06.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Sep 2017 09:06:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 6 Sep 2017 09:06:09 -0700 Message-Id: <20170906160612.22769-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170906160612.22769-1-richard.henderson@linaro.org> References: <20170906160612.22769-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::236 Subject: [Qemu-devel] [PULL 29/32] target/arm: [a64] Move page and ss checks to init_disas_context X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Since AArch64 uses a fixed-width ISA, we can pre-compute the number of insns remaining on the page. Also, we can check for single-step once. Reviewed-by: Emilio G. Cota Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) -- 2.13.5 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 25c6622825..9017e30510 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -11206,6 +11206,7 @@ static int aarch64_tr_init_disas_context(DisasContextBase *dcbase, DisasContext *dc = container_of(dcbase, DisasContext, base); CPUARMState *env = cpu->env_ptr; ARMCPU *arm_cpu = arm_env_get_cpu(env); + int bound; dc->pc = dc->base.pc_first; dc->condjmp = 0; @@ -11254,8 +11255,14 @@ static int aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->is_ldex = false; dc->ss_same_el = (arm_debug_target_el(env) == dc->current_el); - dc->next_page_start = - (dc->base.pc_first & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; + /* Bound the number of insns to execute to those left on the page. */ + bound = -(dc->base.pc_first | TARGET_PAGE_MASK) / 4; + + /* If architectural single step active, limit to 1. */ + if (dc->ss_active) { + bound = 1; + } + max_insns = MIN(max_insns, bound); init_tmp_a64_array(dc); @@ -11323,12 +11330,6 @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) disas_a64_insn(env, dc); } - if (dc->base.is_jmp == DISAS_NEXT) { - if (dc->ss_active || dc->pc >= dc->next_page_start) { - dc->base.is_jmp = DISAS_TOO_MANY; - } - } - dc->base.pc_next = dc->pc; translator_loop_temp_check(&dc->base); }