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

Re: [Xen-devel] Mem_event API and MEM_EVENT_REASON_SINGLESTEP



On Thu, Nov 29, 2012 at 7:18 AM, Razvan Cojocaru <rzvncj@xxxxxxxxx> wrote:
>>
>> 1. I haven't been able to find an example of how single-stepping via the
>> mem_event API might work. Can you point me to some code that does this
>> (or a paper, etc.)?
>
>
> This is what I got so far (assume the xen-access.c source code file):
>
> int main(int argc, char *argv[])
> {
> [...]
>     rc = xc_hvm_set_mem_access(xch, domain_id,
>                                default_access, ~0ull, 0);
>     rc = xc_hvm_set_mem_access(xch, domain_id,
>                                default_access, 0,
>                                xenaccess->domain_info->max_pages);
>     xc_set_hvm_param(xch, domain_id,
>                      HVM_PARAM_MEMORY_EVENT_SINGLE_STEP,
>                      HVMPME_mode_sync);
> [...]
>             case MEM_EVENT_REASON_SINGLESTEP:
>                 printf("SINGLESTEP: gla: %lx gfn %lx\n",
>                        req.gla, req.gfn);
>                 // If something to do with gfn/gfa,
>                 // stop single-stepping this domain and
>                 // start faulting again on page writes.
>                 break;
>
>             case MEM_EVENT_REASON_VIOLATION:
>                 [...]
>                 if ( default_access != after_first_access ) {
>                     rc = xc_hvm_set_mem_access(xch, domain_id,
>                                                after_first_access,
>                                                req.gfn, 1);
>                     xc_domain_debug_control(xch, domain_id,
>                          XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON,
>                          req.vcpu_id);
>                 }
> [...]
> }
>
> Not quite sure what to do with gla and gfn except print them out at this 
> point, though. Again, the condition for stopping single-step mode is that a 
> page write happened. Any help is appreciated.

After you set single stepping on for a VCPU and resume, you should see
a single step mem_event soon after. What is the behavior that you are
observing? Are you trying this on an UP or SMP guest?

Thanks,
AP

_______________________________________________
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®.