qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] target_phys_addr_t definition
@ 2009-09-11  9:39 Johannes Luber
       [not found] ` <m3zl91zsqd.fsf@neno.mitica>
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Luber @ 2009-09-11  9:39 UTC (permalink / raw)
  To: qemu-devel

Hi,

I've been looking through the sources and stumbled over targphys.h, which contains:

/* target_phys_addr_t is the type of a physical address (its size can
   be different from 'target_ulong'). We have sizeof(target_phys_addr)
   = max(sizeof(unsigned long),
   sizeof(size_of_target_physical_address)) because we must pass a
   host pointer to memory operations in some cases */

#if TARGET_PHYS_ADDR_BITS == 32
typedef uint32_t target_phys_addr_t;
#define TARGET_PHYS_ADDR_MAX UINT32_MAX
#define TARGET_FMT_plx "%08x"
#elif TARGET_PHYS_ADDR_BITS == 64
typedef uint64_t target_phys_addr_t;
#define TARGET_PHYS_ADDR_MAX UINT64_MAX
#define TARGET_FMT_plx "%016" PRIx64
#endif

The comment says "sizeof(target_phys_addr) = max(...)" yet I don't the actual definition depending on the host at all. This means that on 64 bit hosts things are going wrong. sizeof(uint32_t) will be always 4 and actually using sizeof(unsigned long) will still result on 64-bit Windows in 4, despite pointer having 8 bytes.

As the comment remarks this won't work with physical pointers which reference pages beyond the 4 GB limit (unless the pointers don't have always some high bits set). So my question is: Does Qemu support 64-bit compilation for hosts correctly?

Best regards,
Johannes
-- 
Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-11 11:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-11  9:39 [Qemu-devel] target_phys_addr_t definition Johannes Luber
     [not found] ` <m3zl91zsqd.fsf@neno.mitica>
2009-09-11 11:05   ` [Qemu-devel] " Johannes Luber

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