Browse Source

accel/hvf: Create hvf_protect_clean_range, hvf_unprotect_dirty_range

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Message-ID: <20251103101034.59039-2-philmd@linaro.org>
pull/316/head
Richard Henderson 11 months ago
committed by Philippe Mathieu-Daudé
parent
commit
43e97e2c1a
  1. 25
      accel/hvf/hvf-all.c
  2. 1
      accel/hvf/trace-events
  3. 3
      include/system/hvf_int.h

25
accel/hvf/hvf-all.c

@ -58,6 +58,31 @@ void assert_hvf_ok_impl(hv_return_t ret, const char *file, unsigned int line,
abort();
}
static void do_hv_vm_protect(hwaddr start, size_t size,
hv_memory_flags_t flags)
{
hv_return_t ret;
trace_hvf_vm_protect(start, size, flags,
flags & HV_MEMORY_READ ? 'R' : '-',
flags & HV_MEMORY_WRITE ? 'W' : '-',
flags & HV_MEMORY_EXEC ? 'X' : '-');
ret = hv_vm_protect(start, size, flags);
assert_hvf_ok(ret);
}
void hvf_protect_clean_range(hwaddr addr, size_t size)
{
do_hv_vm_protect(addr, size, HV_MEMORY_READ | HV_MEMORY_EXEC);
}
void hvf_unprotect_dirty_range(hwaddr addr, size_t size)
{
do_hv_vm_protect(addr, size,
HV_MEMORY_READ | HV_MEMORY_WRITE | HV_MEMORY_EXEC);
}
static int do_hvf_set_memory(hvf_slot *slot, hv_memory_flags_t flags)
{
struct mac_slot *macslot;

1
accel/hvf/trace-events

@ -5,3 +5,4 @@
# hvf-accel-ops.c
hvf_vm_map(uint64_t paddr, uint64_t size, void *vaddr, uint8_t flags, const char r, const char w, const char e) "paddr:0x%016"PRIx64" size:0x%08"PRIx64" vaddr:%p flags:0x%02x/%c%c%c"
hvf_vm_unmap(uint64_t paddr, uint64_t size) "paddr:0x%016"PRIx64" size:0x%08"PRIx64
hvf_vm_protect(uint64_t paddr, size_t size, uint8_t flags, const char r, const char w, const char e) "paddr:0x%016"PRIx64" size:0x%08zx flags:0x%02x/%c%c%c"

3
include/system/hvf_int.h

@ -89,6 +89,9 @@ int hvf_arch_get_registers(CPUState *);
/* Must be called by the owning thread */
void hvf_arch_update_guest_debug(CPUState *cpu);
void hvf_protect_clean_range(hwaddr addr, size_t size);
void hvf_unprotect_dirty_range(hwaddr addr, size_t size);
struct hvf_sw_breakpoint {
vaddr pc;
vaddr saved_insn;

Loading…
Cancel
Save