2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License as published by
4
* the Free Software Foundation; either version 2 of the License, or
5
* (at your option) any later version.
2
* This library is free software; you can redistribute it and/or
3
* modify it under the terms of the GNU Lesser General Public
4
* License as published by the Free Software Foundation; either
5
* version 2.1 of the License, or (at your option) any later version.
7
* This program is distributed in the hope that it will be useful,
7
* This library is distributed in the hope that it will be useful,
8
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
* GNU General Public License for more details.
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
* Lesser General Public License for more details.
12
* You should have received a copy of the GNU General Public License
13
* along with this program; if not, write to the Free Software
14
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
12
* You should have received a copy of the GNU Lesser General Public
13
* License along with this library; if not, write to the Free Software
14
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
* Copyright (c) 2007 Isaku Yamahata <yamahata at valinux co jp>
17
17
* VA Linux Systems Japan K.K.
43
static int nr_gpfns(int xc_handle, domid_t domid)
43
static int nr_gpfns(xc_interface *xch, domid_t domid)
45
return xc_memory_op(xc_handle, XENMEM_maximum_gpfn, &domid) + 1;
45
return xc_domain_maximum_gpfn(xch, domid) + 1;
55
xc_core_arch_memory_map_get(int xc_handle, struct xc_core_arch_context *unused,
55
xc_core_arch_memory_map_get(xc_interface *xch, struct xc_core_arch_context *unused,
56
56
xc_dominfo_t *info, shared_info_any_t *live_shinfo,
57
57
xc_core_memory_map_t **mapp,
58
58
unsigned int *nr_entries)
60
unsigned long p2m_size = nr_gpfns(xc_handle, info->domid);
60
unsigned long p2m_size = nr_gpfns(xch, info->domid);
61
61
xc_core_memory_map_t *map;
63
63
map = malloc(sizeof(*map));
79
xc_core_arch_map_p2m_rw(int xc_handle, struct domain_info_context *dinfo, xc_dominfo_t *info,
79
xc_core_arch_map_p2m_rw(xc_interface *xch, struct domain_info_context *dinfo, xc_dominfo_t *info,
80
80
shared_info_any_t *live_shinfo, xen_pfn_t **live_p2m,
81
81
unsigned long *pfnp, int rw)
95
dinfo->p2m_size = nr_gpfns(xc_handle, info->domid);
95
dinfo->p2m_size = nr_gpfns(xch, info->domid);
96
96
if ( dinfo->p2m_size < info->nr_pages )
98
98
ERROR("p2m_size < nr_pages -1 (%lx < %lx", dinfo->p2m_size, info->nr_pages - 1);
102
102
live_p2m_frame_list_list =
103
xc_map_foreign_range(xc_handle, dom, PAGE_SIZE, PROT_READ,
103
xc_map_foreign_range(xch, dom, PAGE_SIZE, PROT_READ,
104
104
GET_FIELD(live_shinfo, arch.pfn_to_mfn_frame_list_list));
106
106
if ( !live_p2m_frame_list_list )
129
129
p2m_frame_list_list[i] = ((uint32_t *)p2m_frame_list_list)[i];
131
131
live_p2m_frame_list =
132
xc_map_foreign_pages(xc_handle, dom, PROT_READ,
132
xc_map_foreign_pages(xch, dom, PROT_READ,
133
133
p2m_frame_list_list,
134
134
P2M_FLL_ENTRIES);
156
156
for ( i = P2M_FL_ENTRIES - 1; i >= 0; i-- )
157
157
p2m_frame_list[i] = ((uint32_t *)p2m_frame_list)[i];
159
*live_p2m = xc_map_foreign_pages(xc_handle, dom,
159
*live_p2m = xc_map_foreign_pages(xch, dom,
160
160
rw ? (PROT_READ | PROT_WRITE) : PROT_READ,
194
xc_core_arch_map_p2m(int xc_handle, unsigned int guest_width, xc_dominfo_t *info,
194
xc_core_arch_map_p2m(xc_interface *xch, unsigned int guest_width, xc_dominfo_t *info,
195
195
shared_info_any_t *live_shinfo, xen_pfn_t **live_p2m,
196
196
unsigned long *pfnp)
198
198
struct domain_info_context _dinfo = { .guest_width = guest_width };
199
199
struct domain_info_context *dinfo = &_dinfo;
200
return xc_core_arch_map_p2m_rw(xc_handle, dinfo, info,
200
return xc_core_arch_map_p2m_rw(xch, dinfo, info,
201
201
live_shinfo, live_p2m, pfnp, 0);
205
xc_core_arch_map_p2m_writable(int xc_handle, unsigned int guest_width, xc_dominfo_t *info,
205
xc_core_arch_map_p2m_writable(xc_interface *xch, unsigned int guest_width, xc_dominfo_t *info,
206
206
shared_info_any_t *live_shinfo, xen_pfn_t **live_p2m,
207
207
unsigned long *pfnp)
209
209
struct domain_info_context _dinfo = { .guest_width = guest_width };
210
210
struct domain_info_context *dinfo = &_dinfo;
211
return xc_core_arch_map_p2m_rw(xc_handle, dinfo, info,
211
return xc_core_arch_map_p2m_rw(xch, dinfo, info,
212
212
live_shinfo, live_p2m, pfnp, 1);