[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 22/60] linux-user/hppa: Simplify init_guest_commpage
From: |
Richard Henderson |
Subject: |
[PATCH 22/60] linux-user/hppa: Simplify init_guest_commpage |
Date: |
Fri, 1 Mar 2024 13:05:41 -1000 |
If reserved_va, then we have already reserved the entire
guest virtual address space; no need to remap page.
If !reserved_va, then use MAP_FIXED_NOREPLACE.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20240102015808.132373-6-richard.henderson@linaro.org>
---
linux-user/elfload.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 0f135f6b6d..53b61aac77 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1970,16 +1970,20 @@ static inline void init_thread(struct target_pt_regs
*regs,
static bool init_guest_commpage(void)
{
- void *want = g2h_untagged(LO_COMMPAGE);
- void *addr = mmap(want, qemu_host_page_size, PROT_NONE,
- MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0);
+ /* If reserved_va, then we have already mapped 0 page on the host. */
+ if (!reserved_va) {
+ void *want, *addr;
- if (addr == MAP_FAILED) {
- perror("Allocating guest commpage");
- exit(EXIT_FAILURE);
- }
- if (addr != want) {
- return false;
+ want = g2h_untagged(LO_COMMPAGE);
+ addr = mmap(want, TARGET_PAGE_SIZE, PROT_NONE,
+ MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED_NOREPLACE, -1, 0);
+ if (addr == MAP_FAILED) {
+ perror("Allocating guest commpage");
+ exit(EXIT_FAILURE);
+ }
+ if (addr != want) {
+ return false;
+ }
}
/*
--
2.34.1
- [PATCH 28/60] linux-user: Remove HOST_PAGE_ALIGN from mmap.c, (continued)
- [PATCH 28/60] linux-user: Remove HOST_PAGE_ALIGN from mmap.c, Richard Henderson, 2024/03/01
- [PATCH 07/60] linux-user/elfload: Truncate core file on open, Richard Henderson, 2024/03/01
- [PATCH 20/60] linux-user: Remove qemu_host_page_{size, mask} in probe_guest_base, Richard Henderson, 2024/03/01
- [PATCH 23/60] linux-user/nios2: Remove qemu_host_page_size from init_guest_commpage, Richard Henderson, 2024/03/01
- [PATCH 27/60] linux-user: Remove REAL_HOST_PAGE_ALIGN from mmap.c, Richard Henderson, 2024/03/01
- [PATCH 35/60] linux-user: Move some mmap checks outside the lock, Richard Henderson, 2024/03/01
- [PATCH 37/60] linux-user: Split out mmap_end, Richard Henderson, 2024/03/01
- [PATCH 33/60] linux-user: Remove qemu_host_page_size from main, Richard Henderson, 2024/03/01
- [PATCH 34/60] linux-user: Split out target_mmap__locked, Richard Henderson, 2024/03/01
- [PATCH 21/60] linux-user: Remove qemu_host_page_size from create_elf_tables, Richard Henderson, 2024/03/01
- [PATCH 22/60] linux-user/hppa: Simplify init_guest_commpage,
Richard Henderson <=
- [PATCH 24/60] linux-user/arm: Remove qemu_host_page_size from init_guest_commpage, Richard Henderson, 2024/03/01
- [PATCH 30/60] hw/tpm: Remove HOST_PAGE_ALIGN from tpm_ppi_init, Richard Henderson, 2024/03/01
- [PATCH 32/60] softmmu/physmem: Remove HOST_PAGE_ALIGN, Richard Henderson, 2024/03/01
- [PATCH 10/60] linux-user/elfload: Write corefile elf header in one block, Richard Henderson, 2024/03/01
- [PATCH 17/60] tcg: Avoid double lock if page tables happen to be in mmio memory., Richard Henderson, 2024/03/01
- [PATCH 29/60] migration: Remove qemu_host_page_size, Richard Henderson, 2024/03/01
- [PATCH 31/60] softmmu/physmem: Remove qemu_host_page_size, Richard Henderson, 2024/03/01
- [PATCH 36/60] linux-user: Fix sub-host-page mmap, Richard Henderson, 2024/03/01
- [PATCH 38/60] linux-user: Do early mmap placement only for reserved_va, Richard Henderson, 2024/03/01
- [PATCH 39/60] linux-user: Split out do_munmap, Richard Henderson, 2024/03/01