mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
accel/tcg: Avoid abi_ptr in user-exec.c
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. Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
964080d356
commit
03c981e7d6
1 changed files with 16 additions and 6 deletions
|
@ -29,6 +29,7 @@
|
||||||
#include "accel/tcg/helper-retaddr.h"
|
#include "accel/tcg/helper-retaddr.h"
|
||||||
#include "accel/tcg/probe.h"
|
#include "accel/tcg/probe.h"
|
||||||
#include "user/cpu_loop.h"
|
#include "user/cpu_loop.h"
|
||||||
|
#include "user/guest-host.h"
|
||||||
#include "qemu/main-loop.h"
|
#include "qemu/main-loop.h"
|
||||||
#include "user/page-protection.h"
|
#include "user/page-protection.h"
|
||||||
#include "exec/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)
|
static int dump_region(void *opaque, vaddr start, vaddr end, int prot)
|
||||||
{
|
{
|
||||||
FILE *f = opaque;
|
FILE *f = opaque;
|
||||||
|
uint64_t mask;
|
||||||
|
int width;
|
||||||
|
|
||||||
fprintf(f, TARGET_ABI_FMT_ptr "-" TARGET_ABI_FMT_ptr
|
if (guest_addr_max <= UINT32_MAX) {
|
||||||
" " TARGET_ABI_FMT_ptr " %c%c%c\n",
|
mask = UINT32_MAX, width = 8;
|
||||||
(abi_ptr)start, (abi_ptr)end, (abi_ptr)(end - start),
|
} 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_READ) ? 'r' : '-'),
|
||||||
((prot & PAGE_WRITE) ? 'w' : '-'),
|
((prot & PAGE_WRITE) ? 'w' : '-'),
|
||||||
((prot & PAGE_EXEC) ? 'x' : '-'));
|
((prot & PAGE_EXEC) ? 'x' : '-'));
|
||||||
|
@ -215,10 +225,10 @@ static int dump_region(void *opaque, vaddr start, vaddr end, int prot)
|
||||||
/* dump memory mappings */
|
/* dump memory mappings */
|
||||||
void page_dump(FILE *f)
|
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",
|
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);
|
walk_memory_regions(f, dump_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1135,7 +1145,7 @@ static uint64_t do_ld8_mmu(CPUState *cpu, vaddr addr, MemOpIdx oi,
|
||||||
return ret;
|
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)
|
MemOpIdx oi, uintptr_t ra)
|
||||||
{
|
{
|
||||||
void *haddr;
|
void *haddr;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue