qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jun Koi <junkoi2004@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] dummy field in CPUTLBEntry?
Date: Fri, 16 Apr 2010 18:00:04 +0900	[thread overview]
Message-ID: <s2sfdaac4d51004160200ybd50cef7u949ab1625f889ac8@mail.gmail.com> (raw)

Hi,

I find the way we calculate the dummy field in CPUTLBEntry funny. What
is the point of having:

                   ((-sizeof(target_ulong) * 3) & (sizeof(unsigned long) - 1))

in its size? Why shouldnt it be more simple, like below?

    uint8_t dummy[(1 << CPU_TLB_ENTRY_BITS) - (sizeof(target_ulong) *
3 + sizeof(unsigned long))];


Thanks,
J


typedef struct CPUTLBEntry {
    /* bit TARGET_LONG_BITS to TARGET_PAGE_BITS : virtual address
       bit TARGET_PAGE_BITS-1..4  : Nonzero for accesses that should not
                                    go directly to ram.
       bit 3                      : indicates that the entry is invalid
       bit 2..0                   : zero
    */
    target_ulong addr_read;
    target_ulong addr_write;
    target_ulong addr_code;
    /* Addend to virtual address to get host address.  IO accesses
       use the corresponding iotlb value.  */
    unsigned long addend;
    /* padding to get a power of two size */
    uint8_t dummy[(1 << CPU_TLB_ENTRY_BITS) -
                  (sizeof(target_ulong) * 3 +
                   ((-sizeof(target_ulong) * 3) & (sizeof(unsigned
long) - 1)) +
                   sizeof(unsigned long))];
} CPUTLBEntry;

             reply	other threads:[~2010-04-16  9:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-16  9:00 Jun Koi [this message]
2010-04-19 22:43 ` [Qemu-devel] dummy field in CPUTLBEntry? Paul Brook

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=s2sfdaac4d51004160200ybd50cef7u949ab1625f889ac8@mail.gmail.com \
    --to=junkoi2004@gmail.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).