aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author陳韋任 (Wei-Ren Chen) <chenwj@iis.sinica.edu.tw>2012-12-20 09:39:16 +0800
committerBlue Swirl <blauwirbel@gmail.com>2012-12-22 12:06:24 +0000
commit0c884d1659f02b4a0c704c2344f42e3fabb1f193 (patch)
treef11f8e2e07236b17a6aaf11db63233b4030f404e
parentb2136140f68ce05122f611eb9cde4f0365ab6a00 (diff)
downloadqemu-0c884d1659f02b4a0c704c2344f42e3fabb1f193.zip
qemu-0c884d1659f02b4a0c704c2344f42e3fabb1f193.tar.gz
qemu-0c884d1659f02b4a0c704c2344f42e3fabb1f193.tar.bz2
translate-all.c: Use tb1->phys_hash_next directly in tb_remove
When tb_remove was first commited at fd6ce8f6, there were three different calls pass different names to offsetof. In current codebase, the other two calls are replaced with tb_page_remove. There is no need to have a general tb_remove. Omit passing the third parameter and using tb1->phys_hash_next directly. Signed-off-by: Chen Wei-Ren <chenwj@iis.sinica.edu.tw> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
-rw-r--r--translate-all.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/translate-all.c b/translate-all.c
index b621748..d367fc4 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -759,19 +759,17 @@ static void tb_page_check(void)
#endif
-/* invalidate one TB */
-static inline void tb_remove(TranslationBlock **ptb, TranslationBlock *tb,
- int next_offset)
+static inline void tb_hash_remove(TranslationBlock **ptb, TranslationBlock *tb)
{
TranslationBlock *tb1;
for (;;) {
tb1 = *ptb;
if (tb1 == tb) {
- *ptb = *(TranslationBlock **)((char *)tb1 + next_offset);
+ *ptb = tb1->phys_hash_next;
break;
}
- ptb = (TranslationBlock **)((char *)tb1 + next_offset);
+ ptb = &tb1->phys_hash_next;
}
}
@@ -828,6 +826,7 @@ 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)
{
CPUArchState *env;
@@ -839,8 +838,7 @@ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr)
/* remove the TB from the hash list */
phys_pc = tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK);
h = tb_phys_hash_func(phys_pc);
- tb_remove(&tb_phys_hash[h], tb,
- offsetof(TranslationBlock, phys_hash_next));
+ tb_hash_remove(&tb_phys_hash[h], tb);
/* remove the TB from the page list */
if (tb->page_addr[0] != page_addr) {