qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "陳韋任 (Wei-Ren Chen)" <chenwj@iis.sinica.edu.tw>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Evgeny Voevodin <e.voevodin@samsung.com>
Subject: [Qemu-devel] [PATCH] exec.c: Use tb1->phys_hash_next directly in tb_remove
Date: Tue, 20 Nov 2012 20:30:35 +0800	[thread overview]
Message-ID: <20121120123035.GA9929@cs.nctu.edu.tw> (raw)

  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>
---
 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

             reply	other threads:[~2012-11-20 12:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-20 12:30 陳韋任 (Wei-Ren Chen) [this message]
2012-11-20 12:41 ` [Qemu-devel] [PATCH] exec.c: Use tb1->phys_hash_next directly in tb_remove Peter Maydell
2012-11-25  7:50   ` 陳韋任 (Wei-Ren Chen)
2012-11-25 10:47     ` Peter Maydell
2012-11-26  7:09       ` 陳韋任 (Wei-Ren Chen)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121120123035.GA9929@cs.nctu.edu.tw \
    --to=chenwj@iis.sinica.edu.tw \
    --cc=e.voevodin@samsung.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).