From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tristan Gingold Subject: PATCH: add xc_domain_setdebugging in xenctrl API Date: Sat, 23 Jun 2007 19:04:16 +0200 Message-ID: <20070623170416.GA5455@saphi> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="YZ5djTAD1cGYuMQK" Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com, Xen-ia64-devel , Alex Williamson List-Id: xen-devel@lists.xenproject.org --YZ5djTAD1cGYuMQK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, for ia64, I'd like to add xc_domain_setdebugging() in the xenctrl API. This patch implements it and modifies xc_ptrace.c to use it. The rationnal is enabling debugging tool not based on the ptrace API. The ptrace API is based on Linux ptrace which (at least on ia64) doesn't have many privilegied registers. I'd prefer this patch being integrated on xen-ia64-unstable tree but we need the OK from non-ia64 maintainers. Tristan. --YZ5djTAD1cGYuMQK Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="setdeb.diff" # HG changeset patch # User Tristan Gingold # Date 1182617932 -7200 # Node ID 675ccf45dc630166ad374023e119a68c48918088 # Parent 8a6a6d4afcb31c24ee87a5d30bebec41e8d38126 Add xc_domain_setdebugging in the xenctrl API. Use it in xc_ptrace.c Signed-off-by: Tristan Gingold diff -r 8a6a6d4afcb3 -r 675ccf45dc63 tools/libxc/xc_domain.c --- a/tools/libxc/xc_domain.c Fri Jun 22 11:48:49 2007 -0600 +++ b/tools/libxc/xc_domain.c Sat Jun 23 18:58:52 2007 +0200 @@ -696,6 +696,18 @@ int xc_get_hvm_param(int handle, domid_t return rc; } +int xc_domain_setdebugging(int xc_handle, + uint32_t domid, + unsigned int enable) +{ + DECLARE_DOMCTL; + + domctl.cmd = XEN_DOMCTL_setdebugging; + domctl.domain = domid; + domctl.u.setdebugging.enable = enable; + return do_domctl(xc_handle, &domctl); +} + /* * Local variables: * mode: C diff -r 8a6a6d4afcb3 -r 675ccf45dc63 tools/libxc/xc_ptrace.c --- a/tools/libxc/xc_ptrace.c Fri Jun 22 11:48:49 2007 -0600 +++ b/tools/libxc/xc_ptrace.c Sat Jun 23 18:58:52 2007 +0200 @@ -566,10 +566,7 @@ xc_ptrace( } if ( request == PTRACE_DETACH ) { - domctl.cmd = XEN_DOMCTL_setdebugging; - domctl.domain = current_domid; - domctl.u.setdebugging.enable = 0; - if ((retval = do_domctl(xc_handle, &domctl))) + if ((retval = xc_domain_setdebugging(xc_handle, current_domid, 0))) goto out_error_domctl; } regs_valid = 0; @@ -593,10 +590,7 @@ xc_ptrace( else if ((retval = xc_domain_pause(xc_handle, current_domid))) goto out_error_domctl; current_is_hvm = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_hvm_guest); - domctl.cmd = XEN_DOMCTL_setdebugging; - domctl.domain = current_domid; - domctl.u.setdebugging.enable = 1; - if ((retval = do_domctl(xc_handle, &domctl))) + if ((retval = xc_domain_setdebugging(xc_handle, current_domid, 1))) goto out_error_domctl; if (get_online_cpumap(xc_handle, &domctl.u.getdomaininfo, &cpumap)) diff -r 8a6a6d4afcb3 -r 675ccf45dc63 tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Fri Jun 22 11:48:49 2007 -0600 +++ b/tools/libxc/xenctrl.h Sat Jun 23 18:58:52 2007 +0200 @@ -433,6 +433,18 @@ int xc_domain_send_trigger(int xc_handle uint32_t trigger, uint32_t vcpu); +/** + * This function enables or disable debugging of a domain. + * + * @parm xc_handle a handle to an open hypervisor interface + * @parm domid the domain id to send trigger + * @parm enable true to enable debugging + * return 0 on success, -1 on failure + */ +int xc_domain_setdebugging(int xc_handle, + uint32_t domid, + unsigned int enable); + /* * EVENT CHANNEL FUNCTIONS */ --YZ5djTAD1cGYuMQK Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --YZ5djTAD1cGYuMQK--