ia64/xen-unstable

view xen/arch/x86/hvm/save.c @ 16363:0f792d2c7ee3

Fix i386 Xen build.
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Thu Nov 08 18:14:00 2007 +0000 (2007-11-08)
parents c0bdfda5183d
children 01c9b2b3118a
line source
1 /*
2 * hvm/save.c: Save and restore HVM guest's emulated hardware state.
3 *
4 * Copyright (c) 2004, Intel Corporation.
5 * Copyright (c) 2007, XenSource Inc.
6 * Copyright (c) 2007, Isaku Yamahata <yamahata at valinux co jp>
7 * VA Linux Systems Japan K.K.
8 * split x86 specific part
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms and conditions of the GNU General Public License,
12 * version 2, as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 *
19 * You should have received a copy of the GNU General Public License along with
20 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21 * Place - Suite 330, Boston, MA 02111-1307 USA.
22 */
24 #include <asm/hvm/support.h>
25 #include <public/hvm/save.h>
27 void arch_hvm_save(struct domain *d, struct hvm_save_header *hdr)
28 {
29 uint32_t eax, ebx, ecx, edx;
31 /* Save some CPUID bits */
32 cpuid(1, &eax, &ebx, &ecx, &edx);
33 hdr->cpuid = eax;
35 hdr->pad0 = 0;
36 }
38 int arch_hvm_load(struct domain *d, struct hvm_save_header *hdr)
39 {
40 uint32_t eax, ebx, ecx, edx;
42 if ( hdr->magic != HVM_FILE_MAGIC )
43 {
44 gdprintk(XENLOG_ERR,
45 "HVM restore: bad magic number %#"PRIx32"\n", hdr->magic);
46 return -1;
47 }
49 if ( hdr->version != HVM_FILE_VERSION )
50 {
51 gdprintk(XENLOG_ERR,
52 "HVM restore: unsupported version %u\n", hdr->version);
53 return -1;
54 }
56 cpuid(1, &eax, &ebx, &ecx, &edx);
57 /* TODO: need to define how big a difference is acceptable? */
58 if ( hdr->cpuid != eax )
59 gdprintk(XENLOG_WARNING, "HVM restore: saved CPUID (%#"PRIx32") "
60 "does not match host (%#"PRIx32").\n", hdr->cpuid, eax);
62 #ifdef __x86_64__
63 /* VGA state is not saved/restored, so we nobble the cache. */
64 d->arch.hvm_domain.stdvga.cache = 0;
65 #endif
67 return 0;
68 }
70 /*
71 * Local variables:
72 * mode: C
73 * c-set-style: "BSD"
74 * c-basic-offset: 4
75 * tab-width: 4
76 * indent-tabs-mode: nil
77 * End:
78 */