From patchwork Fri Jun 5 04:17:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187478 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp2025233ilo; Thu, 4 Jun 2020 21:20:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzL864i4QtS2s9nOEHnJVtwkPbfvyzyOYF0zGM6FAI0P0nGo5ZTdLyszLK5bwzs3+RQ7w5q X-Received: by 2002:a25:1e0b:: with SMTP id e11mr13942862ybe.440.1591330803170; Thu, 04 Jun 2020 21:20:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591330803; cv=none; d=google.com; s=arc-20160816; b=QRDc4PnU7bAtnX8HCRgbtK2v3bdljBaZ7NJC4REW85LInQdImvwVtueXa5qM9V3gWJ LOgC8yCXNZq+gZawRMVaLcfse0y7dRFsF9uAOMggjfc+9n9LFsM0XqkDWKmTcj+EW+ou J28fuFfLcqHkQxCVBvCJyTIRvR59rnrKYkk9PbHoNRn+fiiKAYyBTZrxaY3987nVW2r9 wb8gU8wwVbny9tuebF/PazPfvBIQ/4QP9cg8QaHG4Vx91qs/XWH/UiwQrySeR4TOT+jo uw/AhguQIkz2FOjN45aCgB12HI1Lt6TozDhgqXNejlW97AQiH6egcwUoW5oEkqQuvOmB JNjA== 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=OQXnnFtOsPYN4aWlItYREcPDVPLVM/BSGRYhyFhu/u4=; b=cHg76pJKZimFzUiQwY6cx+6h7gTrIYFlPZWv2reVy9mGah6Hwx/gh7b1y2V344ckOb O2FKUjYZwyq5jBsO+zQPm5sEkXz4ePo2o2nNXWxGtpM6Ud4V2ZthQS3i5IOzH8xKYZcf jNvk/gK3CcJwFUU2WMvp/PKyc0tdorjiJtvh8/nnQnlA/iz4YRQmZNZtiL+3xbuCwrKo IfHVZRhK2UiE/E69GhUV+9Oq625hwzk2/yafboqWHhQarTyMQvPo1ysquEB/aC5NVLVR 0f+h6slfbu2pTvjqudfBYqPx01dqehLFbrkPPP3yCmLDcKo+6XjM09jFqQlkgSvwQhCu 9yPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=O9JjXFcZ; 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 h27si3427866ybj.396.2020.06.04.21.20.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Jun 2020 21:20:03 -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=O9JjXFcZ; 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]:45382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jh3pq-0008F3-Hd for patch@linaro.org; Fri, 05 Jun 2020 00:20:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jh3nb-0004Jl-RC for qemu-devel@nongnu.org; Fri, 05 Jun 2020 00:17:43 -0400 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:52421) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jh3nb-0000jq-3V for qemu-devel@nongnu.org; Fri, 05 Jun 2020 00:17:43 -0400 Received: by mail-pj1-x1043.google.com with SMTP id k2so2054748pjs.2 for ; Thu, 04 Jun 2020 21:17:42 -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=OQXnnFtOsPYN4aWlItYREcPDVPLVM/BSGRYhyFhu/u4=; b=O9JjXFcZnzH+YSBGRYdrGc/qCUzYaB6ZiEjMWnVqQCxxz/otE7MxzOQ/JMz9Y/Vw2D vnZd1Y2L/BM+yysvq91YzkFaUeTm3RZEDPqDKFilOIRiQ94V9s7GUFwsglPG7EeKEJm9 grNbCjVQzE5Gi5+40pNdAxL8GG1Nre4Zfvsj3vPNWixXe3Y/26ynnUzoo3qP5XoXVY93 eQy+1ClaHRVdRN7oTRgBHzjarax1ikbC4EfUrtEO116zJ0B51SeZx+Oit4FBgc7hcfYW j6sk6brBir2LeNo0J3XYoKcb/MpT0ObBcBKdlg2ZCsZeIXUVD29MxDZWV7i60sojO8XP 6Crw== 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=OQXnnFtOsPYN4aWlItYREcPDVPLVM/BSGRYhyFhu/u4=; b=J9mM6sWiH4iEZ9OHYBSCf+nPOv1XgLUi5Mba7wfvRqyIEU1bD/5hky+S12skFlT3vi ytimQCArHjrgh8ONpDsynO9xr17krpOXN91U1Op3dOgq7ReNdMKIy72S4rFfQ3WnXDiJ lLCvUuskdTP2LRu4Pwk13xZ4bQ5hp6DH/sLA20xUjIFqwUDUKGRwJar0WAivi6X8rBDw eavu522OBCzFrsIRii5zqEatGUdHQT0GBL2KAKXjxzZW+OliGU134TEDZXg55smncOOJ PAgKzYsB/3+7OZeqgMFnCc/9cXRPbnfCn7XhnApWNdVexjWuiOo8EdGnrMWyhqpW18Nk x3Iw== X-Gm-Message-State: AOAM533Z90qvyILRhlx1ddLugZ/5ZOcti6hLMfesnpMwrQeXD32WyBCX 8wkO+A6X7zACSX7CKs66UMlN9+1vpw8= X-Received: by 2002:a17:90a:9604:: with SMTP id v4mr768386pjo.198.1591330661509; Thu, 04 Jun 2020 21:17:41 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id h15sm5440902pgl.12.2020.06.04.21.17.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2020 21:17:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 05/17] bsd-user: Tidy VERIFY_READ/VERIFY_WRITE Date: Thu, 4 Jun 2020 21:17:21 -0700 Message-Id: <20200605041733.415188-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200605041733.415188-1-richard.henderson@linaro.org> References: <20200605041733.415188-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1043; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1043.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" 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. Signed-off-by: Richard Henderson --- bsd-user/qemu.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index f8bb1e5459..4076adabd0 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -218,13 +218,12 @@ extern unsigned long x86_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 int access_ok(int type, abi_ulong addr, abi_ulong size) +static inline bool access_ok(int type, abi_ulong addr, abi_ulong size) { - 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. */