gasp_walk_filter_t

Prototype for function that applies a walk filter

Synopsis:

#include <qvm/gasp.h>
typedef void(* gasp_walk_filter_t)(uint64_t *guest_loc,
             size_t *length);

Arguments:

guest_loc
On input, this points to the start of the requested address range. On output, this points to the start of the first subrange that the walk filter allows to be written out.
length
On input, this points to the length of the requested address range. On output, this points to the length of the first allowed subrange.

Description:

A walk filter is used to have gasp_walk_*_filtered() return a subset of the memory that an unfiltered walk would normally return. The filter function is called with an intermediate physical memory address range. The filter can allow the entire block to be written by returning the parameters unmodified, or it can return the first subrange that it will allow. The latter action will cause the filter function to be called again with the remainder of the original range.

In these examples, guest_loc is 10 and length is 5, so locations 10 to 14 are originally requested.

Example 1: Goal is to allow locations 11, 13
  • guest_loc, length in: 10, 5 out: 11, 1
  • guest_loc, length in: 12, 3 out: 13, 1
  • guest_loc, length in: 14, 1 out: any, 0 (0=done with this block)
Example 2: Goal is to allow locations 10-11, 13-14
  • guest_loc, length in: 10, 5 out: 10, 2
  • guest_loc, length in: 12, 3 out: 13, 2 (done)