qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: ali saeedi <ali.saeedi56@gmail.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] BIT_WORD(start >> TARGET_PAGE_BITS)
Date: Fri, 30 Jun 2017 18:19:21 +0430	[thread overview]
Message-ID: <CAGKXQydEu1hVXxTKt5tYxCSr2WO0b7s6HxDtkRSD9ZHwHNRPrw@mail.gmail.com> (raw)
In-Reply-To: <715c7cf5-0311-425a-9ea0-9a9986b3655b@redhat.com>

thank you so much Eric
Sorry for too questions
I certainly follow your guide
thanks a lot


On Fri, Jun 30, 2017 at 5:49 PM, Eric Blake <eblake@redhat.com> wrote:

> On 06/30/2017 08:02 AM, ali saeedi wrote:
> > Hello
> > what does the following code do?
> > 'unsigned long page = BIT_WORD(start >> TARGET_PAGE_BITS)' ?
>
> I've noticed you've been asking a lot of questions (each as a new
> thread, rather than replying to previous answers), that seem like you
> are not trying very hard to read the code and find an answer for
> yourself.  Rather than just answer you, I'm going to try to teach you
> how to read the source and answer the question yourself.  You may also
> get better answers to your future questions if you ask in the form of
> "this code is confusing me, I think it means this, based on what I read
> at xyz, but would like confirmation or correction" (showing WHAT you
> have already researched) rather than just "what does this code do" (and
> making it feel like you are off-loading the research work onto others).
>
> First, figure out what BIT_WORD does:
>
> $ git grep 'define BIT_WORD'
>
> That should have only one hit, in include/qemu/bitops.h.  Reading it in
> context doesn't have any more comments, but it looks like it is
> computing the number of bits that are available in a word, and looks
> like it is defining a word to be the type most efficiently operated on
> for the current ABI (a long is 32 bits on a 32-bit OS, and 64 bits on a
> 64-bit OS).
>
> It also looks like you are scaling a start address by the number of bits
> in a target page.
>
> So it probably means you are computing the index for which page 'start'
> occurs on (depending on values, it might mean that 'start == 0x0' is
> page 0, 'start == 0x10000' is page 1, and so on), where start is
> initially in the form of the number of bits per page.
>
> --
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.           +1-919-301-3266
> Virtualization:  qemu.org | libvirt.org
>
>

  reply	other threads:[~2017-06-30 13:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30 13:02 [Qemu-devel] BIT_WORD(start >> TARGET_PAGE_BITS) ali saeedi
2017-06-30 13:19 ` Eric Blake
2017-06-30 13:49   ` ali saeedi [this message]
2017-06-30 13:53 ` Stefan Hajnoczi

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=CAGKXQydEu1hVXxTKt5tYxCSr2WO0b7s6HxDtkRSD9ZHwHNRPrw@mail.gmail.com \
    --to=ali.saeedi56@gmail.com \
    --cc=eblake@redhat.com \
    --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).