All of lore.kernel.org
 help / color / mirror / Atom feed
From: Razvan Cojocaru <rzvncj@gmail.com>
To: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: Mem_event API and MEM_EVENT_REASON_SINGLESTEP
Date: Thu, 29 Nov 2012 17:18:16 +0200	[thread overview]
Message-ID: <50B77CB8.1040606@gmail.com> (raw)
In-Reply-To: <50B77375.9070904@gmail.com>

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

Thanks,
Razvan Cojocaru

  reply	other threads:[~2012-11-29 15:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-29 14:38 Mem_event API and MEM_EVENT_REASON_SINGLESTEP Razvan Cojocaru
2012-11-29 15:18 ` Razvan Cojocaru [this message]
2012-11-30 19:50   ` AP
2012-11-30 20:09     ` Razvan Cojocaru
2012-11-30 20:24       ` AP
2012-11-30 20:45         ` Razvan Cojocaru
2012-11-30 20:56           ` AP
2012-11-30 21:04             ` Razvan Cojocaru
2012-11-30 21:17               ` AP
2012-12-04  7:23                 ` Razvan Cojocaru
2012-11-30 21:07       ` Tim Deegan
2012-11-30 21:14         ` Razvan Cojocaru
2012-11-29 15:58 ` Tim Deegan
2012-11-29 16:20   ` Razvan Cojocaru
2012-11-29 18:05     ` Tim Deegan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50B77CB8.1040606@gmail.com \
    --to=rzvncj@gmail.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.