debuggers.hg

view xen/arch/x86/hvm/save.c @ 16604:01c9b2b3118a

hvm stdvga: Do not emulate PIO reads inside Xen. They should be rare
(PIO write emulation is really for book-keeping to detect when we
enter/leave stdvga mode, and to work out what to do with mmio
accesses), and we may do the wrong thing depending on emulated SVGA
hardware and current mode.

This simplifies the code and means that 'stdvga=1' once again works
properly and causes the stdvga bios to be loaded by hvmloader.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Sat Dec 08 16:57:13 2007 +0000 (2007-12-08)
parents 0f792d2c7ee3
children 82bbce59b65d
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 /* VGA state is not saved/restored, so we nobble the cache. */
63 d->arch.hvm_domain.stdvga.cache = 0;
65 return 0;
66 }
68 /*
69 * Local variables:
70 * mode: C
71 * c-set-style: "BSD"
72 * c-basic-offset: 4
73 * tab-width: 4
74 * indent-tabs-mode: nil
75 * End:
76 */