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 <m.ilin@samsung.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
This commit is contained in:
Mikhail Ilyin 2014-09-08 17:28:56 +04:00 committed by Riku Voipio
parent d80a190594
commit 1a1c4db9b2
3 changed files with 27 additions and 28 deletions

View file

@ -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;