diff mbox series

[v2,1/5] util/cacheflush: Use declarations from <OSCacheControl.h> on Darwin

Message ID 20230605175647.88395-2-philmd@linaro.org
State Superseded
Headers show
Series bulk: Do not declare function prototypes using 'extern' keyword | expand

Commit Message

Philippe Mathieu-Daudé June 5, 2023, 5:56 p.m. UTC
Per the cache(3) man page, sys_icache_invalidate() and
sys_dcache_flush() are declared in <libkern/OSCacheControl.h>.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 util/cacheflush.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Richard Henderson June 5, 2023, 7:19 p.m. UTC | #1
On 6/5/23 10:56, Philippe Mathieu-Daudé wrote:
> Per the cache(3) man page, sys_icache_invalidate() and
> sys_dcache_flush() are declared in <libkern/OSCacheControl.h>.
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   util/cacheflush.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

I'll note that a comment in OSCacheControl.h says that sys_icache_invalidate performs both 
dcache and icache flush, and so we don't need to call sys_dcache_flush.


r~
diff mbox series

Patch

diff --git a/util/cacheflush.c b/util/cacheflush.c
index 06c2333a60..de35616718 100644
--- a/util/cacheflush.c
+++ b/util/cacheflush.c
@@ -237,8 +237,8 @@  static void __attribute__((constructor)) init_cache_info(void)
 
 #ifdef CONFIG_DARWIN
 /* Apple does not expose CTR_EL0, so we must use system interfaces. */
-extern void sys_icache_invalidate(void *start, size_t len);
-extern void sys_dcache_flush(void *start, size_t len);
+#include <libkern/OSCacheControl.h>
+
 void flush_idcache_range(uintptr_t rx, uintptr_t rw, size_t len)
 {
     sys_dcache_flush((void *)rw, len);