debuggers.hg

view tools/libxc/xc_mem_event.c @ 21067:b4a1832a916f

Update Xen version to 4.0.0-rc6
author Keir Fraser <keir.fraser@citrix.com>
date Tue Mar 09 18:18:05 2010 +0000 (2010-03-09)
parents 47ec2d131c22
children 779c0ef9682c
line source
1 /******************************************************************************
2 *
3 * xc_mem_event.c
4 *
5 * Interface to low-level memory event functionality.
6 *
7 * Copyright (c) 2009 Citrix Systems, Inc. (Patrick Colp)
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
24 #include "xc_private.h"
26 int xc_mem_event_control(int xc_handle, domid_t domain_id, unsigned int op,
27 unsigned int mode, void *shared_page,
28 void *ring_page, unsigned long gfn)
29 {
30 DECLARE_DOMCTL;
32 domctl.cmd = XEN_DOMCTL_mem_event_op;
33 domctl.domain = domain_id;
34 domctl.u.mem_event_op.op = op;
35 domctl.u.mem_event_op.mode = mode;
37 domctl.u.mem_event_op.shared_addr = (unsigned long)shared_page;
38 domctl.u.mem_event_op.ring_addr = (unsigned long)ring_page;
40 domctl.u.mem_event_op.gfn = gfn;
42 return do_domctl(xc_handle, &domctl);
43 }
45 int xc_mem_event_enable(int xc_handle, domid_t domain_id,
46 void *shared_page, void *ring_page)
47 {
48 return xc_mem_event_control(xc_handle, domain_id,
49 XEN_DOMCTL_MEM_EVENT_OP_ENABLE, 0,
50 shared_page, ring_page, INVALID_MFN);
51 }
53 int xc_mem_event_disable(int xc_handle, domid_t domain_id)
54 {
55 return xc_mem_event_control(xc_handle, domain_id,
56 XEN_DOMCTL_MEM_EVENT_OP_DISABLE, 0,
57 NULL, NULL, INVALID_MFN);
58 }