Received: from [140.186.70.92] (port=53297 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P9MPK-00016B-1k for qemu-devel@nongnu.org; Fri, 22 Oct 2010 14:32:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P9MPG-0007Ui-Ra for qemu-devel@nongnu.org; Fri, 22 Oct 2010 14:32:00 -0400 Received: from mailout-de.gmx.net ([213.165.64.22]:48526 helo=mail.gmx.net) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1P9MPG-0007U1-CI for qemu-devel@nongnu.org; Fri, 22 Oct 2010 14:31:58 -0400 From: xscript@gmx.net (=?utf-8?Q?Llu=C3=ADs?=) Date: Tue, 19 Oct 2010 21:57:13 +0200 Message-ID: <878w1qf5cc.fsf@ginnungagap.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH] Refactor flush of per-CPU virtual TB cache List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Llu=C3=ADs Vilanova --- exec-all.h | 2 ++ exec.c | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/exec-all.h b/exec-all.h index 3a53fe6..2ae09c5 100644 --- a/exec-all.h +++ b/exec-all.h @@ -182,6 +182,8 @@ static inline unsigned int tb_phys_hash_func(tb_page_ad= dr_t pc) =20 TranslationBlock *tb_alloc(target_ulong pc); void tb_free(TranslationBlock *tb); +/** Flush the per-CPU virtual translation block cache. */ +void tb_flush_jmp_cache(CPUState *env); void tb_flush(CPUState *env); void tb_link_page(TranslationBlock *tb, tb_page_addr_t phys_pc, tb_page_addr_t phys_page2); diff --git a/exec.c b/exec.c index 1fbe91c..516960a 100644 --- a/exec.c +++ b/exec.c @@ -688,6 +688,11 @@ static void page_flush_tb(void) } } =20 +void tb_flush_jmp_cache (CPUState * env) +{ + memset (env->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof (void *)); +} + /* flush all the translation blocks */ /* XXX: tb_flush is currently not thread safe */ void tb_flush(CPUState *env1) @@ -705,7 +710,7 @@ void tb_flush(CPUState *env1) nb_tbs =3D 0; =20 for(env =3D first_cpu; env !=3D NULL; env =3D env->next_cpu) { - memset (env->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof (void *)); + tb_flush_jmp_cache(env); } =20 memset (tb_phys_hash, 0, CODE_GEN_PHYS_HASH_SIZE * sizeof (void *)); @@ -1941,7 +1946,7 @@ void tlb_flush(CPUState *env, int flush_global) } } =20 - memset (env->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof (void *)); + tb_flush_jmp_cache(env); =20 env->tlb_flush_addr =3D -1; env->tlb_flush_mask =3D 0; --=20 1.7.1 --=20 "And it's much the same thing with knowledge, for whenever you learn something new, the whole world becomes that much richer." -- The Princess of Pure Reason, as told by Norton Juster in The Phantom Tollbooth