Message ID | 1458222382-6498-2-git-send-email-sergey.fedorov@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 17 March 2016 at 13:46, <sergey.fedorov@linaro.org> wrote: > From: Paolo Bonzini <pbonzini@redhat.com> > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> > Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org> > --- > translate-all.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/translate-all.c b/translate-all.c > index e9f409b762ab..f17ace1ae899 100644 > --- a/translate-all.c > +++ b/translate-all.c > @@ -784,6 +784,9 @@ void tb_free(TranslationBlock *tb) > > static inline void invalidate_page_bitmap(PageDesc *p) > { > +#ifndef CONFIG_SOFTMMU > + assert(p->code_bitmap == NULL); > +#endif > g_free(p->code_bitmap); > p->code_bitmap = NULL; > p->code_write_count = 0; > @@ -1018,6 +1021,7 @@ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr) > tcg_ctx.tb_ctx.tb_phys_invalidate_count++; > } You could pretty much take this another step and actually make the field in the struct be only present ifdef CONFIG_SOFTMMU... thanks -- PMM
On 17/03/16 17:56, Peter Maydell wrote: > On 17 March 2016 at 13:46, <sergey.fedorov@linaro.org> wrote: >> From: Paolo Bonzini <pbonzini@redhat.com> >> >> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> >> Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org> >> --- >> translate-all.c | 9 +++++++-- >> 1 file changed, 7 insertions(+), 2 deletions(-) >> >> diff --git a/translate-all.c b/translate-all.c >> index e9f409b762ab..f17ace1ae899 100644 >> --- a/translate-all.c >> +++ b/translate-all.c >> @@ -784,6 +784,9 @@ void tb_free(TranslationBlock *tb) >> >> static inline void invalidate_page_bitmap(PageDesc *p) >> { >> +#ifndef CONFIG_SOFTMMU >> + assert(p->code_bitmap == NULL); >> +#endif >> g_free(p->code_bitmap); >> p->code_bitmap = NULL; >> p->code_write_count = 0; >> @@ -1018,6 +1021,7 @@ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr) >> tcg_ctx.tb_ctx.tb_phys_invalidate_count++; >> } > You could pretty much take this another step and actually > make the field in the struct be only present ifdef CONFIG_SOFTMMU... Sonds a good idea. Kind regards, Sergey
diff --git a/translate-all.c b/translate-all.c index e9f409b762ab..f17ace1ae899 100644 --- a/translate-all.c +++ b/translate-all.c @@ -784,6 +784,9 @@ void tb_free(TranslationBlock *tb) static inline void invalidate_page_bitmap(PageDesc *p) { +#ifndef CONFIG_SOFTMMU + assert(p->code_bitmap == NULL); +#endif g_free(p->code_bitmap); p->code_bitmap = NULL; p->code_write_count = 0; @@ -1018,6 +1021,7 @@ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr) tcg_ctx.tb_ctx.tb_phys_invalidate_count++; } +#ifdef CONFIG_SOFTMMU static void build_page_bitmap(PageDesc *p) { int n, tb_start, tb_end; @@ -1046,6 +1050,7 @@ static void build_page_bitmap(PageDesc *p) tb = tb->page_next[n]; } } +#endif /* Called with mmap_lock held for user mode emulation. */ TranslationBlock *tb_gen_code(CPUState *cpu, @@ -1294,6 +1299,7 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end, #endif } +#ifdef CONFIG_SOFTMMU /* len must be <= 8 and start must be a multiple of len */ void tb_invalidate_phys_page_fast(tb_page_addr_t start, int len) { @@ -1331,8 +1337,7 @@ void tb_invalidate_phys_page_fast(tb_page_addr_t start, int len) tb_invalidate_phys_page_range(start, start + len, 1); } } - -#if !defined(CONFIG_SOFTMMU) +#else /* Called with mmap_lock held. */ static void tb_invalidate_phys_page(tb_page_addr_t addr, uintptr_t pc, void *puc,