Commit 03daf0e361d58eb5a6d8ea9963ca63f919c15f85
1 parent
d219f7e7
moved cache flush to dyngen header
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@235 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
76 additions
and
0 deletions
dyngen.h
| ... | ... | @@ -18,6 +18,82 @@ |
| 18 | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | +int __op_param1, __op_param2, __op_param3; | |
| 22 | +int __op_jmp0, __op_jmp1; | |
| 23 | + | |
| 24 | +#ifdef __i386__ | |
| 25 | +static inline void flush_icache_range(unsigned long start, unsigned long stop) | |
| 26 | +{ | |
| 27 | +} | |
| 28 | +#endif | |
| 29 | + | |
| 30 | +#ifdef __s390__ | |
| 31 | +static inline void flush_icache_range(unsigned long start, unsigned long stop) | |
| 32 | +{ | |
| 33 | +} | |
| 34 | +#endif | |
| 35 | + | |
| 36 | +#ifdef __ia64__ | |
| 37 | +static inline void flush_icache_range(unsigned long start, unsigned long stop) | |
| 38 | +{ | |
| 39 | +} | |
| 40 | +#endif | |
| 41 | + | |
| 42 | +#ifdef __powerpc__ | |
| 43 | + | |
| 44 | +#define MIN_CACHE_LINE_SIZE 8 /* conservative value */ | |
| 45 | + | |
| 46 | +static void inline flush_icache_range(unsigned long start, unsigned long stop) | |
| 47 | +{ | |
| 48 | + unsigned long p; | |
| 49 | + | |
| 50 | + p = start & ~(MIN_CACHE_LINE_SIZE - 1); | |
| 51 | + stop = (stop + MIN_CACHE_LINE_SIZE - 1) & ~(MIN_CACHE_LINE_SIZE - 1); | |
| 52 | + | |
| 53 | + for (p = start; p < stop; p += MIN_CACHE_LINE_SIZE) { | |
| 54 | + asm volatile ("dcbst 0,%0" : : "r"(p) : "memory"); | |
| 55 | + } | |
| 56 | + asm volatile ("sync" : : : "memory"); | |
| 57 | + for (p = start; p < stop; p += MIN_CACHE_LINE_SIZE) { | |
| 58 | + asm volatile ("icbi 0,%0" : : "r"(p) : "memory"); | |
| 59 | + } | |
| 60 | + asm volatile ("sync" : : : "memory"); | |
| 61 | + asm volatile ("isync" : : : "memory"); | |
| 62 | +} | |
| 63 | +#endif | |
| 64 | + | |
| 65 | +#ifdef __alpha__ | |
| 66 | +static inline void flush_icache_range(unsigned long start, unsigned long stop) | |
| 67 | +{ | |
| 68 | + asm ("imb"); | |
| 69 | +} | |
| 70 | +#endif | |
| 71 | + | |
| 72 | +#ifdef __sparc__ | |
| 73 | + | |
| 74 | +static void inline flush_icache_range(unsigned long start, unsigned long stop) | |
| 75 | +{ | |
| 76 | + unsigned long p; | |
| 77 | + | |
| 78 | + p = start & ~(8UL - 1UL); | |
| 79 | + stop = (stop + (8UL - 1UL)) & ~(8UL - 1UL); | |
| 80 | + | |
| 81 | + for (; p < stop; p += 8) | |
| 82 | + __asm__ __volatile__("flush\t%0" : : "r" (p)); | |
| 83 | +} | |
| 84 | + | |
| 85 | +#endif | |
| 86 | + | |
| 87 | +#ifdef __arm__ | |
| 88 | +static inline void flush_icache_range(unsigned long start, unsigned long stop) | |
| 89 | +{ | |
| 90 | + register unsigned long _beg __asm ("a1") = start; | |
| 91 | + register unsigned long _end __asm ("a2") = stop; | |
| 92 | + register unsigned long _flg __asm ("a3") = 0; | |
| 93 | + __asm __volatile__ ("swi 0x9f0002" : : "r" (_beg), "r" (_end), "r" (_flg)); | |
| 94 | +} | |
| 95 | +#endif | |
| 96 | + | |
| 21 | 97 | #ifdef __alpha__ |
| 22 | 98 | |
| 23 | 99 | register int gp asm("$29"); | ... | ... |