debuggers.hg

view tools/libxl/xenguest.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 43bce9566a91
children 779c0ef9682c
line source
1 /*
2 * Copyright (C) 2009 Citrix Ltd.
3 * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published
7 * by the Free Software Foundation; version 2.1 only. with the special
8 * exception on linking described in file LICENSE.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 */
16 #include <xenctrl.h>
17 #include <xenguest.h>
18 #include <sys/mman.h>
19 #include <xen/hvm/hvm_info_table.h>
21 int hvm_build_set_params(int handle, uint32_t domid,
22 int apic, int acpi, int pae, int nx, int viridian,
23 int vcpus, int store_evtchn, unsigned long *store_mfn)
24 {
25 struct hvm_info_table *va_hvm;
26 uint8_t *va_map, sum;
27 int i;
29 va_map = xc_map_foreign_range(handle, domid,
30 XC_PAGE_SIZE, PROT_READ | PROT_WRITE,
31 HVM_INFO_PFN);
32 if (va_map == NULL)
33 return -1;
35 va_hvm = (struct hvm_info_table *)(va_map + HVM_INFO_OFFSET);
36 va_hvm->acpi_enabled = acpi;
37 va_hvm->apic_mode = apic;
38 va_hvm->nr_vcpus = vcpus;
39 for (i = 0, sum = 0; i < va_hvm->length; i++)
40 sum += ((uint8_t *) va_hvm)[i];
41 va_hvm->checksum -= sum;
42 munmap(va_map, XC_PAGE_SIZE);
44 xc_get_hvm_param(handle, domid, HVM_PARAM_STORE_PFN, store_mfn);
45 xc_set_hvm_param(handle, domid, HVM_PARAM_PAE_ENABLED, pae);
46 #if defined(__i386__) || defined(__x86_64__)
47 xc_set_hvm_param(handle, domid, HVM_PARAM_VIRIDIAN, viridian);
48 #endif
49 xc_set_hvm_param(handle, domid, HVM_PARAM_STORE_EVTCHN, store_evtchn);
50 return 0;
51 }