[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 13/17] bsd-user: target_mprotect: rename prot to target_prot
|
From: |
Warner Losh |
|
Subject: |
[PATCH 13/17] bsd-user: target_mprotect: rename prot to target_prot |
|
Date: |
Fri, 2 Aug 2024 17:56:13 -0600 |
Linux-user's target_mprotect uses this convention, so move to it.
Signed-off-by: Warner Losh <imp@bsdimp.com>
---
bsd-user/mmap.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c
index ed8d31a9048..d34075c5c64 100644
--- a/bsd-user/mmap.c
+++ b/bsd-user/mmap.c
@@ -61,16 +61,16 @@ void mmap_fork_end(int child)
}
/* NOTE: all the constants are the HOST ones, but addresses are target. */
-int target_mprotect(abi_ulong start, abi_ulong len, int prot)
+int target_mprotect(abi_ulong start, abi_ulong len, int target_prot)
{
abi_ulong end, host_start, host_end, addr;
int prot1, ret;
qemu_log_mask(CPU_LOG_PAGE, "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' : '-');
+ target_prot & PROT_READ ? 'r' : '-',
+ target_prot & PROT_WRITE ? 'w' : '-',
+ target_prot & PROT_EXEC ? 'x' : '-');
if ((start & ~TARGET_PAGE_MASK) != 0)
return -EINVAL;
len = TARGET_PAGE_ALIGN(len);
@@ -78,7 +78,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int prot)
return -ENOMEM;
}
end = start + len;
- prot &= PROT_READ | PROT_WRITE | PROT_EXEC;
+ target_prot &= PROT_READ | PROT_WRITE | PROT_EXEC;
if (len == 0)
return 0;
@@ -87,7 +87,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int prot)
host_end = HOST_PAGE_ALIGN(end);
if (start > host_start) {
/* handle host page containing start */
- prot1 = prot;
+ prot1 = target_prot;
for (addr = host_start; addr < start; addr += TARGET_PAGE_SIZE) {
prot1 |= page_get_flags(addr);
}
@@ -104,7 +104,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int
prot)
host_start += qemu_host_page_size;
}
if (end < host_end) {
- prot1 = prot;
+ prot1 = target_prot;
for (addr = end; addr < host_end; addr += TARGET_PAGE_SIZE) {
prot1 |= page_get_flags(addr);
}
@@ -117,11 +117,11 @@ int target_mprotect(abi_ulong start, abi_ulong len, int
prot)
/* handle the pages in the middle */
if (host_start < host_end) {
- ret = mprotect(g2h_untagged(host_start), host_end - host_start, prot);
+ ret = mprotect(g2h_untagged(host_start), host_end - host_start,
target_prot);
if (ret != 0)
goto error;
}
- page_set_flags(start, start + len - 1, prot | PAGE_VALID);
+ page_set_flags(start, start + len - 1, target_prot | PAGE_VALID);
mmap_unlock();
return 0;
error:
--
2.45.1
- [PATCH 03/17] bsd-user: Make cpu_model and cpu_type file scope, (continued)
- [PATCH 03/17] bsd-user: Make cpu_model and cpu_type file scope, Warner Losh, 2024/08/02
- [PATCH 07/17] bsd-user: Remove deprecated -p argument, Warner Losh, 2024/08/02
- [PATCH 08/17] bsd-user: Eliminate unused qemu_uname_release, Warner Losh, 2024/08/02
- [PATCH 06/17] bsd-user: Remove load_flt_binary prototype, Warner Losh, 2024/08/02
- [PATCH 11/17] bsd-user: Replace set_brk and padzero with zerobss from linux-user, Warner Losh, 2024/08/02
- [PATCH 13/17] bsd-user: target_mprotect: rename prot to target_prot,
Warner Losh <=
- [PATCH 09/17] bsd-user: target_msync unused, remove it, Warner Losh, 2024/08/02
- [PATCH 16/17] bsd-user: Define validate_prot_to_pageflags and use in mprotect, Warner Losh, 2024/08/02
- [PATCH 14/17] bsd-user: target_mmap*: change prot to target_prot, Warner Losh, 2024/08/02
- [PATCH 15/17] bsd-user: target_mprotect: use helper host_page_size local, Warner Losh, 2024/08/02
- [PATCH 10/17] bsd-user: Pass image name down the stack, Warner Losh, 2024/08/02