From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by sourceware.org (Postfix) with ESMTPS id 4A0083857804 for ; Tue, 15 Dec 2020 13:30:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4A0083857804 Received: by mail-wm1-x341.google.com with SMTP id 3so18496937wmg.4 for ; Tue, 15 Dec 2020 05:30:43 -0800 (PST) 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=hViOtnvGY+4JO9VZW4NA9Ghhzl7JHbPghEwPrt1jtVA=; b=i5gYluPuOO1+TxEi+WMSQtiNzkL8eG8RK5FRL9cNMY9/NQY+tHa8UYOhVOGjcF2wkn OvDYS1Ro7hP8ZqqP3mXRbGfW0QMOAC/UayoUN0HLxbpsPbAuEo/m7TyxA9lPAXZxv99r S15lghxfOpPNQ6H10f+MJ99chDblPV2uhJPxIBKXvh6wMchhCLyFbmQjgz06ex0aqf3E yUeem+ONxLuDLb7u1Sk7Hszb1L3wb3sSoAIhkYVTrwUwzA98OUxAuB06yjHUNFq+NSXm 0PQPqltC1eoNwXMhAN3Ha+QohvWxe03mSGjz8mxQlvBvFIYnNa9OwUIkRTY9d3ltqyLj P8aA== X-Gm-Message-State: AOAM532umIEoI400oT3ivK7LyfTd2kEShTR5kKzsVeyEOjJ73YYpOHLy yScTolUPvINTSp+sbkYPM0o= X-Google-Smtp-Source: ABdhPJxu0j/rXyBcT8i0pqy+eH/ROTi4+4c71h3L9WrE4dLOb7tZam/y9JAqsyWuoSkrUgKVrypPgQ== X-Received: by 2002:a1c:40c:: with SMTP id 12mr32319066wme.40.1608039042332; Tue, 15 Dec 2020 05:30:42 -0800 (PST) Received: from debian.vlc ([170.253.51.130]) by smtp.gmail.com with ESMTPSA id z8sm36888479wmg.17.2020.12.15.05.30.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Dec 2020 05:30:41 -0800 (PST) From: Alejandro Colomar To: Michael Kerrisk , Dave Martin , Heinrich Schuchardt , linux-man@vger.kernel.org, Martin Sebor Cc: Alejandro Colomar , Vineet Gupta , linux-snps-arc@lists.infradead.org, Guo Ren , linux-csky@vger.kernel.org, Thomas Bogendoerfer , linux-mips@vger.kernel.org, Nick Hu , Greentime Hu , Vincent Chen , gcc-patches@gcc.gnu.org, cfe-users@lists.llvm.org, cfe-dev@lists.llvm.org Subject: [PATCH v6] cacheflush.2: Document __builtin___clear_cache() as a more portable alternative Date: Tue, 15 Dec 2020 14:30:20 +0100 Message-Id: <20201215133019.14411-1-alx.manpages@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Dec 2020 13:30:44 -0000 Reported-by: Heinrich Schuchardt Signed-off-by: Alejandro Colomar Cc: Martin Sebor Cc: Dave Martin --- v6: - GCC has always exposed 'void *', as Martin Sebor noted. It's Clang (and maybe others) that (following GCC's docs) exposed 'char *'. man2/cacheflush.2 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/man2/cacheflush.2 b/man2/cacheflush.2 index aba625721..7a2eed506 100644 --- a/man2/cacheflush.2 +++ b/man2/cacheflush.2 @@ -86,6 +86,30 @@ On Linux, this call first appeared on the MIPS architecture, but nowadays, Linux provides a .BR cacheflush () system call on some other architectures, but with different arguments. +.SH NOTES +Unless you need the finer grained control that this system call provides, +you probably want to use the GCC built-in function +.BR __builtin___clear_cache (), +which provides a portable interface +across platforms supported by GCC and compatible compilers: +.PP +.in +4n +.EX +.BI "void __builtin___clear_cache(void *" begin ", void *" end ); +.EE +.in +.PP +On platforms that don't require instruction cache flushes, +.BR __builtin___clear_cache () +has no effect. +.PP +.IR Note : +On some GCC-compatible compilers, +the prototype for this built-in function uses +.I char * +instead of +.I void * +for the parameters. .SH BUGS Linux kernels older than version 2.6.11 ignore the .I addr -- 2.29.2