Mailing List Archive

Handling a MEM_EVENT_REASON_CR3
Hello,

a few questions about receiving a MEM_EVENT_REASON_CR3 even in dom0
userspace:

1. If I call

xc_set_hvm_param(xci, domain_id,
HVM_PARAM_MEMORY_EVENT_CR3,
HVMPME_onchangeonly);

that only triggers a CR3 event if the new value that the guest writes to
CR3 is different from the existing value, is that assumption correct?

2. mem_event.h says that if "CR3 was hit: gfn is CR3 value". I'm
assuming that gfn is the _new_ value, and that the old value is
unavailable, is that also correct?

3. Is it possible to, upon intercepting the CR3 write, write a
_different_ value to CR3, instead of gfn?

Thanks,
Razvan Cojocaru

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
Re: Handling a MEM_EVENT_REASON_CR3 [ In reply to ]
At 16:16 +0200 on 12 Dec (1355329007), Razvan Cojocaru wrote:
> Hello,
>
> a few questions about receiving a MEM_EVENT_REASON_CR3 even in dom0
> userspace:
>
> 1. If I call
>
> xc_set_hvm_param(xci, domain_id,
> HVM_PARAM_MEMORY_EVENT_CR3,
> HVMPME_onchangeonly);
>
> that only triggers a CR3 event if the new value that the guest writes to
> CR3 is different from the existing value, is that assumption correct?

Yes, I think so. That's what HVMPME_onchangeonly ought to do.
Did you try it?

> 2. mem_event.h says that if "CR3 was hit: gfn is CR3 value". I'm
> assuming that gfn is the _new_ value, and that the old value is
> unavailable, is that also correct?

Yes.

> 3. Is it possible to, upon intercepting the CR3 write, write a
> _different_ value to CR3, instead of gfn?

Yes. you can use either xc_vcpu_getcontext()/xc_vcpu_setcontext()
or xc_domain_hvm_getcontext_partial()/xc_domain_hvm_setcontext() to read
and write the vCPU registers.

Cheers,

Tim.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel