debuggers.hg
changeset 22718:32ec2fab6ea4
mem_access: added trap injection to libxc
* Carries forward the trap injection hypercall into libxc
Signed-off-by: Joe Epstein <jepstein98@gmail.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
* Carries forward the trap injection hypercall into libxc
Signed-off-by: Joe Epstein <jepstein98@gmail.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
author | Joe Epstein <jepstein98@gmail.com> |
---|---|
date | Fri Jan 07 11:54:50 2011 +0000 (2011-01-07) |
parents | d9dca2bfe6b2 |
children | 6ec9d1491f2a |
files | tools/libxc/xc_misc.c tools/libxc/xenctrl.h |
line diff
1.1 --- a/tools/libxc/xc_misc.c Fri Jan 07 11:54:48 2011 +0000 1.2 +++ b/tools/libxc/xc_misc.c Fri Jan 07 11:54:50 2011 +0000 1.3 @@ -572,6 +572,38 @@ int xc_hvm_get_mem_access( 1.4 return rc; 1.5 } 1.6 1.7 +int xc_hvm_inject_trap( 1.8 + xc_interface *xch, domid_t dom, int vcpu, uint32_t trap, uint32_t error_code, 1.9 + uint64_t cr2) 1.10 +{ 1.11 + DECLARE_HYPERCALL; 1.12 + DECLARE_HYPERCALL_BUFFER(struct xen_hvm_inject_trap, arg); 1.13 + int rc; 1.14 + 1.15 + arg = xc_hypercall_buffer_alloc(xch, arg, sizeof(*arg)); 1.16 + if ( arg == NULL ) 1.17 + { 1.18 + PERROR("Could not allocate memory for xc_hvm_inject_trap hypercall"); 1.19 + return -1; 1.20 + } 1.21 + 1.22 + arg->domid = dom; 1.23 + arg->vcpuid = vcpu; 1.24 + arg->trap = trap; 1.25 + arg->error_code = error_code; 1.26 + arg->cr2 = cr2; 1.27 + 1.28 + hypercall.op = __HYPERVISOR_hvm_op; 1.29 + hypercall.arg[0] = HVMOP_inject_trap; 1.30 + hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(arg); 1.31 + 1.32 + rc = do_xen_hypercall(xch, &hypercall); 1.33 + 1.34 + xc_hypercall_buffer_free(xch, arg); 1.35 + 1.36 + return rc; 1.37 +} 1.38 + 1.39 /* 1.40 * Local variables: 1.41 * mode: C
2.1 --- a/tools/libxc/xenctrl.h Fri Jan 07 11:54:48 2011 +0000 2.2 +++ b/tools/libxc/xenctrl.h Fri Jan 07 11:54:50 2011 +0000 2.3 @@ -1426,6 +1426,14 @@ int xc_hvm_get_mem_access( 2.4 xc_interface *xch, domid_t dom, uint64_t pfn, hvmmem_access_t* memaccess); 2.5 2.6 /* 2.7 + * Injects a hardware/software CPU trap, to take effect the next time the HVM 2.8 + * resumes. 2.9 + */ 2.10 +int xc_hvm_inject_trap( 2.11 + xc_interface *xch, domid_t dom, int vcpu, uint32_t trap, uint32_t error_code, 2.12 + uint64_t cr2); 2.13 + 2.14 +/* 2.15 * LOGGING AND ERROR REPORTING 2.16 */ 2.17