ia64/xen-unstable

view xen/arch/ia64/vmx/save.c @ 16171:e7d7a4adf357

[IA64] vti domain save/restore: implement hvm_save/load. work in progress.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Alex Williamson <alex.williamson@hp.com>
date Sun Oct 21 14:39:07 2007 -0600 (2007-10-21)
parents
children c0bdfda5183d
line source
1 /*
2 * hvm/save.c: Save and restore HVM guest's emulated hardware state.
3 *
4 * Copyright (c) 2007, Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
6 * IA64 support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
23 #include <xen/types.h>
24 #include <xen/hvm/save.h>
26 void
27 arch_hvm_save(struct hvm_save_header *hdr)
28 {
29 unsigned int i;
31 for (i = 0; i < 5; ++i)
32 hdr->cpuid[i] = ia64_get_cpuid(i);
33 }
35 int
36 arch_hvm_load(struct hvm_save_header *hdr)
37 {
38 unsigned int i;
39 if (hdr->magic != HVM_FILE_MAGIC) {
40 gdprintk(XENLOG_ERR,
41 "HVM restore: bad magic number %#"PRIx64"\n", hdr->magic);
42 return -1;
43 }
45 if (hdr->version != HVM_FILE_VERSION) {
46 gdprintk(XENLOG_ERR,
47 "HVM restore: unsupported version %"PRIx64"\n", hdr->version);
48 return -1;
49 }
51 for (i = 0; i < 5; ++i) {
52 unsigned long cpuid = ia64_get_cpuid(i);
53 /* TODO: need to define how big a difference is acceptable */
54 if (hdr->cpuid[i] != cpuid)
55 gdprintk(XENLOG_WARNING,
56 "HVM restore: saved CPUID[%d] (%#lx) "
57 "does not match host (%#lx).\n", i, hdr->cpuid[i], cpuid);
58 }
60 return 0;
61 }
63 /*
64 * Local variables:
65 * mode: C
66 * c-set-style: "BSD"
67 * c-basic-offset: 4
68 * tab-width: 4
69 * indent-tabs-mode: nil
70 * End:
71 */