From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45135) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TamyV-0000iu-Nr for qemu-devel@nongnu.org; Tue, 20 Nov 2012 07:30:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TamyQ-0006jt-Hc for qemu-devel@nongnu.org; Tue, 20 Nov 2012 07:30:47 -0500 Received: from csmailer.cs.nctu.edu.tw ([140.113.235.130]:27220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TamyP-0006jI-Vv for qemu-devel@nongnu.org; Tue, 20 Nov 2012 07:30:42 -0500 Date: Tue, 20 Nov 2012 20:30:35 +0800 From: =?utf-8?B?6Zmz6Z+L5Lu7IChXZWktUmVuIENoZW4p?= Message-ID: <20121120123035.GA9929@cs.nctu.edu.tw> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Subject: [Qemu-devel] [PATCH] exec.c: Use tb1->phys_hash_next directly in tb_remove List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Evgeny Voevodin 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 --- exec.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/exec.c b/exec.c index 8435de0..e54fce2 100644 --- a/exec.c +++ b/exec.c @@ -863,17 +863,16 @@ 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); } } @@ -940,8 +939,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) { -- 1.7.3.4