linux-user: fix 32bit g2h()/h2g()

sparc32plus has 64bit long type but only 32bit virtual address space.

For instance, "apt-get upgrade" failed because of a mmap()/msync()
sequence.

mmap() returned 0xff252000 but msync() used g2h(0xffffffffff252000)
to find the host address. The "(target_ulong)" in g2h() doesn't fix the
address because it is 64bit long.

This patch introduces an "abi_ptr" that is set to uint32_t
if the virtual address space is addressed using 32bit in the linux-user
case. It stays set to target_ulong with softmmu case.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20180814171217.14680-1-laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
[lv: added "%" in TARGET_ABI_FMT_ptr "%"PRIx64]
This commit is contained in:
Laurent Vivier 2018-08-14 19:12:17 +02:00
parent b8dbfc9cc6
commit 3e23de1523
3 changed files with 25 additions and 12 deletions

View file

@ -7644,7 +7644,7 @@ static int open_self_maps(void *cpu_env, int fd)
if (h2g(min) == ts->info->stack_limit) {
pstrcpy(path, sizeof(path), " [stack]");
}
dprintf(fd, TARGET_ABI_FMT_lx "-" TARGET_ABI_FMT_lx
dprintf(fd, TARGET_ABI_FMT_ptr "-" TARGET_ABI_FMT_ptr
" %c%c%c%c %08" PRIx64 " %02x:%02x %d %s%s\n",
h2g(min), h2g(max - 1) + 1, flag_r, flag_w,
flag_x, flag_p, offset, dev_maj, dev_min, inode,