From: Paolo Bonzini <[email protected]> Simple code simplification.
Signed-off-by: Paolo Bonzini <[email protected]> Signed-off-by: Sergey Fedorov <[email protected]> --- translate-all.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/translate-all.c b/translate-all.c index f17ace1ae899..a1ac9841de48 100644 --- a/translate-all.c +++ b/translate-all.c @@ -927,6 +927,14 @@ static inline void tb_page_remove(TranslationBlock **ptb, TranslationBlock *tb) } } +/* reset the jump entry 'n' of a TB so that it is not chained to + another TB */ +static inline void tb_reset_jump(TranslationBlock *tb, int n) +{ + tb_set_jmp_target(tb, n, (uintptr_t)(tb->tc_ptr + tb->tb_next_offset[n])); + tb->jmp_next[n] = NULL; +} + static inline void tb_jmp_remove(TranslationBlock *tb, int n) { TranslationBlock *tb1, **ptb; @@ -951,18 +959,10 @@ static inline void tb_jmp_remove(TranslationBlock *tb, int n) } /* now we can suppress tb(n) from the list */ *ptb = tb->jmp_next[n]; - - tb->jmp_next[n] = NULL; + tb_reset_jump(tb, n); } } -/* reset the jump entry 'n' of a TB so that it is not chained to - another TB */ -static inline void tb_reset_jump(TranslationBlock *tb, int n) -{ - tb_set_jmp_target(tb, n, (uintptr_t)(tb->tc_ptr + tb->tb_next_offset[n])); -} - /* invalidate one TB */ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr) { @@ -1013,7 +1013,6 @@ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr) tb1 = (TranslationBlock *)((uintptr_t)tb1 & ~3); tb2 = tb1->jmp_next[n1]; tb_reset_jump(tb1, n1); - tb1->jmp_next[n1] = NULL; tb1 = tb2; } tb->jmp_first = (TranslationBlock *)((uintptr_t)tb | 2); /* fail safe */ -- 2.7.3
