Heinrich Schuchardt | 47c5e19 | 2020-12-09 19:42:44 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright 2020, Heinrich Schuchardt <xypron.glpk@gmx.de> |
| 4 | */ |
| 5 | |
Heinrich Schuchardt | 47c5e19 | 2020-12-09 19:42:44 +0100 | [diff] [blame] | 6 | #include <cpu_func.h> |
| 7 | #include <asm/state.h> |
| 8 | |
| 9 | void 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 | |
| 15 | void 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 | } |