[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 33/43] bsd-user: update debugging in mmap.c
|
From: |
imp |
|
Subject: |
[PATCH v2 33/43] bsd-user: update debugging in mmap.c |
|
Date: |
Thu, 26 Aug 2021 15:11:51 -0600 |
From: Warner Losh <imp@FreeBSD.org>
Update the debugging code for new features and different targets.
Signed-off-by: Mikaël Urankar <mikael.urankar@gmail.com>
Signed-off-by: Sean Bruno <sbruno@FreeBSD.org>
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
---
bsd-user/mmap.c | 45 ++++++++++++++++++++++++++++-----------------
1 file changed, 28 insertions(+), 17 deletions(-)
diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c
index 03119b1f20..1ef4d271a8 100644
--- a/bsd-user/mmap.c
+++ b/bsd-user/mmap.c
@@ -68,8 +68,8 @@ int target_mprotect(abi_ulong start, abi_ulong len, int prot)
int prot1, ret;
#ifdef DEBUG_MMAP
- printf("mprotect: start=0x" TARGET_FMT_lx
- " len=0x" TARGET_FMT_lx " prot=%c%c%c\n", start, len,
+ printf("mprotect: start=0x" TARGET_ABI_FMT_lx
+ "len=0x" TARGET_ABI_FMT_lx " prot=%c%c%c\n", start, len,
prot & PROT_READ ? 'r' : '-',
prot & PROT_WRITE ? 'w' : '-',
prot & PROT_EXEC ? 'x' : '-');
@@ -250,28 +250,37 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int
prot,
mmap_lock();
#ifdef DEBUG_MMAP
{
- printf("mmap: start=0x" TARGET_FMT_lx
- " len=0x" TARGET_FMT_lx " prot=%c%c%c flags=",
+ printf("mmap: start=0x" TARGET_ABI_FMT_lx
+ " len=0x" TARGET_ABI_FMT_lx " prot=%c%c%c flags=",
start, len,
prot & PROT_READ ? 'r' : '-',
prot & PROT_WRITE ? 'w' : '-',
prot & PROT_EXEC ? 'x' : '-');
+ if (flags & MAP_ALIGNMENT_MASK)
+ printf ("MAP_ALIGNED(%u) ", (flags & MAP_ALIGNMENT_MASK) >>
MAP_ALIGNMENT_SHIFT);
+#if defined(__FreeBSD_version) && __FreeBSD_version >= 1200035
+ if (flags & MAP_GUARD)
+ printf("MAP_GUARD ");
+#endif
if (flags & MAP_FIXED)
printf("MAP_FIXED ");
- if (flags & MAP_ANON)
+ if (flags & MAP_ANONYMOUS)
printf("MAP_ANON ");
- switch (flags & TARGET_BSD_MAP_FLAGMASK) {
- case MAP_PRIVATE:
+#ifdef MAP_EXCL
+ if (flags & MAP_EXCL)
+ printf("MAP_EXCL ");
+#endif
+ if (flags & MAP_PRIVATE)
printf("MAP_PRIVATE ");
- break;
- case MAP_SHARED:
+ if (flags & MAP_SHARED)
printf("MAP_SHARED ");
- break;
- default:
- printf("[MAP_FLAGMASK=0x%x] ", flags & TARGET_BSD_MAP_FLAGMASK);
- break;
- }
- printf("fd=%d offset=" TARGET_FMT_lx "\n", fd, offset);
+ if (flags & MAP_NOCORE)
+ printf("MAP_NOCORE ");
+#ifdef MAP_STACK
+ if (flags & MAP_STACK)
+ printf("MAP_STACK ");
+#endif
+ printf("fd=%d offset=0x%llx\n", fd, offset);
}
#endif
@@ -399,7 +408,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int
prot,
page_set_flags(start, start + len, prot | PAGE_VALID);
the_end:
#ifdef DEBUG_MMAP
- printf("ret=0x" TARGET_FMT_lx "\n", start);
+ printf("ret=0x" TARGET_ABI_FMT_lx "\n", start);
page_dump(stdout);
printf("\n");
#endif
@@ -416,7 +425,9 @@ int target_munmap(abi_ulong start, abi_ulong len)
int prot, ret;
#ifdef DEBUG_MMAP
- printf("munmap: start=0x%lx len=0x%lx\n", start, len);
+ printf("munmap: start=0x" TARGET_ABI_FMT_lx " len=0x"
+ TARGET_ABI_FMT_lx "\n",
+ start, len);
#endif
if (start & ~TARGET_PAGE_MASK)
return -EINVAL;
--
2.32.0
- [PATCH v2 19/43] bsd-user: start to move target CPU functions to target_arch*, (continued)
- [PATCH v2 19/43] bsd-user: start to move target CPU functions to target_arch*, imp, 2021/08/26
- [PATCH v2 22/43] bsd-user: Include more things in qemu.h, imp, 2021/08/26
- [PATCH v2 28/43] bsd-user: Add system independent stack, data and text limiting, imp, 2021/08/26
- [PATCH v2 20/43] bsd-user: Move per-cpu code into target_arch_cpu.h, imp, 2021/08/26
- [PATCH v2 24/43] bsd-user: Create target specific vmparam.h, imp, 2021/08/26
- [PATCH v2 26/43] bsd-user: *BSD specific siginfo defintions, imp, 2021/08/26
- [PATCH v2 21/43] bsd-user: pull in target_arch_thread.h update target_arch_elf.h, imp, 2021/08/26
- [PATCH v2 32/43] bsd-user: Make cpu_model and cpu_type visible to all of main.c, imp, 2021/08/26
- [PATCH v2 33/43] bsd-user: update debugging in mmap.c,
imp <=
- [PATCH v2 39/43] bsd-user: move qemu_log to later in the file, imp, 2021/08/26
- [PATCH v2 29/43] bsd-user: elf cleanup, imp, 2021/08/26
- [PATCH v2 31/43] bsd-user: Rewrite target system call definintion glue, imp, 2021/08/26
- [PATCH v2 25/43] bsd-user: Add architecture specific signal tramp code, imp, 2021/08/26
- [PATCH v2 27/43] bsd-user: Move stack initializtion into a per-os file., imp, 2021/08/26
- [PATCH v2 34/43] bsd-user: Add target_arch_reg to describe a target's register set, imp, 2021/08/26
- [PATCH v2 30/43] bsd-user: Remove dead #ifdefs from elfload.c, imp, 2021/08/26