summaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorIgor Kovalenko <igor.v.kovalenko@gmail.com>2009-07-12 02:15:40 +0400
committerAnthony Liguori <aliguori@us.ibm.com>2009-07-16 17:28:50 -0500
commit087389847207063df194a1b85ff907f54dd51d0a (patch)
tree2ffdcced135dad9a95cb2a40a35f37b86d7cb7e1 /exec.c
parent7d93b1fa188a7e32bd5e53fce819d39cf6d90fcc (diff)
downloadqemu-087389847207063df194a1b85ff907f54dd51d0a.tar.gz
tlb flush cleanup
Use static empty variable s_cputlb_empty_entry to clear entries, also reset addend member when clearing entries. This helps running with valgrind/memcheck Signed-off-by: igor.v.kovalenko@gmail.com -- Kind regards, Igor V. Kovalenko Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/exec.c b/exec.c
index e5c38fa510..65c89b08b7 100644
--- a/exec.c
+++ b/exec.c
@@ -1751,6 +1751,13 @@ static inline void tlb_flush_jmp_cache(CPUState *env, target_ulong addr)
TB_JMP_PAGE_SIZE * sizeof(TranslationBlock *));
}
+static CPUTLBEntry s_cputlb_empty_entry = {
+ .addr_read = -1,
+ .addr_write = -1,
+ .addr_code = -1,
+ .addend = -1,
+};
+
/* NOTE: if flush_global is true, also flush global entries (not
implemented yet) */
void tlb_flush(CPUState *env, int flush_global)
@@ -1767,9 +1774,7 @@ void tlb_flush(CPUState *env, int flush_global)
for(i = 0; i < CPU_TLB_SIZE; i++) {
int mmu_idx;
for (mmu_idx = 0; mmu_idx < NB_MMU_MODES; mmu_idx++) {
- env->tlb_table[mmu_idx][i].addr_read = -1;
- env->tlb_table[mmu_idx][i].addr_write = -1;
- env->tlb_table[mmu_idx][i].addr_code = -1;
+ env->tlb_table[mmu_idx][i] = s_cputlb_empty_entry;
}
}
@@ -1791,9 +1796,7 @@ static inline void tlb_flush_entry(CPUTLBEntry *tlb_entry, target_ulong addr)
(TARGET_PAGE_MASK | TLB_INVALID_MASK)) ||
addr == (tlb_entry->addr_code &
(TARGET_PAGE_MASK | TLB_INVALID_MASK))) {
- tlb_entry->addr_read = -1;
- tlb_entry->addr_write = -1;
- tlb_entry->addr_code = -1;
+ *tlb_entry = s_cputlb_empty_entry;
}
}