From nobody Sun Nov 24 13:58:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1722643130; cv=none; d=zohomail.com; s=zohoarc; b=ABfOccgHxsahZdpi92xRn0HSU1p6bsFxsZjPZG0ioc2lPhfhfB2fiUHLpCEGqecVbBd8xE7SHtFM2QqMsKQBi83rPudLoGGEXaBDceFm+a+1qzftbeW1ohHUUzwdwnS3lH+LJo027cziwGIn5qHs21VtqO4FTp4RYzLCiGIovfc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722643130; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zcFCklOxEptK/v+KYBlk+aaUGmJl8I5KUjcP8oU3kVY=; b=CaR3KGI4d7REfynzNkCnanmvZUMZIuK4uzuY1/q1ipmf4yLRAt7Sf6jT1TefIdeisZFXUIe8MV11ZkVe48RlXVHVmOlapA/S4Y3BlHKM9kt6iy4m1ZrkhE7eTuvFYBnrNFQ906zqdjnRbo+meV8QVreXNjrfT1iVwSLcu5Y8ZmY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722643130417724.5938787806883; Fri, 2 Aug 2024 16:58:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sa29o-0002Fr-6x; Fri, 02 Aug 2024 19:58:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sa29k-0001yw-4o for qemu-devel@nongnu.org; Fri, 02 Aug 2024 19:57:56 -0400 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sa29i-0004Iw-Jg for qemu-devel@nongnu.org; Fri, 02 Aug 2024 19:57:55 -0400 Received: by mail-io1-xd2c.google.com with SMTP id ca18e2360f4ac-81f860c6015so357271139f.0 for ; Fri, 02 Aug 2024 16:57:54 -0700 (PDT) Received: from dune.bsdimp.com ([50.253.99.174]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4c8d69a8227sm683131173.47.2024.08.02.16.57.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Aug 2024 16:57:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1722643073; x=1723247873; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zcFCklOxEptK/v+KYBlk+aaUGmJl8I5KUjcP8oU3kVY=; b=2Fi8EXtQ6HRAnNfojg+cnCpCMGSRD1JnurMQMhBkTVfAqc48PaHvoLs5i57Wr8zTED PdcRQUb+cOIEu4Vs4u6L0OqSuARDZRXHbru6ZtyW7IF5YLNYtB8JOSdY5NpZ8BrdfhOr 1A+PHupaJPOEMps0v34mfpDp3Jev73opLDNBicOknQepuntUqIbIMeQqRmTmCJyVKk0N vTfj+a3hHv4ii7iP8Gx3VUAPJxs71E7F3CvgDqvAK/vwc1LRUKeUvwuJwHxjNEBdocR+ b5XEef8iaHr5UYVByUhqPC9OglTytQ88F95B6Y6KsClj8hjOK0Ro9FX48oi4XHGnvnK1 aZTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722643073; x=1723247873; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zcFCklOxEptK/v+KYBlk+aaUGmJl8I5KUjcP8oU3kVY=; b=EsKEDTckcnbgOVYVwIWb9q4VjMYFyM5y06S0W2Bth0USLf3ysdDft0LSo34lRkD9Qn twu+78CPoOM/YLNmgxB5YlB7WtcUIWt8Xr4VfasULEHQn4srm8MCtGLFNxb7iqgzLHD8 vQSm5hH/XacKuW1YwozVIqI66Xto3rEARc+4gdHEglDLlznQrLV1W+h1j2WfhtH55pcD nRw7KaKvsa6+zb5Cj2Hu3t4sDEc4cHAxHujyHBUI9ZtacLzl/F7eG8J3YIBXsGqv4fjN tFxmxMUQCnvLhRUbdamfLrAQhNq9KjiyEl1nEFfFzJ/S2ek7clvMyDHklqrncHBvuGRY D6sw== X-Gm-Message-State: AOJu0Yx4Fbjds2Q9+/Iiu71eusYbhYhM+oG+H62aWordM+IGmJ6q5i2H wYWv9JUaoh9oTrXWMwr2hr4Z5Vm10EMVMR/PgRvc6th3cRJ3ChftTVxykzud2ZBo+cxIbDiqZCg qkMQ= X-Google-Smtp-Source: AGHT+IF+T6AgLY1GQRi4nbq5nPAncJzm//ge4HtzBIoewlabZi/Bxkj8Q7QDmeCMupKHCP+kqJbo0g== X-Received: by 2002:a05:6602:27cf:b0:812:9c27:357c with SMTP id ca18e2360f4ac-81fd43652b4mr808645739f.8.1722643073028; Fri, 02 Aug 2024 16:57:53 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Cc: Warner Losh , Kyle Evans , Jessica Clarke Subject: [PATCH 13/17] bsd-user: target_mprotect: rename prot to target_prot Date: Fri, 2 Aug 2024 17:56:13 -0600 Message-ID: <20240802235617.7971-14-imp@bsdimp.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240802235617.7971-1-imp@bsdimp.com> References: <20240802235617.7971-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::d2c; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @bsdimp-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1722643130986116600 Content-Type: text/plain; charset="utf-8" Linux-user's target_mprotect uses this convention, so move to it. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/mmap.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index ed8d31a9048..d34075c5c64 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -61,16 +61,16 @@ void mmap_fork_end(int child) } =20 /* NOTE: all the constants are the HOST ones, but addresses are target. */ -int target_mprotect(abi_ulong start, abi_ulong len, int prot) +int target_mprotect(abi_ulong start, abi_ulong len, int target_prot) { abi_ulong end, host_start, host_end, addr; int prot1, ret; =20 qemu_log_mask(CPU_LOG_PAGE, "mprotect: start=3D0x" TARGET_ABI_FMT_lx " len=3D0x" TARGET_ABI_FMT_lx " prot=3D%c%c%c\n", start,= len, - prot & PROT_READ ? 'r' : '-', - prot & PROT_WRITE ? 'w' : '-', - prot & PROT_EXEC ? 'x' : '-'); + target_prot & PROT_READ ? 'r' : '-', + target_prot & PROT_WRITE ? 'w' : '-', + target_prot & PROT_EXEC ? 'x' : '-'); if ((start & ~TARGET_PAGE_MASK) !=3D 0) return -EINVAL; len =3D TARGET_PAGE_ALIGN(len); @@ -78,7 +78,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int p= rot) return -ENOMEM; } end =3D start + len; - prot &=3D PROT_READ | PROT_WRITE | PROT_EXEC; + target_prot &=3D PROT_READ | PROT_WRITE | PROT_EXEC; if (len =3D=3D 0) return 0; =20 @@ -87,7 +87,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int p= rot) host_end =3D HOST_PAGE_ALIGN(end); if (start > host_start) { /* handle host page containing start */ - prot1 =3D prot; + prot1 =3D target_prot; for (addr =3D host_start; addr < start; addr +=3D TARGET_PAGE_SIZE= ) { prot1 |=3D page_get_flags(addr); } @@ -104,7 +104,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int= prot) host_start +=3D qemu_host_page_size; } if (end < host_end) { - prot1 =3D prot; + prot1 =3D target_prot; for (addr =3D end; addr < host_end; addr +=3D TARGET_PAGE_SIZE) { prot1 |=3D page_get_flags(addr); } @@ -117,11 +117,11 @@ int target_mprotect(abi_ulong start, abi_ulong len, i= nt prot) =20 /* handle the pages in the middle */ if (host_start < host_end) { - ret =3D mprotect(g2h_untagged(host_start), host_end - host_start, = prot); + ret =3D mprotect(g2h_untagged(host_start), host_end - host_start, = target_prot); if (ret !=3D 0) goto error; } - page_set_flags(start, start + len - 1, prot | PAGE_VALID); + page_set_flags(start, start + len - 1, target_prot | PAGE_VALID); mmap_unlock(); return 0; error: --=20 2.45.1