* [Qemu-devel] [PATCH] tlb flush cleanup
@ 2009-07-11 22:15 Igor Kovalenko
2009-07-12 7:57 ` Blue Swirl
0 siblings, 1 reply; 2+ messages in thread
From: Igor Kovalenko @ 2009-07-11 22:15 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 235 bytes --]
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
[-- Attachment #2: exec-clear-tlb-entry --]
[-- Type: application/octet-stream, Size: 1379 bytes --]
Index: qemu-trunk/exec.c
===================================================================
--- qemu-trunk.orig/exec.c
+++ qemu-trunk/exec.c
@@ -1752,6 +1752,13 @@ static inline void tlb_flush_jmp_cache(C
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)
@@ -1768,9 +1775,7 @@ void tlb_flush(CPUState *env, int flush_
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;
}
}
@@ -1792,9 +1797,7 @@ static inline void tlb_flush_entry(CPUTL
(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;
}
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] tlb flush cleanup
2009-07-11 22:15 [Qemu-devel] [PATCH] tlb flush cleanup Igor Kovalenko
@ 2009-07-12 7:57 ` Blue Swirl
0 siblings, 0 replies; 2+ messages in thread
From: Blue Swirl @ 2009-07-12 7:57 UTC (permalink / raw)
To: Igor Kovalenko; +Cc: qemu-devel
On 7/12/09, Igor Kovalenko <igor.v.kovalenko@gmail.com> wrote:
> Use static empty variable s_cputlb_empty_entry to clear entries,
> also reset addend member when clearing entries.
> This helps running with valgrind/memcheck
With this approach, the empty entry could be const. But can't we use
memset(x, 0xff, size) for the entries?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-07-12 7:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-11 22:15 [Qemu-devel] [PATCH] tlb flush cleanup Igor Kovalenko
2009-07-12 7:57 ` Blue Swirl
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).