qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] dummy field in CPUTLBEntry?


From: Jun Koi
Subject: [Qemu-devel] dummy field in CPUTLBEntry?
Date: Fri, 16 Apr 2010 18:00:04 +0900

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 via email to

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