From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by sourceware.org (Postfix) with ESMTPS id C84223857C77 for ; Mon, 14 Dec 2020 11:43:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C84223857C77 Received: by mail-wr1-x441.google.com with SMTP id r7so16147666wrc.5 for ; Mon, 14 Dec 2020 03:43:57 -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=Duu0tFo0BYN5uj6dURuetdL16PH4j+9j2ppt0P47uAQ=; b=senT4MblsdsFohdtYbwEd0SvH2/WVz6WYezYjnDWpg1xZGC5aZbpATq+aYw9GVFFaf ZyzZJUIbyiOh08nqZ0HPI0ZNX4LVXnF61QvTAG6iO4OlWLxgxLjycKYFsmigJxwF//pv hj7FcpuGqJCYxKxBHUWYg0+pkNaesm2BCjaf/f54XACY8TRlhdqJVe4O+qPCSBHLLPoY jSiskFXDdPTWbJF/zbsaGibejIex3jtNJNIeLtXQ/b42Vav68Els60pLPhkP5BmHR/rY wOo3oohDWu4av0SjdttzRqnCBDGJsXJVQRWmrRy+rLBJhwq1+03YaFVdg/bAVbzZNF1V V9KQ== X-Gm-Message-State: AOAM5323TJOSVi3K8MBsxflZ7S9+pa5Ec7ol+wMfBfIppz8aZSUf0s4c 9HaJgY+ZR4vVJAnpmgO15Wg= X-Google-Smtp-Source: ABdhPJxsLEA1x2BvX2Vfv0PWw5ZALM5wpjW+lZrR3OZvh23vfIoL8ABymDaKKnKOm5kmY/zsMlVxdQ== X-Received: by 2002:a5d:4d02:: with SMTP id z2mr29370287wrt.109.1607946236907; Mon, 14 Dec 2020 03:43:56 -0800 (PST) Received: from debian.vlc ([170.253.51.130]) by smtp.gmail.com with ESMTPSA id w18sm11738403wrn.2.2020.12.14.03.43.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Dec 2020 03:43:56 -0800 (PST) From: Alejandro Colomar To: Michael Kerrisk , Dave Martin , Heinrich Schuchardt , linux-man@vger.kernel.org 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 v5] cacheflush.2: Document __builtin___clear_cache() as a more portable alternative Date: Mon, 14 Dec 2020 12:43:07 +0100 Message-Id: <20201214114306.10784-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.4 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: Mon, 14 Dec 2020 11:43:59 -0000 Reported-by: Heinrich Schuchardt Signed-off-by: Alejandro Colomar --- 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 : +Until GCC 9.1.0, +the prototype for this built-in function used +.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