linux-user/elfload: Rename ARM_COMMPAGE to HI_COMMPAGE

Arm will no longer be the only target requiring a commpage,
but it will continue to be the only target placing the page
at the high end of the address space.

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211221025012.1057923-4-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
Richard Henderson 2021-12-20 18:50:08 -08:00 committed by Laurent Vivier
parent 80c6e9d4ae
commit 66346faf32

View File

@ -390,11 +390,11 @@ enum {
/* The commpage only exists for 32 bit kernels */ /* The commpage only exists for 32 bit kernels */
#define ARM_COMMPAGE (intptr_t)0xffff0f00u #define HI_COMMPAGE (intptr_t)0xffff0f00u
static bool init_guest_commpage(void) static bool init_guest_commpage(void)
{ {
void *want = g2h_untagged(ARM_COMMPAGE & -qemu_host_page_size); void *want = g2h_untagged(HI_COMMPAGE & -qemu_host_page_size);
void *addr = mmap(want, qemu_host_page_size, PROT_READ | PROT_WRITE, void *addr = mmap(want, qemu_host_page_size, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0); MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0);
@ -2160,8 +2160,8 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
return sp; return sp;
} }
#ifndef ARM_COMMPAGE #ifndef HI_COMMPAGE
#define ARM_COMMPAGE 0 #define HI_COMMPAGE 0
#define init_guest_commpage() true #define init_guest_commpage() true
#endif #endif
@ -2361,7 +2361,7 @@ static void pgb_static(const char *image_name, abi_ulong orig_loaddr,
} }
loaddr &= -align; loaddr &= -align;
if (ARM_COMMPAGE) { if (HI_COMMPAGE) {
/* /*
* Extend the allocation to include the commpage. * Extend the allocation to include the commpage.
* For a 64-bit host, this is just 4GiB; for a 32-bit host we * For a 64-bit host, this is just 4GiB; for a 32-bit host we
@ -2372,14 +2372,14 @@ static void pgb_static(const char *image_name, abi_ulong orig_loaddr,
if (sizeof(uintptr_t) == 8 || loaddr >= 0x80000000u) { if (sizeof(uintptr_t) == 8 || loaddr >= 0x80000000u) {
hiaddr = (uintptr_t) 4 << 30; hiaddr = (uintptr_t) 4 << 30;
} else { } else {
offset = -(ARM_COMMPAGE & -align); offset = -(HI_COMMPAGE & -align);
} }
} }
addr = pgb_find_hole(loaddr, hiaddr - loaddr, align, offset); addr = pgb_find_hole(loaddr, hiaddr - loaddr, align, offset);
if (addr == -1) { if (addr == -1) {
/* /*
* If ARM_COMMPAGE, there *might* be a non-consecutive allocation * If HI_COMMPAGE, there *might* be a non-consecutive allocation
* that can satisfy both. But as the normal arm32 link base address * that can satisfy both. But as the normal arm32 link base address
* is ~32k, and we extend down to include the commpage, making the * is ~32k, and we extend down to include the commpage, making the
* overhead only ~96k, this is unlikely. * overhead only ~96k, this is unlikely.
@ -2400,7 +2400,7 @@ static void pgb_dynamic(const char *image_name, long align)
* All we need is a commpage that satisfies align. * All we need is a commpage that satisfies align.
* If we do not need a commpage, leave guest_base == 0. * If we do not need a commpage, leave guest_base == 0.
*/ */
if (ARM_COMMPAGE) { if (HI_COMMPAGE) {
uintptr_t addr, commpage; uintptr_t addr, commpage;
/* 64-bit hosts should have used reserved_va. */ /* 64-bit hosts should have used reserved_va. */
@ -2410,7 +2410,7 @@ static void pgb_dynamic(const char *image_name, long align)
* By putting the commpage at the first hole, that puts guest_base * By putting the commpage at the first hole, that puts guest_base
* just above that, and maximises the positive guest addresses. * just above that, and maximises the positive guest addresses.
*/ */
commpage = ARM_COMMPAGE & -align; commpage = HI_COMMPAGE & -align;
addr = pgb_find_hole(commpage, -commpage, align, 0); addr = pgb_find_hole(commpage, -commpage, align, 0);
assert(addr != -1); assert(addr != -1);
guest_base = addr; guest_base = addr;