~funderscore blog cgit wiki get in touch
aboutsummaryrefslogtreecommitdiff
blob: 46c62c0b4461efb6b4b584cf7d721715be4cf58a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright 2020, Heinrich Schuchardt <xypron.glpk@gmx.de>
 */

#include <common.h>
#include <cpu_func.h>
#include <asm/state.h>

void flush_cache(unsigned long addr, unsigned long size)
{
	/* Clang uses (char *) parameters, GCC (void *) */
	__builtin___clear_cache((void *)addr, (void *)(addr + size));
}

void invalidate_icache_all(void)
{
	struct sandbox_state *state = state_get_current();

	/* Clang uses (char *) parameters, GCC (void *) */
	__builtin___clear_cache((void *)state->ram_buf,
				(void *)(state->ram_buf + state->ram_size));
}