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