From patchwork Fri Jan 15 22:46:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 363804 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp279057jap; Fri, 15 Jan 2021 15:04:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzY8GDXXbIJKUI8Z1Crp2H1falkVee/Wmp6W9ZgBuv6eDKuyIfeI4awAM6GFcuI8Q5bzcpR X-Received: by 2002:a25:538a:: with SMTP id h132mr21010452ybb.247.1610751882124; Fri, 15 Jan 2021 15:04:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610751882; cv=none; d=google.com; s=arc-20160816; b=nWkGN3d+5ykFuzj3hJeyiYW3PlYRzcJ8fUvAK89rtu1XsGg6sYVwhrNfwuGuHvW4Me 481JytTiczfsKVfCvAri8bhC3TTN/rtQUeO51gLfNU1tYP1fQJMJQTWWQ8/idYqyHLsg QlxYFlxe5LSXIv1Qlwp8fA6stTPzuaeUCkKkEnfsUFx/Xeane5k79FgA+L0Ni3wdpI+W nwBvR497hEa+b3taf9m/FoHp9mjCcu7ktODCbmJGOR+pFh8YSA1bhJqwnScdt+c+WuV6 /xDwk/s57qiVI+eLsEW1iOZq+qv/hItz23e5BNyx0y6/noLFdw1I5KYgogbjDCRMWh2S +cBQ== 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=qD60vJJte7K6bQArBY0DduIczHDfCgP2vdEmcn/7+GI=; b=D+mktINJKJkFX28D/ew13iAaXPMjj+1Nq7PD3KbsoNRQ5t+WbBfqq5tsdSAFwhc+qZ K0pCTdo/YPc4kMwHuAhw8KCs4gsWQ4aeq83xPuQyUBNo+Trodn0p3Zr/QZ7C6vO7s32i StDqxG2TJD94+ToeBM7Qs8roTVTgiwrkrUPnog47HbnACN7mxn6CMteBi3GLKvfoOwm9 woC4RVtBHgW+Mqy4f8NTyuZyVp7uo30ovtd+L9W48/ODphH1pPC/hrr4lSOnm5frYTam G2iyzEcqt2cN4fvs3bEicliacN88GR/8Pi/XXhNVRlGkRm8RwLhdZyZjT/1W6VEsMVJV 51vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YwlZV9wY; 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 x3si9609259ybn.333.2021.01.15.15.04.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Jan 2021 15:04:42 -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=YwlZV9wY; 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]:59124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0Y93-0002Yb-Gt for patch@linaro.org; Fri, 15 Jan 2021 18:04:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0XsC-0003ZL-8s for qemu-devel@nongnu.org; Fri, 15 Jan 2021 17:47:17 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:40208) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l0Xs0-0005EL-2P for qemu-devel@nongnu.org; Fri, 15 Jan 2021 17:47:16 -0500 Received: by mail-pl1-x62c.google.com with SMTP id q4so5444449plr.7 for ; Fri, 15 Jan 2021 14:47:00 -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=qD60vJJte7K6bQArBY0DduIczHDfCgP2vdEmcn/7+GI=; b=YwlZV9wYAP5Rt/Z+Xt+EGN2PHf3ePFuoh8BcVKwFszB6IR8/OymngxewUfx0X8pjZ8 QQvfRKPY3qi3o3MQH6vejNAIvBoa+ZaC8E7cCs/k77dMnDp7eR6Ww6V2vtMrtxDEowlo o+dw87Dx3tAv1XLvTtH/HBSCoDy2z64DrCPajZ7tf2ZPX3OGUE3/lukbVPDX+uQ8uGrq f22EJjUFiSRXNyh+O9PraGYGWI5ffY76jdBR1rm8eF5//l+vlAla7h9LLzpXRmKILq1q x1KXup0FOSq++Kl0tlOogZNFskRAZ2a0imbe2c+/mRIhAUb4J6wUH2fWsXh3DLZI+G+q LTiQ== 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=qD60vJJte7K6bQArBY0DduIczHDfCgP2vdEmcn/7+GI=; b=oLKPrd9veOUjtSYSONKNS1X5QF+i6cUUpuXfXItjuyp5lGR6ndEeHardP2JsNv667P uQmh7wK+Bf4ovLvRjBiOjHwQn5POVRhOYx/+z9QWS5Vc+tqR6UqvYBKPr20qO9RRsFhz fpjCk3j7VkA/3+bnHt4EOi0xdbjawYQGuTf66hVtVW6NYsNcFURHo7kr1mk1/bgMYDC8 16l5FPPRWF76hdvcpNeuvf2MXIswO8Tu7RhisztO/Jj/raoY+s4prssyPLXyutdWslqA W43X2tsIPKLfukZm0o2QiMvwV5rweWapK170dxBt2QbwvZqC0THyQv+Cr3wtoSz+q9dH AriQ== X-Gm-Message-State: AOAM531O9MIuRpQ5Ch3DH4E7llkMBXyWuedkrl+SNa3f5ZRoEFUW1sgR dXiHMOPZHk3NGb8WHGKa8ZIKDnpggxabjm+E X-Received: by 2002:a17:902:7086:b029:dc:8d:feab with SMTP id z6-20020a1709027086b02900dc008dfeabmr14921287plk.22.1610750820068; Fri, 15 Jan 2021 14:47:00 -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 s13sm9521700pfd.99.2021.01.15.14.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 14:46:59 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 07/21] linux-user: Tidy VERIFY_READ/VERIFY_WRITE Date: Fri, 15 Jan 2021 12:46:31 -1000 Message-Id: <20210115224645.1196742-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210115224645.1196742-1-richard.henderson@linaro.org> References: <20210115224645.1196742-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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" These constants are only ever used with access_ok, and friends. Rather than translating them to PAGE_* bits, let them equal the PAGE_* bits to begin. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/qemu.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) -- 2.25.1 diff --git a/linux-user/qemu.h b/linux-user/qemu.h index a0f670832e..329a6de669 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -486,8 +486,8 @@ extern unsigned long guest_stack_size; /* user access */ -#define VERIFY_READ 0 -#define VERIFY_WRITE 1 /* implies read access */ +#define VERIFY_READ PAGE_READ +#define VERIFY_WRITE (PAGE_READ | PAGE_WRITE) static inline bool access_ok(int type, abi_ulong addr, abi_ulong size) { @@ -499,9 +499,7 @@ static inline bool access_ok(int type, abi_ulong addr, abi_ulong size) !guest_addr_valid(addr + size - 1))) { return false; } - return page_check_range((target_ulong)addr, size, - (type == VERIFY_READ) ? PAGE_READ : - (PAGE_READ | PAGE_WRITE)) == 0; + return page_check_range((target_ulong)addr, size, type) == 0; } /* NOTE __get_user and __put_user use host pointers and don't check access.