[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/33] linux-user: Remove HOST_PAGE_ALIGN from mmap.c
From: |
Richard Henderson |
Subject: |
[PATCH 10/33] linux-user: Remove HOST_PAGE_ALIGN from mmap.c |
Date: |
Fri, 18 Aug 2023 10:12:04 -0700 |
This removes a hidden use of qemu_host_page_size, using instead
the existing host_page_size local within each function.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
linux-user/mmap.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 48a6ef0af9..35f270ec2e 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -147,7 +147,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int
target_prot)
last = start + len - 1;
host_start = start & -host_page_size;
- host_last = HOST_PAGE_ALIGN(last) - 1;
+ host_last = ROUND_UP(last, host_page_size) - 1;
nranges = 0;
mmap_lock();
@@ -345,8 +345,7 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size,
abi_ulong align)
start &= -host_page_size;
}
start = ROUND_UP(start, align);
-
- size = HOST_PAGE_ALIGN(size);
+ size = ROUND_UP(size, host_page_size);
if (reserved_va) {
return mmap_find_vma_reserved(start, size, align);
@@ -506,7 +505,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int
target_prot,
*/
if (!(flags & (MAP_FIXED | MAP_FIXED_NOREPLACE))) {
host_len = len + offset - host_offset;
- host_len = HOST_PAGE_ALIGN(host_len);
+ host_len = ROUND_UP(host_len, host_page_size);
start = mmap_find_vma(real_start, host_len, TARGET_PAGE_SIZE);
if (start == (abi_ulong)-1) {
errno = ENOMEM;
@@ -551,7 +550,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int
target_prot,
void *p;
host_len = len + offset - host_offset;
- host_len = HOST_PAGE_ALIGN(host_len);
+ host_len = ROUND_UP(host_len, host_page_size);
host_prot = target_to_host_prot(target_prot);
/* Note: we prefer to control the mapping address. */
@@ -581,7 +580,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int
target_prot,
goto fail;
}
last = start + len - 1;
- real_last = HOST_PAGE_ALIGN(last) - 1;
+ real_last = ROUND_UP(last, host_page_size) - 1;
/*
* Test if requested memory area fits target address space
@@ -749,7 +748,7 @@ static void mmap_reserve_or_unmap(abi_ulong start,
abi_ulong len)
last = start + len - 1;
real_start = start & -host_page_size;
- real_last = HOST_PAGE_ALIGN(last) - 1;
+ real_last = ROUND_UP(last, host_page_size) - 1;
/*
* If guest pages remain on the first or last host pages,
--
2.34.1
- [PATCH 01/33] accel/tcg: Remove qemu_host_page_size from page_protect/page_unprotect, (continued)
- [PATCH 01/33] accel/tcg: Remove qemu_host_page_size from page_protect/page_unprotect, Richard Henderson, 2023/08/18
- [PATCH 02/33] linux-user: Adjust SVr4 NULL page mapping, Richard Henderson, 2023/08/18
- [PATCH 03/33] linux-user: Remove qemu_host_page_{size, mask} in probe_guest_base, Richard Henderson, 2023/08/18
- [PATCH 04/33] linux-user: Remove qemu_host_page_size from create_elf_tables, Richard Henderson, 2023/08/18
- [PATCH 05/33] linux-user/hppa: Simplify init_guest_commpage, Richard Henderson, 2023/08/18
- [PATCH 06/33] linux-user/nios2: Remove qemu_host_page_size from init_guest_commpage, Richard Henderson, 2023/08/18
- [PATCH 07/33] linux-user/arm: Remove qemu_host_page_size from init_guest_commpage, Richard Henderson, 2023/08/18
- [PATCH 08/33] linux-user: Remove qemu_host_page_{size, mask} from mmap.c, Richard Henderson, 2023/08/18
- [PATCH 09/33] linux-user: Remove REAL_HOST_PAGE_ALIGN from mmap.c, Richard Henderson, 2023/08/18
- [PATCH 10/33] linux-user: Remove HOST_PAGE_ALIGN from mmap.c,
Richard Henderson <=
- [PATCH 11/33] migration: Remove qemu_host_page_size, Richard Henderson, 2023/08/18
- [PATCH 12/33] hw/tpm: Remove HOST_PAGE_ALIGN from tpm_ppi_init, Richard Henderson, 2023/08/18
- [PATCH 13/33] softmmu/physmem: Remove qemu_host_page_size, Richard Henderson, 2023/08/18
- [PATCH 14/33] softmmu/physmem: Remove HOST_PAGE_ALIGN, Richard Henderson, 2023/08/18
- [PATCH 15/33] linux-user: Remove qemu_host_page_size from main, Richard Henderson, 2023/08/18
- [PATCH 17/33] linux-user: Move some mmap checks outside the lock, Richard Henderson, 2023/08/18
- [PATCH 16/33] linux-user: Split out target_mmap__locked, Richard Henderson, 2023/08/18
- [PATCH 18/33] linux-user: Fix sub-host-page mmap, Richard Henderson, 2023/08/18