[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 34/43] bsd-user: update debugging in mmap.c
From: |
imp |
Subject: |
[PATCH v3 34/43] bsd-user: update debugging in mmap.c |
Date: |
Thu, 2 Sep 2021 17:47:20 -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 | 55 ++++++++++++++++++++++++++++++++++---------------
1 file changed, 38 insertions(+), 17 deletions(-)
diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c
index 03119b1f20..8918c4ae68 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,47 @@ 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_FIXED)
+ if (flags & MAP_ALIGNMENT_MASK) {
+ printf("MAP_ALIGNED(%u) ", (flags & MAP_ALIGNMENT_MASK)
+ >> MAP_ALIGNMENT_SHIFT);
+ }
+#if MAP_GUARD
+ 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 +418,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 +435,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 v3 37/43] bsd-user: add stubbed out core dump support, (continued)
- [PATCH v3 37/43] bsd-user: add stubbed out core dump support, imp, 2021/09/02
- [PATCH v3 41/43] bsd-user: Implement interlock for atomic operations, imp, 2021/09/02
- [PATCH v3 29/43] bsd-user: Add architecture specific signal tramp code, imp, 2021/09/02
- [PATCH v3 28/43] bsd-user: Move stack initializtion into a per-os file., imp, 2021/09/02
- [PATCH v3 36/43] bsd-user: Add target_os_user.h to capture the user/kernel structures, imp, 2021/09/02
- [PATCH v3 27/43] bsd-user: Implement --seed and initialize random state, imp, 2021/09/02
- [PATCH v3 34/43] bsd-user: update debugging in mmap.c,
imp <=
- [PATCH v3 43/43] bsd-user: Update mapping to handle reserved and starting conditions, imp, 2021/09/02
- [PATCH v3 40/43] bsd-user: move qemu_log to later in the file, imp, 2021/09/02
- [PATCH v3 42/43] bsd-user: Add '-0 argv0' option to bsd-user/main.c, imp, 2021/09/02
- [PATCH v3 32/43] bsd-user: Rewrite target system call definintion glue, imp, 2021/09/02