1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright 2020, Heinrich Schuchardt <xypron.glpk@gmx.de>
4  */
5 
6 #include <common.h>
7 #include <cpu_func.h>
8 #include <asm/state.h>
9 
flush_cache(unsigned long addr,unsigned long size)10 void flush_cache(unsigned long addr, unsigned long size)
11 {
12 	/* Clang uses (char *) parameters, GCC (void *) */
13 	__builtin___clear_cache((void *)addr, (void *)(addr + size));
14 }
15 
invalidate_icache_all(void)16 void invalidate_icache_all(void)
17 {
18 	struct sandbox_state *state = state_get_current();
19 
20 	/* Clang uses (char *) parameters, GCC (void *) */
21 	__builtin___clear_cache((void *)state->ram_buf,
22 				(void *)(state->ram_buf + state->ram_size));
23 }
24