From patchwork Fri Feb 12 18:48:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 381867 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp3191985jah; Fri, 12 Feb 2021 11:13:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJw4vd9Z+kT9wUhEK0DC4qqb6UGQnxg7mi3ODusPl8jmDe4D5IblQqw1Lvgk/msuEkt7TtIf X-Received: by 2002:a25:b9cf:: with SMTP id y15mr5987035ybj.43.1613157226476; Fri, 12 Feb 2021 11:13:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613157226; cv=none; d=google.com; s=arc-20160816; b=vTB7Jg0JyLISC86orStHw44xOcPCovIqA1aI9lYH476O1OXeZb27ZOaqWNC6Ve/BPA VyMhIReS/3BbV6e1rVTQKWGERDmlqwAO5wfIdX+gV+rcRKssB6CCXtLRLpLiJsTcBHrH CPzjFiVfIdsIE3Dk2/ujmS55yY72BA8yun8XJb+zR4Cl+SqBZZ5PpOQQ7x8RSHChQvDE a+4Y5dqbUqSH/z5aOd6puHrSrfLyLNHmQ9ANqI63mWZKQhPLk4spp6O62AYgLjVvRnCG tvnb//RT79bRFt+nGwPXYk3LzB2qhKUrltvrN8xSuXkGIYmHOHfW+x6s4vI0HCUXh+Du ZYPg== 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=VyGOgXRVYXE4KsV9afYsCBAI5eV0Qm7bovPtD8hErTQ=; b=jUGql0KOom/vVjnS5uEsUH/lQybiMgn8W13oHVD/jYmacTzMEVu1Y4SqzkjwpdJc+z mns1Xco+PvOHyF/VDkvpRWd0wwurD1/T5DeUuGu3bI8+fKkrj+EkjdMqzKVHBvPLd3oQ RoUmkpFLBwwDr2ebYEsB/wGStWCxWNT0hqp/RO8NUIlY7OLeZIzj7ulFJzuIRDJp+BjN gIrEl0UNBkyH7nneEslYCONLfYcA+uRe9JAl3/ngk67lvEuy0+LgjYwvML8jMguR66wX Kg18A98wpvrKUWDI1JKw9rmVSP72CIqyYH0SpR++hZbHfuNZ0iwigFVkoMKChWP+PAnj w38Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DlQ9nXFo; 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 n71si8077998ybn.278.2021.02.12.11.13.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Feb 2021 11:13:46 -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=pass header.i=@linaro.org header.s=google header.b=DlQ9nXFo; 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]:33162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAdsv-0005QE-TE for patch@linaro.org; Fri, 12 Feb 2021 14:13:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAdVO-0001bB-Df for qemu-devel@nongnu.org; Fri, 12 Feb 2021 13:49:27 -0500 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:36328) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lAdVG-0007m2-1C for qemu-devel@nongnu.org; Fri, 12 Feb 2021 13:49:25 -0500 Received: by mail-pl1-x630.google.com with SMTP id e9so327439plh.3 for ; Fri, 12 Feb 2021 10:49:14 -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=VyGOgXRVYXE4KsV9afYsCBAI5eV0Qm7bovPtD8hErTQ=; b=DlQ9nXFood1iSmBqjhhD9Nlo3i+GQYdJ0P9SaBRww/pda8UxNta4ePWy4qhwKhzcD/ spPPVRRH+cBhvxL+RBKWAEj4p216Dw6I8veebOL6nqV8ieHTeapq7TpIlq1j6/OCQNll frf/wWCn5TAeQO3y0c87TH3PvQvRx0JIt4bimlFLmj/Hzm0rxRYZbyb8hcjafdUizG1e lQ+aISuChOVEsuWvWBwDLBhINt8t0N9lReEEWhFIDOP80YxGxKkmY9X7WPZEszIjdfZZ 89vc75j64zGqwVjA77rMonVXyJHGkKt7hsO5syClZ1TS9vnZNpLHll8azav1g9frQ5HO ZjXg== 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=VyGOgXRVYXE4KsV9afYsCBAI5eV0Qm7bovPtD8hErTQ=; b=kZqUxG65w3ixaO/GYPErZE0Lys5Bl6zimlkbFHEbJ1cYRYoyAxdBzideyJ5wNwq4Pc hf8kjYcwsghLYr3oOgw0f9QC5inyn18HP+dccwDiOCs9eSsSQ2PI9DseRsWLKvSbyYEO 8RD8Nh3BXIs3d9Y4QpvcwHRD5JrkHbJNv9Roq67pc37ImnQqVzmo5NTGVzkQHJrjHXdm Rnjb0hUCxyscgLs4cwLKfR6RXw4eYZ4BOO7jcW/aPZ9FDEFzcmcBxXxzM5GOsvunUwEW frMBYcHP7knj3q/TXGhWUgfl0CGqWfPExbyv7HtMUINUcxc0jqVxHnPLTeC/Unvo5dC9 /oxA== X-Gm-Message-State: AOAM531DgxLD3r3aShph6mVZMfQ398IV+sNTXuQsUzQMW5FY5mpTtuhU /J2zfwwHDYv1/T4A1V2L/nY6+cUDodzRxA== X-Received: by 2002:a17:90b:4a8c:: with SMTP id lp12mr3890918pjb.214.1613155753476; Fri, 12 Feb 2021 10:49:13 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id k5sm9427618pfi.31.2021.02.12.10.49.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Feb 2021 10:49:12 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v7 07/31] linux-user: Tidy VERIFY_READ/VERIFY_WRITE Date: Fri, 12 Feb 2021 10:48:38 -0800 Message-Id: <20210212184902.1251044-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212184902.1251044-1-richard.henderson@linaro.org> References: <20210212184902.1251044-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.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 441ba6a78b..9251337daf 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -488,8 +488,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) { @@ -501,9 +501,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.