change debug_out format of addr to JZ_FMT_plx
[qemu/qemu-JZ.git] / cache-utils.h
blob8847dbbf7b067a46ab4de7958eec71ab3baace3b
1 #ifndef QEMU_CACHE_UTILS_H
2 #define QEMU_CACHE_UTILS_H
4 #include "config-host.h"
6 #if defined HOST_PPC || defined HOST_PPC64
7 struct qemu_cache_conf {
8 unsigned long dcache_bsize;
9 unsigned long icache_bsize;
12 extern struct qemu_cache_conf qemu_cache_conf;
14 extern void qemu_cache_utils_init(char **envp);
16 /* mildly adjusted code from tcg-dyngen.c */
17 static inline void flush_icache_range(unsigned long start, unsigned long stop)
19 unsigned long p, start1, stop1;
20 unsigned long dsize = qemu_cache_conf.dcache_bsize;
21 unsigned long isize = qemu_cache_conf.icache_bsize;
23 start1 = start & ~(dsize - 1);
24 stop1 = (stop + dsize - 1) & ~(dsize - 1);
25 for (p = start1; p < stop1; p += dsize) {
26 asm volatile ("dcbst 0,%0" : : "r"(p) : "memory");
28 asm volatile ("sync" : : : "memory");
30 start &= start & ~(isize - 1);
31 stop1 = (stop + isize - 1) & ~(isize - 1);
32 for (p = start1; p < stop1; p += isize) {
33 asm volatile ("icbi 0,%0" : : "r"(p) : "memory");
35 asm volatile ("sync" : : : "memory");
36 asm volatile ("isync" : : : "memory");
39 #else
40 #define qemu_cache_utils_init(envp) do { (void) (envp); } while (0)
41 #endif
43 #endif /* QEMU_CACHE_UTILS_H */