debuggers.hg

view xen/include/public/vmx_assist.h @ 4640:e02fc4c21740

bitkeeper revision 1.1345 (4266bd05lHlHunb0CEvOq60j2DvKCQ)

[PATCH] VMX world switch

The attached code implements a VMX world switch to vmxassist (a small assist
module residing in a VMX enabled partition where it is responsible for
emulating real mode) whever CR0.PE is disabled.

The patch temporarily disables the PGE feature flag in cpuid as it is
currently broken (try running an unmodified 2.6 kernel that sets PGE in
mm/init.c/paging_init()).

The patch adds consistency checks before setting the ARCH_VMX_IO_WAIT state
to detect race conditions on SMP systems.

Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com>
Signed-off-by: ian@xensource.com
author leendert@watson.ibm.com[iap10]
date Wed Apr 20 20:35:17 2005 +0000 (2005-04-20)
parents
children 97aa85e7aa21
line source
1 /*
2 * vmx_assist.h: Context definitions for the VMXASSIST world switch.
3 *
4 * Leendert van Doorn, leendert@watson.ibm.com
5 * Copyright (c) 2005, International Business Machines Corporation.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
18 * Place - Suite 330, Boston, MA 02111-1307 USA.
19 *
20 */
21 #ifndef _VMX_ASSIST_H_
22 #define _VMX_ASSIST_H_
24 #define VMXASSIST_BASE 0xE0000
25 #define VMXASSIST_MAGIC 0x17101966
26 #define VMXASSIST_MAGIC_OFFSET (VMXASSIST_BASE+8)
28 #define VMXASSIST_NEW_CONTEXT (VMXASSIST_BASE + 12)
29 #define VMXASSIST_OLD_CONTEXT (VMXASSIST_NEW_CONTEXT + 4)
31 #ifndef __ASSEMBLY__
33 union vmcs_arbytes {
34 struct arbyte_fields {
35 unsigned int seg_type : 4,
36 s : 1,
37 dpl : 2,
38 p : 1,
39 reserved0 : 4,
40 avl : 1,
41 reserved1 : 1,
42 default_ops_size: 1,
43 g : 1,
44 null_bit : 1,
45 reserved2 : 15;
46 } __attribute__((packed)) fields;
47 unsigned int bytes;
48 };
50 /*
51 * World switch state
52 */
53 typedef struct vmx_assist_context {
54 unsigned long eip; /* execution pointer */
55 unsigned long esp; /* stack point */
56 unsigned long eflags; /* flags register */
57 unsigned long cr0;
58 unsigned long cr3; /* page table directory */
59 unsigned long cr4;
60 unsigned long idtr_limit; /* idt */
61 unsigned long idtr_base;
62 unsigned long gdtr_limit; /* gdt */
63 unsigned long gdtr_base;
64 unsigned long cs_sel; /* cs selector */
65 unsigned long cs_limit;
66 unsigned long cs_base;
67 union vmcs_arbytes cs_arbytes;
68 unsigned long ds_sel; /* ds selector */
69 unsigned long ds_limit;
70 unsigned long ds_base;
71 union vmcs_arbytes ds_arbytes;
72 unsigned long es_sel; /* es selector */
73 unsigned long es_limit;
74 unsigned long es_base;
75 union vmcs_arbytes es_arbytes;
76 unsigned long ss_sel; /* ss selector */
77 unsigned long ss_limit;
78 unsigned long ss_base;
79 union vmcs_arbytes ss_arbytes;
80 unsigned long fs_sel; /* fs selector */
81 unsigned long fs_limit;
82 unsigned long fs_base;
83 union vmcs_arbytes fs_arbytes;
84 unsigned long gs_sel; /* gs selector */
85 unsigned long gs_limit;
86 unsigned long gs_base;
87 union vmcs_arbytes gs_arbytes;
88 unsigned long tr_sel; /* task selector */
89 unsigned long tr_limit;
90 unsigned long tr_base;
91 union vmcs_arbytes tr_arbytes;
92 unsigned long ldtr_sel; /* ldtr selector */
93 unsigned long ldtr_limit;
94 unsigned long ldtr_base;
95 union vmcs_arbytes ldtr_arbytes;
96 } vmx_assist_context_t;
98 #endif /* __ASSEMBLY__ */
100 #endif /* _VMX_ASSIST_H_ */