From patchwork Fri Jun 5 04:17:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187479 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp2025285ilo; Thu, 4 Jun 2020 21:20:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNOiQkYBnolRITLnPE0zRZWhg/YNtCnMB8xl7jWWS4qeUmAXP7Gp1R4Ct7W2N0p+QR0WEg X-Received: by 2002:a25:cb45:: with SMTP id b66mr12890984ybg.397.1591330810072; Thu, 04 Jun 2020 21:20:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591330810; cv=none; d=google.com; s=arc-20160816; b=gCLV1kJuocfVXIrg+6/hPn6VWQdLlQFdOHkbqd33PaZff5jr2cNW+EYvW/+3BoPzGF Iog5ebHFWcB4kzlgZBJWd7quxdnCJg+G0Vyvek9c9IISLALT/UtWkXz8ur7dx13D6LTv Oi4WiNhDffqzpnu9CrTwSiGBR5a65FddVyStYFOsSlIYwahkY5QVpHl8KJ0o7U2jfkJ2 B2XWDUYfpR4jytZ3cB9pfsMUFuTP1HOjymB8DmHz04WANF4Sm7+d66OBu5xCj4WVZokp uMUEt7scsANyC/j0pUP21h5kSLg04QnfFPAgWjtlfb5BET5bscdisbvpIyYYvdz5N2z6 6oMA== 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=nqqofQziFBqWdXP+8khcoigsyFvMbdt2vH117/pVwFo=; b=QImef1d3h96kjPvns8AxznuPhTQKP+wbIdt6ea9JdVDSm6R45gg2056fNVERu2cGP0 iVgiobwXw1Z3X+fLQBvsVF7WE8/JRXaIfNrmLualAerH2/7Aye8qtWq/HX+6qn51JqWs ChFoGoiNtDjPc1Nqt6GcIA5t88Aj0KzY+h0mt7YJ58F4eO8DMdqybGIHTRG7GlDfF0Ph bvcqXJMSV6jC6yM3t7+vLWD9B3VmXKED3eRiQ/ratnn/R9G6CzojhMYa36IcOBcqIwq4 RSTcjWIhb4HuXjhT6rikrQXQKINZ21r4kFpRih8iy/Qb1JmNb82ecZAhTGslNkRW3cvy opkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xyKzTnUo; 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 w190si6135040ybg.438.2020.06.04.21.20.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Jun 2020 21:20:10 -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=xyKzTnUo; 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]:46128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jh3px-00007R-Fv for patch@linaro.org; Fri, 05 Jun 2020 00:20:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jh3na-0004G4-JM for qemu-devel@nongnu.org; Fri, 05 Jun 2020 00:17:42 -0400 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]:52419) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jh3nZ-0000jW-SK for qemu-devel@nongnu.org; Fri, 05 Jun 2020 00:17:42 -0400 Received: by mail-pj1-x1041.google.com with SMTP id k2so2054723pjs.2 for ; Thu, 04 Jun 2020 21:17:41 -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=nqqofQziFBqWdXP+8khcoigsyFvMbdt2vH117/pVwFo=; b=xyKzTnUoermMpUwPDDOvda0xWv7DakzouPKnECbhodlQTTmqQHY3y5wDHVpNUkudKc 5nZMV4J5d3QeKHmtH/WKEU8h8mGbFhgS+qjoJx7OmYNf1/ZSHSavCutMk74RS2TDX1IU IlXPdq1uDZlj9vKIDz/fW+nFGTrbkqf/cBZv0rkNYXliiE7aT/Nk2gSIBzi2UA+Lxu6q mYHxAn5sKl/AuOASnN5mNnjdi5BPyY9USNVxBH51SPKnDiSvQDGCP9Z5URJQsp46kbHh g+Er9rkYF9X1iR0svgXb0JeAR9ONRR1ZVL3padv8JVnV4D8e2NPSn1azB4JzoCgR7ffa hcYw== 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=nqqofQziFBqWdXP+8khcoigsyFvMbdt2vH117/pVwFo=; b=mGQomlIZX227NHPiPoAoV/x8nrnCaIEUepyTeUVnwE4qkofurAu0mq0pz7zAKwF+CV qvX9jpsILILaWmFpbD+o2vOY/6JDMtlfOBYEzPpMloC859VGpYDFiY7dgMrAgJqUjMLH /km6mngLuQuyDKofnIM1wOKG9xTki3iGq1xIBT7yH8/f/zirNY7qaGC/HJfI9We2M7xO DcfGt8lGUzT7914kyoeo2i78bMq4FWLpK0WYV9fotoCfLuq94rA62UYQ/09p4lha7oNr NaKMvfi8HUyLq9kRGBTAIYyZJ0wy/lmi56FO8oQnrhv1dGYiuqMjWx61F6aVBZ0IfJcd px0A== X-Gm-Message-State: AOAM530JOdSusFpEvyr2/WhCzT8nDYKwF3ZGcESBCGtWINLGeTHaTEQi 82B8ZLY32KRL4Vq/hPVIKUm/MEkjRFk= X-Received: by 2002:a17:90a:17ed:: with SMTP id q100mr740057pja.80.1591330660238; Thu, 04 Jun 2020 21:17:40 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2020 21:17:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 04/17] linux-user: Tidy VERIFY_READ/VERIFY_WRITE Date: Thu, 4 Jun 2020 21:17:20 -0700 Message-Id: <20200605041733.415188-5-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::1041; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1041.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 --- linux-user/qemu.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 2bf35e66ac..a8dde8c609 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -464,8 +464,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) { @@ -477,9 +477,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.