I am looking in to implementing mem_event for PV guests that use PV mmu_ops. Initially I am thinking of supporting 64-bit PV guests. I think only RW, RX and R permissions would be possible. I am looking at the hypercall interfaces that
do the pagetable manipulations. In addition to the hypercalls I am also looking at the pagetable write emulation code.
My plan is to set the page permissions in:
do_mmu_update()
do_mmuext_op(MMUEXT_PIN_L1_TABLE)
__do_update_va_mapping()
ptwr_emulated_update()
I would then hook in to do_page_fault() to perform the access check and send the request to the mem_event handler. Please let me know if I am on the right track and if this is a sane approach?
Questions…
I am not sure where to store the p2m_access value in the PTE. EPT uses bits 61:58. The spec says they are ignored for regular pagetables, so is it safe to use these bits? If not, do you have any suggestions about where I can stash these
bits?
The default functions for p2m->set_entry() and p2m->get_entry() default to the shadow PT variants which I am assuming cannot be used in the PV cases and I would need to do something along the lines of mod_l1_entry(). Is this correct?
Thanks,
Aravindh