diff mbox

[Discussion,04/10] memory_mapping: make this architecture-independent

Message ID 1393901250-3922-5-git-send-email-xbing6@gmail.com
State New
Headers show

Commit Message

Xuebing Wang March 4, 2014, 2:47 a.m. UTC
Use vaddr (instead of target_ulong) for virtual address. See document HACKING
for more information about vaddr and target_ulong.

Signed-off-by: Xuebing Wang <xbing6@gmail.com>
---
 include/sysemu/memory_mapping.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Paolo Bonzini March 4, 2014, 10:22 a.m. UTC | #1
Il 04/03/2014 03:47, Xuebing Wang ha scritto:
> Use vaddr (instead of target_ulong) for virtual address. See document HACKING
> for more information about vaddr and target_ulong.
>
> Signed-off-by: Xuebing Wang <xbing6@gmail.com>
> ---
>  include/sysemu/memory_mapping.h |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/sysemu/memory_mapping.h b/include/sysemu/memory_mapping.h
> index a75d59a..4a5f7be 100644
> --- a/include/sysemu/memory_mapping.h
> +++ b/include/sysemu/memory_mapping.h
> @@ -16,6 +16,7 @@
>
>  #include "qemu/queue.h"
>  #include "qemu/typedefs.h"
> +#include "qom/cpu.h" /* for vaddr */
>
>  typedef struct GuestPhysBlock {
>      /* visible to guest, reflects PCI hole, etc */
> @@ -39,7 +40,7 @@ typedef struct GuestPhysBlockList {
>  /* The physical and virtual address in the memory mapping are contiguous. */
>  typedef struct MemoryMapping {
>      hwaddr phys_addr;
> -    target_ulong virt_addr;
> +    vaddr virt_addr;
>      ram_addr_t length;
>      QTAILQ_ENTRY(MemoryMapping) next;
>  } MemoryMapping;
>

Makes sense.

Paolo
Peter Maydell March 4, 2014, 11:05 a.m. UTC | #2
On 4 March 2014 02:47, Xuebing Wang <xbing6@gmail.com> wrote:
> Use vaddr (instead of target_ulong) for virtual address. See document HACKING
> for more information about vaddr and target_ulong.
>
> Signed-off-by: Xuebing Wang <xbing6@gmail.com>
> ---
>  include/sysemu/memory_mapping.h |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/sysemu/memory_mapping.h b/include/sysemu/memory_mapping.h
> index a75d59a..4a5f7be 100644
> --- a/include/sysemu/memory_mapping.h
> +++ b/include/sysemu/memory_mapping.h
> @@ -16,6 +16,7 @@
>
>  #include "qemu/queue.h"
>  #include "qemu/typedefs.h"
> +#include "qom/cpu.h" /* for vaddr */
>
>  typedef struct GuestPhysBlock {
>      /* visible to guest, reflects PCI hole, etc */
> @@ -39,7 +40,7 @@ typedef struct GuestPhysBlockList {
>  /* The physical and virtual address in the memory mapping are contiguous. */
>  typedef struct MemoryMapping {
>      hwaddr phys_addr;
> -    target_ulong virt_addr;
> +    vaddr virt_addr;
>      ram_addr_t length;
>      QTAILQ_ENTRY(MemoryMapping) next;
>  } MemoryMapping;
> --
> 1.7.9.5

If we're going to do this we should be consistent in this API:
at the moment most of the functions (private or otherwise)
in memory_mapping.c use "hwaddr" for virtual addresses.
It seems like a good idea, though.

thanks
-- PMM
diff mbox

Patch

diff --git a/include/sysemu/memory_mapping.h b/include/sysemu/memory_mapping.h
index a75d59a..4a5f7be 100644
--- a/include/sysemu/memory_mapping.h
+++ b/include/sysemu/memory_mapping.h
@@ -16,6 +16,7 @@ 
 
 #include "qemu/queue.h"
 #include "qemu/typedefs.h"
+#include "qom/cpu.h" /* for vaddr */
 
 typedef struct GuestPhysBlock {
     /* visible to guest, reflects PCI hole, etc */
@@ -39,7 +40,7 @@  typedef struct GuestPhysBlockList {
 /* The physical and virtual address in the memory mapping are contiguous. */
 typedef struct MemoryMapping {
     hwaddr phys_addr;
-    target_ulong virt_addr;
+    vaddr virt_addr;
     ram_addr_t length;
     QTAILQ_ENTRY(MemoryMapping) next;
 } MemoryMapping;