[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/24] HACKING: Document vaddr type usage
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PULL 03/24] HACKING: Document vaddr type usage |
Date: |
Tue, 23 Jul 2013 04:53:35 +0200 |
From: Peter Maydell <address@hidden>
Also extend documentation of target_ulong and abi_ulong.
Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
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.
-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 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.
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
--
1.8.1.4
- [Qemu-devel] [PULL 00/24] QOM CPUState patch queue 2013-07-22, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 05/24] target-m68k: Implement CPUClass::set_pc(), Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 01/24] gdbstub: Change GDBState::query_cpu to CPUState, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 03/24] HACKING: Document vaddr type usage,
Andreas Färber <=
- [Qemu-devel] [PULL 06/24] target-moxie: Implement CPUClass::set_pc(), Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 02/24] cpu: Introduce vaddr type, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 07/24] target-unicore32: Implement CPUClass::set_pc(), Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 04/24] cpu: Introduce CPUClass::set_pc() for gdb_set_cpu_pc(), Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 09/24] target-alpha: Copy singlestep_enabled to DisasContext, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 10/24] target-alpha: Copy implver to DisasContext, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 12/24] gdbstub: Update gdb_handlesig() and gdb_signalled() Coding Style, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 13/24] cpu: Change cpu_single_step() argument to CPUState, Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 08/24] cpu: Introduce CPUClass::synchronize_from_tb() for cpu_pc_from_tb(), Andreas Färber, 2013/07/22
- [Qemu-devel] [PULL 14/24] kvm: Change kvm_{insert, remove}_breakpoint() argument to CPUState, Andreas Färber, 2013/07/22