target_phys_addr_t definition
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
Signature · 2 lines
Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02
Quoted 1 line
"Johannes Luber" <[email protected]> wrote:
...
Quoted 10 lines
So my question is: Does Qemu support 64-bit compilation for hosts correctly?
Quoted 3 lines
Best regards,
JohannesDragons here.
See configure, the interesting bit is:
Quoted 7 lines
if [ $target_phys_bits -lt $hostlongbits ] ; then
target_phys_bits=$hostlongbits
fi
TARGET_PHYS_ADDR_BITSis the maximum of host + target long sizes.Later, Juan.
Thanks for the quick response! It seems that someone edited my local config.h which resulted in losing the config-host.h. It would be nice if something like
#ifndef HOST_LONG_BITS
#error No HOST_LONG_BITS
#endif
could be included at appropriate places. This would make this problem self-evident in the future.
Best regards,
Johannes
Signature · 2 lines
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser