From patchwork Wed Jun 3 01:12:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187416 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp73820ilo; Tue, 2 Jun 2020 18:20:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIImPhk2UO+obbIhvFUYL9LxkJ/FRzUn8NVhvmoQfnL64Fz2tq6Ufd+UyuQr0YMKg2p6mo X-Received: by 2002:a25:a063:: with SMTP id x90mr331025ybh.191.1591147244940; Tue, 02 Jun 2020 18:20:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591147244; cv=none; d=google.com; s=arc-20160816; b=Vw/k/HHYV2zG2T1U3MfFBr3o5je57icMw9f2x9wZJfyxWoY5IHwubdq3rJ2Q1DOjEc 0tTbulgC5cQHIIc6V+u9JDmLxtFDTtjQSwmk/embM0z0HRtehIo/Q+nWYWJz7erGjbDi xJJDi0BfSHfo8wi/fOd9vucxWN+8zXg1Vz23kMU1qQyN4Na7uajhy49pZdFFVMUy9t3+ ihA7VaYX3vW1GgWh4RjFyrGbRn8Ei/Wz+hFGSMieF3rb8957+/dXaze8QAzNkINW/gJS h5E65SVUIIBqhlrbZid7mW6rAil0StQjT4xkr1gLHpFWAUtUb6u+hIKZ8zOjMlGU3nHu KUbg== 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=61m39+FMAykppXrhX2BpqO13HC/u4DFx0okzBeTOBpE=; b=z0W9cYvD5mDnyQoUSseYu0DYmq/ThfLc4Ma7gIUop0h8GPjuhU+Dcj1qXxd6x1lQoe r3rcjYB1latbiOcJg10O4KqWLPT8Xm0WzF0wII7mKGhpA8uR01vGFgQYVNYro6wrC7xd /ic8E7AByZwd3Rm+BliepY827zXjRAnwl7gC23XDXJ6qdDZyQXUdCX+H6FWxBGPnjNfg KcWWmY5kzuGxSzDQu40PtL1kjq5eCowU1t7avqEdPo9anR7AIsjWuGcCk/WFnW7Dd1S6 030DNMtUd/SxQYJyxQoNyJkYXUVzTou/mj7T7DQX8jmWq0B1NtkkvKTvxRBFhyQpPsKG +TzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=a15OZsXw; 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 v16si248235ybe.324.2020.06.02.18.20.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jun 2020 18:20:44 -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=a15OZsXw; 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]:47738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgI5E-0007i0-Cx for patch@linaro.org; Tue, 02 Jun 2020 21:20:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgHyX-00045i-7k for qemu-devel@nongnu.org; Tue, 02 Jun 2020 21:13:49 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:43511) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jgHyN-0003Z8-GV for qemu-devel@nongnu.org; Tue, 02 Jun 2020 21:13:48 -0400 Received: by mail-pl1-x644.google.com with SMTP id g12so191223pll.10 for ; Tue, 02 Jun 2020 18:13:38 -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=61m39+FMAykppXrhX2BpqO13HC/u4DFx0okzBeTOBpE=; b=a15OZsXw7InJ70zYYPo+xB1xlJaZFhubTGye7fFD7myJv5BmMISyjlOfz6soUBYY5k wmB9hwcYGkcLmjuVBxf7HkRemEWKYQw0Y/o0dvcXPQ8dfsFUnQgPgZJC3NuRqFGD3TOj 4hHsIOAkIoTxVrtxeHzwG9Y+iQLgWc9nQGzP3jux7L2/a9CUazwXmAVBs7VxZdbdu5+Q iiGY5vkKM9vy7xkoeMg0E27VKEIomKfhy69I1k3HrO6WXBBdCx1uPYbzxXNSQgHEVYBX UtgfL/+fMecWXnYtmndJYeeEeuPLlNMCsmxN9BT5IxWGZ/enWJAhHN8oFDWr6WDsN7cF 2sow== 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=61m39+FMAykppXrhX2BpqO13HC/u4DFx0okzBeTOBpE=; b=g4rj2GW4rYlXjX/eESkucmKPZuHnbMRoCNeG0o1zitcw8haTXKhjeHPDbzqUGv3ko+ LevSZIZHRu+MBCnQA+KhRSMX4pPPP4JQzeFfd4xY3dR/ipChT9lNrWhLL552O60ykmBW Rb4jEJeQWmoyalVlaiJxCcMVxEYElCSH1LhvPQyvR/DkF5khgCaoTmXJuJu+FRDekY6E ekDQIzmUQDUEUS+jvGRpLcxx3i8BrTeFWt+pKFcNgCzPbhNBI5XZ5e3HrwqUqxmfMiNI PfzmAt3ZDfeuAif2AeFZsMOeQJO5Zaj4+iwHwSc2iy6y3+bAuDpQ4ojmJoo3D4XyxDK3 NI+A== X-Gm-Message-State: AOAM530K9ljhIXiI8na7qbOe1MHuBu/O1gP2Q4j6Zd9DQj7Y1StbknhR ANI5fDfaL709UJOlO9TkgbrlSejeB0U= X-Received: by 2002:a17:902:b110:: with SMTP id q16mr26887701plr.221.1591146816819; Tue, 02 Jun 2020 18:13:36 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id 3sm290067pfe.85.2020.06.02.18.13.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2020 18:13:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v7 14/42] target/arm: Add helper_probe_access Date: Tue, 2 Jun 2020 18:12:49 -0700 Message-Id: <20200603011317.473934-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200603011317.473934-1-richard.henderson@linaro.org> References: <20200603011317.473934-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_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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, steplong@quicinc.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Raise an exception if the given virtual memory is not accessible. Signed-off-by: Richard Henderson --- target/arm/helper.h | 2 ++ target/arm/op_helper.c | 16 ++++++++++++++++ target/arm/translate-a64.c | 13 +++++++++++++ 3 files changed, 31 insertions(+) -- 2.25.1 diff --git a/target/arm/helper.h b/target/arm/helper.h index 49336dc432..4b64d1ebd3 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -96,6 +96,8 @@ DEF_HELPER_FLAGS_1(rebuild_hflags_a32_newel, TCG_CALL_NO_RWG, void, env) DEF_HELPER_FLAGS_2(rebuild_hflags_a32, TCG_CALL_NO_RWG, void, env, int) DEF_HELPER_FLAGS_2(rebuild_hflags_a64, TCG_CALL_NO_RWG, void, env, int) +DEF_HELPER_FLAGS_5(probe_access, TCG_CALL_NO_WG, void, env, tl, i32, i32, i32) + DEF_HELPER_1(vfp_get_fpscr, i32, env) DEF_HELPER_2(vfp_set_fpscr, void, env, i32) diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index eb0de080f1..b1065216b2 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -935,3 +935,19 @@ uint32_t HELPER(ror_cc)(CPUARMState *env, uint32_t x, uint32_t i) return ((uint32_t)x >> shift) | (x << (32 - shift)); } } + +void HELPER(probe_access)(CPUARMState *env, target_ulong ptr, + uint32_t access_type, uint32_t mmu_idx, + uint32_t size) +{ + uint32_t in_page = -((uint32_t)ptr | TARGET_PAGE_SIZE); + uintptr_t ra = GETPC(); + + if (likely(size <= in_page)) { + probe_access(env, ptr, size, access_type, mmu_idx, ra); + } else { + probe_access(env, ptr, in_page, access_type, mmu_idx, ra); + probe_access(env, ptr + in_page, size - in_page, + access_type, mmu_idx, ra); + } +} diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 0ee2ef403e..b032829194 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -232,6 +232,19 @@ static void gen_address_with_allocation_tag0(TCGv_i64 dst, TCGv_i64 src) tcg_gen_andi_i64(dst, src, ~MAKE_64BIT_MASK(56, 4)); } +static void gen_probe_access(DisasContext *s, TCGv_i64 ptr, + MMUAccessType acc, int log2_size) +{ + TCGv_i32 t_acc = tcg_const_i32(acc); + TCGv_i32 t_idx = tcg_const_i32(get_mem_index(s)); + TCGv_i32 t_size = tcg_const_i32(1 << log2_size); + + gen_helper_probe_access(cpu_env, ptr, t_acc, t_idx, t_size); + tcg_temp_free_i32(t_acc); + tcg_temp_free_i32(t_idx); + tcg_temp_free_i32(t_size); +} + typedef struct DisasCompare64 { TCGCond cond; TCGv_i64 value;