]> git.proxmox.com Git - qemu.git/commitdiff
Fix usermode virtual address type
authorPaul Brook <paul@codesourcery.com>
Fri, 12 Mar 2010 23:23:29 +0000 (23:23 +0000)
committerPaul Brook <paul@codesourcery.com>
Fri, 12 Mar 2010 23:25:52 +0000 (23:25 +0000)
Usermode virtual addresses are abi_ulong, not target_ulong.

Signed-off-by: Paul Brook <paul@codesourcery.com>
cpu-all.h
exec-all.h
exec.c
linux-user/elfload.c
linux-user/mmap.c

index 481f5277c87d582e3fb81ce12ced44f81f89b643..fd51a76c1861c9680ee2b64ea92f1f2d9b8a9a12 100644 (file)
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -744,15 +744,17 @@ extern unsigned long qemu_host_page_mask;
 #define PAGE_WRITE_ORG 0x0010
 #define PAGE_RESERVED  0x0020
 
+#if defined(CONFIG_USER_ONLY)
 void page_dump(FILE *f);
 
-typedef int (*walk_memory_regions_fn)(void *, unsigned long,
-                                      unsigned long, unsigned long);
+typedef int (*walk_memory_regions_fn)(void *, abi_ulong,
+                                      abi_ulong, unsigned long);
 int walk_memory_regions(void *, walk_memory_regions_fn);
 
 int page_get_flags(target_ulong address);
 void page_set_flags(target_ulong start, target_ulong end, int flags);
 int page_check_range(target_ulong start, target_ulong len, int flags);
+#endif
 
 void cpu_exec_init_all(unsigned long tb_size);
 CPUState *cpu_copy(CPUState *env);
index 6c44d32f85d9adaae19eee22f6fd3cd99f308d8f..56e79771a45718c27649f702734a124cf3ef46cb 100644 (file)
@@ -29,7 +29,7 @@
    addresses in userspace mode.  Define tb_page_addr_t to be an appropriate
    type.  */
 #if defined(CONFIG_USER_ONLY)
-typedef target_ulong tb_page_addr_t;
+typedef abi_ulong tb_page_addr_t;
 #else
 typedef ram_addr_t tb_page_addr_t;
 #endif
diff --git a/exec.c b/exec.c
index e9cec6aaaf6d6fe23b8bd2eee066259363d24c12..1e405b67e284e5f5299b25aa3e7b44709fe2edfd 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -2217,7 +2217,7 @@ struct walk_memory_regions_data
 };
 
 static int walk_memory_regions_end(struct walk_memory_regions_data *data,
-                                   unsigned long end, int new_prot)
+                                   abi_ulong end, int new_prot)
 {
     if (data->start != -1ul) {
         int rc = data->fn(data->priv, data->start, end, data->prot);
@@ -2233,9 +2233,9 @@ static int walk_memory_regions_end(struct walk_memory_regions_data *data,
 }
 
 static int walk_memory_regions_1(struct walk_memory_regions_data *data,
-                                 unsigned long base, int level, void **lp)
+                                 abi_ulong base, int level, void **lp)
 {
-    unsigned long pa;
+    abi_ulong pa;
     int i, rc;
 
     if (*lp == NULL) {
@@ -2258,7 +2258,8 @@ static int walk_memory_regions_1(struct walk_memory_regions_data *data,
     } else {
         void **pp = *lp;
         for (i = 0; i < L2_BITS; ++i) {
-            pa = base | (i << (TARGET_PAGE_BITS + L2_BITS * level));
+            pa = base | ((abi_ulong)i <<
+                (TARGET_PAGE_BITS + L2_BITS * level));
             rc = walk_memory_regions_1(data, pa, level - 1, pp + i);
             if (rc != 0) {
                 return rc;
@@ -2280,7 +2281,7 @@ int walk_memory_regions(void *priv, walk_memory_regions_fn fn)
     data.prot = 0;
 
     for (i = 0; i < V_L1_SIZE; i++) {
-        int rc = walk_memory_regions_1(&data, i << V_L1_SHIFT,
+        int rc = walk_memory_regions_1(&data, (abi_ulong)i << V_L1_SHIFT,
                                        V_L1_SHIFT / L2_BITS - 1, l1_map + i);
         if (rc != 0) {
             return rc;
@@ -2290,12 +2291,13 @@ int walk_memory_regions(void *priv, walk_memory_regions_fn fn)
     return walk_memory_regions_end(&data, 0, 0);
 }
 
-static int dump_region(void *priv, unsigned long start,
-    unsigned long end, unsigned long prot)
+static int dump_region(void *priv, abi_ulong start,
+    abi_ulong end, unsigned long prot)
 {
     FILE *f = (FILE *)priv;
 
-    (void) fprintf(f, "%08lx-%08lx %08lx %c%c%c\n",
+    (void) fprintf(f, TARGET_ABI_FMT_lx"-"TARGET_ABI_FMT_lx
+        " "TARGET_ABI_FMT_lx" %c%c%c\n",
         start, end, end - start,
         ((prot & PAGE_READ) ? 'r' : '-'),
         ((prot & PAGE_WRITE) ? 'w' : '-'),
@@ -2332,8 +2334,8 @@ void page_set_flags(target_ulong start, target_ulong end, int flags)
     /* This function should never be called with addresses outside the
        guest address space.  If this assert fires, it probably indicates
        a missing call to h2g_valid.  */
-#if HOST_LONG_BITS > L1_MAP_ADDR_SPACE_BITS
-    assert(end < (1ul << L1_MAP_ADDR_SPACE_BITS));
+#if TARGET_ABI_BITS > L1_MAP_ADDR_SPACE_BITS
+    assert(end < ((abi_ulong)1 << L1_MAP_ADDR_SPACE_BITS));
 #endif
     assert(start < end);
 
index 71ed2d60d1cba2e30d4c2cff0d2cacf33fc1da97..91eea62178b6d795b58318614bfd4b528e9485c6 100644 (file)
@@ -2020,7 +2020,7 @@ static int vma_get_mapping_count(const struct mm_struct *);
 static struct vm_area_struct *vma_first(const struct mm_struct *);
 static struct vm_area_struct *vma_next(struct vm_area_struct *);
 static abi_ulong vma_dump_size(const struct vm_area_struct *);
-static int vma_walker(void *priv, unsigned long start, unsigned long end,
+static int vma_walker(void *priv, abi_ulong start, abi_ulong end,
     unsigned long flags);
 
 static void fill_elf_header(struct elfhdr *, int, uint16_t, uint32_t);
@@ -2173,7 +2173,7 @@ static abi_ulong vma_dump_size(const struct vm_area_struct *vma)
     return (vma->vma_end - vma->vma_start);
 }
 
-static int vma_walker(void *priv, unsigned long start, unsigned long end,
+static int vma_walker(void *priv, abi_ulong start, abi_ulong end,
     unsigned long flags)
 {
     struct mm_struct *mm = (struct mm_struct *)priv;
index ad00b6f55559de4d73bdafd5bb921d493148a3c9..46923c707c42056dda139cf97a53da3948801e51 100644 (file)
@@ -88,7 +88,7 @@ void *qemu_vmalloc(size_t size)
 
     if (h2g_valid(p)) {
         /* Allocated region overlaps guest address space. This may recurse.  */
-        unsigned long addr = h2g(p);
+        abi_ulong addr = h2g(p);
         page_set_flags(addr & TARGET_PAGE_MASK, TARGET_PAGE_ALIGN(addr + size),
                        PAGE_RESERVED);
     }