6 int _flush_cache(void *addr
, int len
, int op
)
8 return syscall(SYS_cacheflush
, addr
, len
, op
);
10 weak_alias(_flush_cache
, cacheflush
);
14 int __cachectl(void *addr
, int len
, int op
)
16 return syscall(SYS_cachectl
, addr
, len
, op
);
18 weak_alias(__cachectl
, cachectl
);
21 #ifdef SYS_riscv_flush_icache
23 #define VDSO_FLUSH_ICACHE_SYM "__vdso_flush_icache"
24 #define VDSO_FLUSH_ICACHE_VER "LINUX_4.5"
26 static void *volatile vdso_func
;
28 static int flush_icache_init(void *start
, void *end
, unsigned long int flags
)
30 void *p
= __vdsosym(VDSO_FLUSH_ICACHE_VER
, VDSO_FLUSH_ICACHE_SYM
);
31 int (*f
)(void *, void *, unsigned long int) =
32 (int (*)(void *, void *, unsigned long int))p
;
33 a_cas_p(&vdso_func
, (void *)flush_icache_init
, p
);
34 return f
? f(start
, end
, flags
) : -ENOSYS
;
37 static void *volatile vdso_func
= (void *)flush_icache_init
;
39 int __riscv_flush_icache(void *start
, void *end
, unsigned long int flags
)
41 int (*f
)(void *, void *, unsigned long int) =
42 (int (*)(void *, void *, unsigned long int))vdso_func
;
44 int r
= f(start
, end
, flags
);
46 if (r
!= -ENOSYS
) return __syscall_ret(r
);
49 weak_alias(__riscv_flush_icache
, riscv_flush_icache
);