[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/11] accel/tcg: Avoid abi_ptr in user-exec.c
From: |
Richard Henderson |
Subject: |
[PATCH 10/11] accel/tcg: Avoid abi_ptr in user-exec.c |
Date: |
Thu, 1 May 2025 07:55:18 -0700 |
In page_dump/dump_region, use guest_addr_max to check the
size of the guest address space and size the output
appropriately. This will change output with small values
of -R reserved_va, but shouldn't affect anything else.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
accel/tcg/user-exec.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index 46b1e97c30..085da0c036 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -29,6 +29,7 @@
#include "accel/tcg/helper-retaddr.h"
#include "accel/tcg/probe.h"
#include "user/cpu_loop.h"
+#include "user/guest-host.h"
#include "qemu/main-loop.h"
#include "user/page-protection.h"
#include "exec/page-protection.h"
@@ -202,10 +203,19 @@ int walk_memory_regions(void *priv,
walk_memory_regions_fn fn)
static int dump_region(void *opaque, vaddr start, vaddr end, int prot)
{
FILE *f = opaque;
+ uint64_t mask;
+ int width;
- fprintf(f, TARGET_ABI_FMT_ptr "-" TARGET_ABI_FMT_ptr
- " " TARGET_ABI_FMT_ptr " %c%c%c\n",
- (abi_ptr)start, (abi_ptr)end, (abi_ptr)(end - start),
+ if (guest_addr_max <= UINT32_MAX) {
+ mask = UINT32_MAX, width = 8;
+ } else {
+ mask = UINT64_MAX, width = 16;
+ }
+
+ fprintf(f, "%0*" PRIx64 "-%0*" PRIx64 " %0*" PRIx64 " %c%c%c\n",
+ width, start & mask,
+ width, end & mask,
+ width, (end - start) & mask,
((prot & PAGE_READ) ? 'r' : '-'),
((prot & PAGE_WRITE) ? 'w' : '-'),
((prot & PAGE_EXEC) ? 'x' : '-'));
@@ -215,10 +225,10 @@ static int dump_region(void *opaque, vaddr start, vaddr
end, int prot)
/* dump memory mappings */
void page_dump(FILE *f)
{
- const int length = sizeof(abi_ptr) * 2;
+ int width = guest_addr_max <= UINT32_MAX ? 8 : 16;
fprintf(f, "%-*s %-*s %-*s %s\n",
- length, "start", length, "end", length, "size", "prot");
+ width, "start", width, "end", width, "size", "prot");
walk_memory_regions(f, dump_region);
}
@@ -1135,7 +1145,7 @@ static uint64_t do_ld8_mmu(CPUState *cpu, vaddr addr,
MemOpIdx oi,
return ret;
}
-static Int128 do_ld16_mmu(CPUState *cpu, abi_ptr addr,
+static Int128 do_ld16_mmu(CPUState *cpu, vaddr addr,
MemOpIdx oi, uintptr_t ra)
{
void *haddr;
--
2.43.0
- Re: [PATCH 02/11] accel/tcg: Move tlb_vaddr_to_host declaration to probe.h, (continued)
- [PATCH 04/11] accel/tcg: Use vaddr for plugin_{load,store}_cb, Richard Henderson, 2025/05/01
- [PATCH 06/11] include/user: Convert GUEST_ADDR_MAX to a variable, Richard Henderson, 2025/05/01
- [PATCH 08/11] accel/tcg: Move TARGET_TAGGED_ADDRESSES to TCGCPUOps.untagged_addr, Richard Henderson, 2025/05/01
- [PATCH 07/11] include/user: Use vaddr in guest-host.h, Richard Henderson, 2025/05/01
- [PATCH 10/11] accel/tcg: Avoid abi_ptr in user-exec.c,
Richard Henderson <=
- [PATCH 09/11] accel/tcg: Remove TARGET_PAGE_DATA_SIZE, Richard Henderson, 2025/05/01
- [PATCH 11/11] accel/tcg: Build user-exec.c once, Richard Henderson, 2025/05/01
- Re: [PATCH 00/11] accel/tcg: Finish building once, Pierrick Bouvier, 2025/05/01