qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] add cacheflush in tcg_gen_code_search_pc.
@ 2010-10-04  9:23 qiaochong
  2011-01-06 23:02 ` Aurelien Jarno
  0 siblings, 1 reply; 2+ messages in thread
From: qiaochong @ 2010-10-04  9:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: qiaochong, aurelien, rth

 Without cacheflush,qemu sometimes fail with segment fault on loongson
 cpu,which often happens when linux begin to run init.Because user
 porgram tlb refill,tlbl,tlbs,tlbm exception will often happen,
 cpu_restore_state,tcg_gen_code-pc will be called frequently.

Signed-off-by: qiaochong <qiaochong@loongson.cn>
---
 tcg/tcg.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/tcg/tcg.c b/tcg/tcg.c
index e0a9030..b5e274c 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -2120,7 +2120,12 @@ int tcg_gen_code(TCGContext *s, uint8_t *gen_code_buf)
    Return -1 if not found. */
 int tcg_gen_code_search_pc(TCGContext *s, uint8_t *gen_code_buf, long offset)
 {
-    return tcg_gen_code_common(s, gen_code_buf, offset);
+    int ret;
+    ret = tcg_gen_code_common(s, gen_code_buf, offset);
+    /* flush instruction cache */
+    flush_icache_range((unsigned long)gen_code_buf, 
+                       (unsigned long)s->code_ptr);
+    return ret;
 }
 
 #ifdef CONFIG_PROFILER
-- 
1.7.0.3.dirty

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-06 23:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-04  9:23 [Qemu-devel] [PATCH] add cacheflush in tcg_gen_code_search_pc qiaochong
2011-01-06 23:02 ` Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).