[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] hvm_emulate_one() usage



At 16:10 +0200 on 10 Jan (1357834233), Razvan Cojocaru wrote:
> >Hi,
> 
> Hello Tim, thank you for your answer!
> 
> >How about (from your user-space tool):
> >  - use XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON to enable single-stepping.
> >  - respond to the mem_event that you're handling, causing the vcpu to be
> >    unpaused.
> >Then when the vcpu is scheduled, it will single-step in its own context,
> >and you'll get another mem_event (assuming you've set
> >HVM_PARAM_MEMORY_EVENT_SINGLE_STEP).  Once that happens:
> >  - use XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_OFF to disable single-stepping.
> >  - respond to that event to unpause the vcpu.
> >
> >I guess if you're tyring to have some special case in the single-step
> >handler that allows it to write to a page that it normally coudn't you
> >might need to add an interface for controlling that.
> 
> Thanks, looks like something like that is the only way this would 
> theoretically work. The problem is, for each allowed (emulated) write - 
> which is the 'normal' case - there would be 3 dom0 <-> hypervisor 
> roundtrips (2 fault mem_events and 1 single step mem_event). Since 
> writes that need to be allowed do happen quite a lot, the domU would 
> become very slow.
> 
> I was very much hoping to be able to do this with only one (page fault) 
> mem_event per emulated write instruction.

I'm sure that can be done.  The trick is to make sure the emulation
happens in the guest context (i.e. when the guest is scheduled).  You
could do that by (e.g.) defining a new mem_access type 'single-step
writes' where a write fault triggers a single-step emulation in the
fault handler as well as an asynchronous mem-event.

Tim.

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.