qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Question about the block linking limitation


From: 陳韋任
Subject: [Qemu-devel] Question about the block linking limitation
Date: Tue, 10 Apr 2012 11:31:30 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

Hi all,

  Could someone help me to confirm that I understand how the QEMU cross page
boundary checking correctly or not? Below is the source code I am looking at, 

static inline void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip)
{

    if ((pc & TARGET_PAGE_MASK) == (tb->pc & TARGET_PAGE_MASK) ||        --- (1)
        (pc & TARGET_PAGE_MASK) == ((s->pc - 1) & TARGET_PAGE_MASK))  {  --- (2)
    }

}

(a)                                (b)
   tb->pc -->  ________               tb->pc -->  ________
              |        |                         |        |
              |        |                      -----------------
              |        |                         |        |
              |________|               s->pc --> |________| 
          
           ----------------                   -----------------
               ________                           ________
              |        |                         |        |
       pc --> |        |                  pc --> |        |
              |        |                         |        |
              |________|                         |________|


  My understanding is, if tb itself doesn't cross guest page boundary (a), then
condition (1) is enough to check if the jump target (pc) is in the same guest
page as tb is. Or, tb itself spans two guest pages (b), then we have to use
condition (2) to check if the jump target (pc) is in the same guest page as tb
is. In summary, those check (1) and (2) are used to avoid block linking to cross
guest page boundary.

  Am I right? If so far so good, I am curious about why we need (s->pc - 1)
instead of just (s->pc). Could you shed some light on that? Thanks in advance!


Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj



reply via email to

[Prev in Thread] Current Thread [Next in Thread]