From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JtImg-0001K5-MQ for qemu-devel@nongnu.org; Tue, 06 May 2008 04:44:26 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JtImf-0001I4-AI for qemu-devel@nongnu.org; Tue, 06 May 2008 04:44:25 -0400 Received: from [199.232.76.173] (port=57025 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JtImf-0001HY-0L for qemu-devel@nongnu.org; Tue, 06 May 2008 04:44:25 -0400 Received: from savannah.gnu.org ([199.232.41.3] helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JtIme-0002V5-RZ for qemu-devel@nongnu.org; Tue, 06 May 2008 04:44:25 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1JtImd-000691-Jn for qemu-devel@nongnu.org; Tue, 06 May 2008 08:44:23 +0000 Received: from edgar_igl by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1JtImc-00068n-SB for qemu-devel@nongnu.org; Tue, 06 May 2008 08:44:23 +0000 MIME-Version: 1.0 Errors-To: edgar_igl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: "Edgar E. Iglesias" Message-Id: Date: Tue, 06 May 2008 08:44:23 +0000 Subject: [Qemu-devel] [4352] Make sure we flush cached blocks from the tb-jmp-cache when we replace valid tlb entries . Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 4352 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4352 Author: edgar_igl Date: 2008-05-06 08:44:21 +0000 (Tue, 06 May 2008) Log Message: ----------- Make sure we flush cached blocks from the tb-jmp-cache when we replace valid tlb entries. Modified Paths: -------------- trunk/exec.c Modified: trunk/exec.c =================================================================== --- trunk/exec.c 2008-05-06 08:38:22 UTC (rev 4351) +++ trunk/exec.c 2008-05-06 08:44:21 UTC (rev 4352) @@ -1366,6 +1366,21 @@ #if !defined(CONFIG_USER_ONLY) +static inline void tlb_flush_jmp_cache(CPUState *env, target_ulong addr) +{ + unsigned int i; + + /* Discard jump cache entries for any tb which might potentially + overlap the flushed page. */ + i = tb_jmp_cache_hash_page(addr - TARGET_PAGE_SIZE); + memset (&env->tb_jmp_cache[i], 0, + TB_JMP_PAGE_SIZE * sizeof(TranslationBlock *)); + + i = tb_jmp_cache_hash_page(addr); + memset (&env->tb_jmp_cache[i], 0, + TB_JMP_PAGE_SIZE * sizeof(TranslationBlock *)); +} + /* NOTE: if flush_global is true, also flush global entries (not implemented yet) */ void tlb_flush(CPUState *env, int flush_global) @@ -1428,7 +1443,6 @@ void tlb_flush_page(CPUState *env, target_ulong addr) { int i; - TranslationBlock *tb; #if defined(DEBUG_TLB) printf("tlb_flush_page: " TARGET_FMT_lx "\n", addr); @@ -1448,14 +1462,8 @@ #endif #endif - /* Discard jump cache entries for any tb which might potentially - overlap the flushed page. */ - i = tb_jmp_cache_hash_page(addr - TARGET_PAGE_SIZE); - memset (&env->tb_jmp_cache[i], 0, TB_JMP_PAGE_SIZE * sizeof(tb)); + tlb_flush_jmp_cache(env, addr); - i = tb_jmp_cache_hash_page(addr); - memset (&env->tb_jmp_cache[i], 0, TB_JMP_PAGE_SIZE * sizeof(tb)); - #if !defined(CONFIG_SOFTMMU) if (addr < MMAP_AREA_END) munmap((void *)addr, TARGET_PAGE_SIZE); @@ -1706,6 +1714,10 @@ } else { te->addr_read = -1; } + + if (te->addr_code != -1) { + tlb_flush_jmp_cache(env, te->addr_code); + } if (prot & PAGE_EXEC) { te->addr_code = address; } else {