debuggers.hg

changeset 22715:8af5bab1bf43

mem_access: access listener can be required

* Adds the ability to set that a domain that an access listener;
that is, it pauses the VCPU if there is no memory event listener.

Signed-off-by: Joe Epstein <jepstein98@gmail.com>
Acked-by: Keir Fraser <keir@xen.org>
author Joe Epstein <jepstein98@gmail.com>
date Fri Jan 07 11:54:42 2011 +0000 (2011-01-07)
parents 02efc054da7b
children 76e07538870e
files xen/arch/x86/domctl.c xen/include/public/domctl.h
line diff
     1.1 --- a/xen/arch/x86/domctl.c	Fri Jan 07 11:54:40 2011 +0000
     1.2 +++ b/xen/arch/x86/domctl.c	Fri Jan 07 11:54:42 2011 +0000
     1.3 @@ -1566,6 +1566,26 @@ long arch_do_domctl(
     1.4      break;
     1.5  #endif /* __x86_64__ */
     1.6  
     1.7 +    case XEN_DOMCTL_set_access_required:
     1.8 +    {
     1.9 +        struct domain *d;
    1.10 +        struct p2m_domain* p2m;
    1.11 +        
    1.12 +        ret = -EPERM;
    1.13 +        if ( current->domain->domain_id == domctl->domain )
    1.14 +            break;
    1.15 +
    1.16 +        ret = -ESRCH;
    1.17 +        d = rcu_lock_domain_by_id(domctl->domain);
    1.18 +        if ( d != NULL )
    1.19 +        {
    1.20 +            p2m = p2m_get_hostp2m(d);
    1.21 +            p2m->access_required = domctl->u.access_required.access_required;
    1.22 +            rcu_unlock_domain(d);
    1.23 +        } 
    1.24 +    }
    1.25 +    break;
    1.26 +
    1.27      default:
    1.28          ret = -ENOSYS;
    1.29          break;
     2.1 --- a/xen/include/public/domctl.h	Fri Jan 07 11:54:40 2011 +0000
     2.2 +++ b/xen/include/public/domctl.h	Fri Jan 07 11:54:42 2011 +0000
     2.3 @@ -820,6 +820,16 @@ typedef struct xen_domctl_vcpuextstate x
     2.4  DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpuextstate_t);
     2.5  #endif
     2.6  
     2.7 +/* XEN_DOMCTL_set_access_required: sets whether a memory event listener
     2.8 + * must be present to handle page access events: if false, the page
     2.9 + * access will revert to full permissions if no one is listening;
    2.10 + *  */
    2.11 +struct xen_domctl_set_access_required {
    2.12 +    uint8_t access_required;
    2.13 +};
    2.14 +typedef struct xen_domctl_set_access_required xen_domctl_set_access_required_t;
    2.15 +DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_access_required_t);
    2.16 +
    2.17  struct xen_domctl {
    2.18      uint32_t cmd;
    2.19  #define XEN_DOMCTL_createdomain                   1
    2.20 @@ -882,6 +892,7 @@ struct xen_domctl {
    2.21  #define XEN_DOMCTL_getpageframeinfo3             61
    2.22  #define XEN_DOMCTL_setvcpuextstate               62
    2.23  #define XEN_DOMCTL_getvcpuextstate               63
    2.24 +#define XEN_DOMCTL_set_access_required           64
    2.25  #define XEN_DOMCTL_gdbsx_guestmemio            1000
    2.26  #define XEN_DOMCTL_gdbsx_pausevcpu             1001
    2.27  #define XEN_DOMCTL_gdbsx_unpausevcpu           1002
    2.28 @@ -934,6 +945,7 @@ struct xen_domctl {
    2.29          struct xen_domctl_cpuid             cpuid;
    2.30          struct xen_domctl_vcpuextstate      vcpuextstate;
    2.31  #endif
    2.32 +        struct xen_domctl_set_access_required access_required;
    2.33          struct xen_domctl_gdbsx_memio       gdbsx_guest_memio;
    2.34          struct xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
    2.35          struct xen_domctl_gdbsx_domstatus   gdbsx_domstatus;