Received: from eggs.gnu.org ([2001:4830:134:3::10]:43520) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Sjq-0004dq-94 for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:54:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1Sjn-0005EW-Bk for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:54:10 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49747 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Sjn-0005E1-64 for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:54:07 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Tue, 23 Jul 2013 04:53:35 +0200 Message-Id: <1374548036-14471-4-git-send-email-afaerber@suse.de> In-Reply-To: <1374548036-14471-1-git-send-email-afaerber@suse.de> References: <1374548036-14471-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 03/24] HACKING: Document vaddr type usage List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Andreas=20F=C3=A4rber?= From: Peter Maydell Also extend documentation of target_ulong and abi_ulong. Signed-off-by: Peter Maydell Signed-off-by: Andreas F=C3=A4rber --- HACKING | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/HACKING b/HACKING index e73ac79..12fbc8a 100644 --- a/HACKING +++ b/HACKING @@ -40,8 +40,23 @@ speaking, the size of guest memory can always fit into= ram_addr_t but it would not be correct to store an actual guest physical address in a ram_addr_t. =20 -Use target_ulong (or abi_ulong) for CPU virtual addresses, however -devices should not need to use target_ulong. +For CPU virtual addresses there are several possible types. +vaddr is the best type to use to hold a CPU virtual address in +target-independent code. It is guaranteed to be large enough to hold a +virtual address for any target, and it does not change size from target +to target. It is always unsigned. +target_ulong is a type the size of a virtual address on the CPU; this me= ans +it may be 32 or 64 bits depending on which target is being built. It sho= uld +therefore be used only in target-specific code, and in some +performance-critical built-per-target core code such as the TLB code. +There is also a signed version, target_long. +abi_ulong is for the *-user targets, and represents a type the size of +'void *' in that target's ABI. (This may not be the same as the size of = a +full CPU virtual address in the case of target ABIs which use 32 bit poi= nters +on 64 bit CPUs, like sparc32plus.) Definitions of structures that must m= atch +the target's ABI must use this type for anything that on the target is d= efined +to be an 'unsigned long' or a pointer type. +There is also a signed version, abi_long. =20 Of course, take all of the above with a grain of salt. If you're about to use some system interface that requires a type like size_t, pid_t or --=20 1.8.1.4