accel/tcg: Use vaddr for walk_memory_regions callback

Use vaddr instead of target_ulong.  At the same time,
use int instead of unsigned long for flags, to match
page_set_flags().

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2025-04-24 22:24:00 +02:00
parent 54bd0b135e
commit e1c8eb8cfe
4 changed files with 20 additions and 22 deletions

View file

@ -199,13 +199,13 @@ int walk_memory_regions(void *priv, walk_memory_regions_fn fn)
return rc;
}
static int dump_region(void *priv, target_ulong start,
target_ulong end, unsigned long prot)
static int dump_region(void *opaque, vaddr start, vaddr end, int prot)
{
FILE *f = (FILE *)priv;
FILE *f = opaque;
fprintf(f, TARGET_FMT_lx"-"TARGET_FMT_lx" "TARGET_FMT_lx" %c%c%c\n",
start, end, end - start,
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),
((prot & PAGE_READ) ? 'r' : '-'),
((prot & PAGE_WRITE) ? 'w' : '-'),
((prot & PAGE_EXEC) ? 'x' : '-'));

View file

@ -14,6 +14,7 @@
#include "cpu-param.h"
#include "exec/target_long.h"
#include "exec/vaddr.h"
#include "exec/translation-block.h"
int page_unprotect(CPUState *cpu, tb_page_addr_t address, uintptr_t pc);
@ -88,9 +89,7 @@ target_ulong page_find_range_empty(target_ulong min, target_ulong max,
__attribute__((returns_nonnull))
void *page_get_target_data(target_ulong address);
typedef int (*walk_memory_regions_fn)(void *, target_ulong,
target_ulong, unsigned long);
typedef int (*walk_memory_regions_fn)(void *, vaddr, vaddr, int);
int walk_memory_regions(void *, walk_memory_regions_fn);
void page_dump(FILE *f);

View file

@ -4059,8 +4059,7 @@ static void bswap_note(struct elf_note *en)
/*
* Calculate file (dump) size of given memory region.
*/
static size_t vma_dump_size(target_ulong start, target_ulong end,
unsigned long flags)
static size_t vma_dump_size(vaddr start, vaddr end, int flags)
{
/* The area must be readable. */
if (!(flags & PAGE_READ)) {
@ -4253,8 +4252,8 @@ static int dump_write(int fd, const void *ptr, size_t size)
return (0);
}
static int wmr_page_unprotect_regions(void *opaque, target_ulong start,
target_ulong end, unsigned long flags)
static int wmr_page_unprotect_regions(void *opaque, vaddr start,
vaddr end, int flags)
{
if ((flags & (PAGE_WRITE | PAGE_WRITE_ORG)) == PAGE_WRITE_ORG) {
size_t step = MAX(TARGET_PAGE_SIZE, qemu_real_host_page_size());
@ -4275,8 +4274,8 @@ typedef struct {
size_t size;
} CountAndSizeRegions;
static int wmr_count_and_size_regions(void *opaque, target_ulong start,
target_ulong end, unsigned long flags)
static int wmr_count_and_size_regions(void *opaque, vaddr start,
vaddr end, int flags)
{
CountAndSizeRegions *css = opaque;
@ -4290,8 +4289,8 @@ typedef struct {
off_t offset;
} FillRegionPhdr;
static int wmr_fill_region_phdr(void *opaque, target_ulong start,
target_ulong end, unsigned long flags)
static int wmr_fill_region_phdr(void *opaque, vaddr start,
vaddr end, int flags)
{
FillRegionPhdr *d = opaque;
struct elf_phdr *phdr = d->phdr;
@ -4313,8 +4312,8 @@ static int wmr_fill_region_phdr(void *opaque, target_ulong start,
return 0;
}
static int wmr_write_region(void *opaque, target_ulong start,
target_ulong end, unsigned long flags)
static int wmr_write_region(void *opaque, vaddr start,
vaddr end, int flags)
{
int fd = *(int *)opaque;
size_t size = vma_dump_size(start, end, flags);

View file

@ -8135,8 +8135,8 @@ static void open_self_maps_4(const struct open_self_maps_data *d,
* Callback for walk_memory_regions, when read_self_maps() fails.
* Proceed without the benefit of host /proc/self/maps cross-check.
*/
static int open_self_maps_3(void *opaque, target_ulong guest_start,
target_ulong guest_end, unsigned long flags)
static int open_self_maps_3(void *opaque, vaddr guest_start,
vaddr guest_end, int flags)
{
static const MapInfo mi = { .is_priv = true };
@ -8147,8 +8147,8 @@ static int open_self_maps_3(void *opaque, target_ulong guest_start,
/*
* Callback for walk_memory_regions, when read_self_maps() succeeds.
*/
static int open_self_maps_2(void *opaque, target_ulong guest_start,
target_ulong guest_end, unsigned long flags)
static int open_self_maps_2(void *opaque, vaddr guest_start,
vaddr guest_end, int flags)
{
const struct open_self_maps_data *d = opaque;
uintptr_t host_start = (uintptr_t)g2h_untagged(guest_start);