diff options
author | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-12-01 02:02:37 +0000 |
---|---|---|
committer | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-12-01 02:02:37 +0000 |
commit | 3233f0d463d299be89e2672928fc215dc99c2c71 (patch) | |
tree | dac89efe98e8fab634570c25683c519e453e2daf /exec-all.h | |
parent | 80fe30ed3432d1ba166f4583b297f1b51be58cc8 (diff) |
Use libgcc __clear_cache to clean icache, when available.
Calling the clear cache syscall directly generates an illegal instruction
on some (armv4) kernels.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5843 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'exec-all.h')
-rw-r--r-- | exec-all.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/exec-all.h b/exec-all.h index ca97f575e..7f963b051 100644 --- a/exec-all.h +++ b/exec-all.h @@ -205,18 +205,26 @@ static inline void tb_set_jmp_target1(unsigned long jmp_addr, unsigned long addr #elif defined(__arm__) static inline void tb_set_jmp_target1(unsigned long jmp_addr, unsigned long addr) { +#if QEMU_GNUC_PREREQ(4, 1) + void __clear_cache(char *beg, char *end); +#else register unsigned long _beg __asm ("a1"); register unsigned long _end __asm ("a2"); register unsigned long _flg __asm ("a3"); +#endif /* we could use a ldr pc, [pc, #-4] kind of branch and avoid the flush */ *(uint32_t *)jmp_addr |= ((addr - (jmp_addr + 8)) >> 2) & 0xffffff; +#if QEMU_GNUC_PREREQ(4, 1) + __clear_cache((char *) jmp_addr, (char *) jmp_addr + 4); +#else /* flush icache */ _beg = jmp_addr; _end = jmp_addr + 4; _flg = 0; __asm __volatile__ ("swi 0x9f0002" : : "r" (_beg), "r" (_end), "r" (_flg)); +#endif } #endif |