From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1KFc-0007RP-W4 for qemu-devel@nongnu.org; Mon, 22 Jul 2013 13:50:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1KFV-0001nG-6y for qemu-devel@nongnu.org; Mon, 22 Jul 2013 13:50:24 -0400 Received: from cantor2.suse.de ([195.135.220.15]:35766 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Jxs-0002wF-7f for qemu-devel@nongnu.org; Mon, 22 Jul 2013 13:32:04 -0400 Message-ID: <51ED6C90.2060101@suse.de> Date: Mon, 22 Jul 2013 19:32:00 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1374510975-9896-1-git-send-email-afaerber@suse.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH qom-cpu] HACKING: Document vaddr type usage List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Paolo Bonzini , qemu-devel@nongnu.org Am 22.07.2013 19:27, schrieb Peter Maydell: > On 22 July 2013 17:36, Andreas F=C3=A4rber wrote: >> Signed-off-by: Andreas F=C3=A4rber >> --- >> HACKING | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/HACKING b/HACKING >> index e73ac79..d9dbb46 100644 >> --- a/HACKING >> +++ b/HACKING >> @@ -42,6 +42,7 @@ ram_addr_t. >> >> Use target_ulong (or abi_ulong) for CPU virtual addresses, however >> devices should not need to use target_ulong. >> +Use vaddr for CPU virtual addresses in target-independent code. >=20 > Here's my suggestion for this paragraph (ie to replace > both the "Use target_ulong..." and "Use vaddr" sentences > above): >=20 > =3D=3D=3Dbegin=3D=3D=3D > 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, including most devices. It is Thanks. What reason can you think of for using vaddr in a device? Andreas > 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 means it may be 32 or 64 bits depending on which target > is being built. It should 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 pointers on 64 bit CPUs, like sparc32plus.) > Definitions of structures that must match the target's ABI > must use this type for anything that on the target is defined > to be an 'unsigned long' or a pointer type. There is also a > signed version, abi_long. > =3D=3D=3Dendit=3D=3D=3D >=20 > (cc'ing Paolo to check I didn't mangle the abi_ulong/target_ulong > distinction.) >=20 > thanks > -- PMM >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg