From 1a1c4db9b298956e89caf53b09b6a7a960d55d66 Mon Sep 17 00:00:00 2001 From: Mikhail Ilyin Date: Mon, 8 Sep 2014 17:28:56 +0400 Subject: translate-all.c: memory walker initial address miscalculation The initial base address is miscalculated in walk_memory_regions(). It has to be shifted TARGET_PAGE_BITS more. Holder variables are extended to target_ulong size otherwise they don't fit for MIPS N32 (a 32-bit ABI with a 64-bit address space) and qemu won't compile. The issue led to incorrect debug output of memory maps and a mis-formed coredumped file. Signed-off-by: Mikhail Ilyin Signed-off-by: Riku Voipio --- linux-user/elfload.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'linux-user') diff --git a/linux-user/elfload.c b/linux-user/elfload.c index bea803bd13..1c04fcf3cc 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2355,9 +2355,9 @@ struct elf_note_info { }; struct vm_area_struct { - abi_ulong vma_start; /* start vaddr of memory region */ - abi_ulong vma_end; /* end vaddr of memory region */ - abi_ulong vma_flags; /* protection etc. flags for the region */ + target_ulong vma_start; /* start vaddr of memory region */ + target_ulong vma_end; /* end vaddr of memory region */ + abi_ulong vma_flags; /* protection etc. flags for the region */ QTAILQ_ENTRY(vm_area_struct) vma_link; }; @@ -2368,13 +2368,13 @@ struct mm_struct { static struct mm_struct *vma_init(void); static void vma_delete(struct mm_struct *); -static int vma_add_mapping(struct mm_struct *, abi_ulong, - abi_ulong, abi_ulong); +static int vma_add_mapping(struct mm_struct *, target_ulong, + target_ulong, abi_ulong); 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, abi_ulong start, abi_ulong end, +static int vma_walker(void *priv, target_ulong start, target_ulong end, unsigned long flags); static void fill_elf_header(struct elfhdr *, int, uint16_t, uint32_t); @@ -2466,8 +2466,8 @@ static void vma_delete(struct mm_struct *mm) g_free(mm); } -static int vma_add_mapping(struct mm_struct *mm, abi_ulong start, - abi_ulong end, abi_ulong flags) +static int vma_add_mapping(struct mm_struct *mm, target_ulong start, + target_ulong end, abi_ulong flags) { struct vm_area_struct *vma; @@ -2535,7 +2535,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, abi_ulong start, abi_ulong end, +static int vma_walker(void *priv, target_ulong start, target_ulong end, unsigned long flags) { struct mm_struct *mm = (struct mm_struct *)priv; -- cgit v1.2.1