From: "Johannes Luber" <JALuber@gmx.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] target_phys_addr_t definition
Date: Fri, 11 Sep 2009 11:39:13 +0200 [thread overview]
Message-ID: <20090911093913.324670@gmx.net> (raw)
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
next reply other threads:[~2009-09-11 9:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-11 9:39 Johannes Luber [this message]
[not found] ` <m3zl91zsqd.fsf@neno.mitica>
2009-09-11 11:05 ` [Qemu-devel] Re: target_phys_addr_t definition Johannes Luber
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=20090911093913.324670@gmx.net \
--to=jaluber@gmx.de \
--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).