ia64/xen-unstable

view xen/common/kernel.c @ 6832:5959fae4722a

Set NE bit for VMX guest CR0. VMCS guest CR0.NE bit must
be set, else it will cause "vm-entry failed".

Signed-off-by: Chengyuan Li <chengyuan.li@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Sep 14 13:37:50 2005 +0000 (2005-09-14)
parents 813c37b68376
children b35215021b32 9af349b055e5 3233e7ecfa9f
line source
1 /******************************************************************************
2 * kernel.c
3 *
4 * Copyright (c) 2002-2005 K A Fraser
5 */
7 #include <xen/config.h>
8 #include <xen/init.h>
9 #include <xen/lib.h>
10 #include <xen/errno.h>
11 #include <xen/compile.h>
12 #include <xen/sched.h>
13 #include <asm/current.h>
14 #include <public/version.h>
16 void cmdline_parse(char *cmdline)
17 {
18 char opt[100], *optval, *p = cmdline, *q;
19 struct kernel_param *param;
21 if ( p == NULL )
22 return;
24 /* Skip whitespace and the image name. */
25 while ( *p == ' ' )
26 p++;
27 if ( (p = strchr(p, ' ')) == NULL )
28 return;
30 for ( ; ; )
31 {
32 /* Skip whitespace. */
33 while ( *p == ' ' )
34 p++;
35 if ( *p == '\0' )
36 break;
38 /* Grab the next whitespace-delimited option. */
39 q = opt;
40 while ( (*p != ' ') && (*p != '\0') )
41 *q++ = *p++;
42 *q = '\0';
44 /* Search for value part of a key=value option. */
45 optval = strchr(opt, '=');
46 if ( optval != NULL )
47 *optval++ = '\0';
49 for ( param = &__setup_start; param <= &__setup_end; param++ )
50 {
51 if ( strcmp(param->name, opt ) != 0 )
52 continue;
54 switch ( param->type )
55 {
56 case OPT_STR:
57 if ( optval != NULL )
58 {
59 strncpy(param->var, optval, param->len);
60 ((char *)param->var)[param->len-1] = '\0';
61 }
62 break;
63 case OPT_UINT:
64 if ( optval != NULL )
65 *(unsigned int *)param->var =
66 simple_strtol(optval, (char **)&optval, 0);
67 break;
68 case OPT_BOOL:
69 *(int *)param->var = 1;
70 break;
71 case OPT_CUSTOM:
72 if ( optval != NULL )
73 ((void (*)(char *))param->var)(optval);
74 break;
75 }
76 }
77 }
78 }
80 /*
81 * Simple hypercalls.
82 */
84 long do_xen_version(int cmd, void *arg)
85 {
86 switch ( cmd )
87 {
88 case XENVER_version:
89 {
90 return (XEN_VERSION<<16) | (XEN_SUBVERSION);
91 }
93 case XENVER_extraversion:
94 {
95 xen_extraversion_t extraversion;
96 safe_strcpy(extraversion, XEN_EXTRAVERSION);
97 if ( copy_to_user(arg, extraversion, sizeof(extraversion)) )
98 return -EFAULT;
99 return 0;
100 }
102 case XENVER_compile_info:
103 {
104 struct xen_compile_info info;
105 safe_strcpy(info.compiler, XEN_COMPILER);
106 safe_strcpy(info.compile_by, XEN_COMPILE_BY);
107 safe_strcpy(info.compile_domain, XEN_COMPILE_DOMAIN);
108 safe_strcpy(info.compile_date, XEN_COMPILE_DATE);
109 if ( copy_to_user(arg, &info, sizeof(info)) )
110 return -EFAULT;
111 return 0;
112 }
114 case XENVER_capabilities:
115 {
116 xen_capabilities_info_t info;
117 extern void arch_get_xen_caps(xen_capabilities_info_t info);
119 memset(info, 0, sizeof(info));
120 arch_get_xen_caps(info);
122 if ( copy_to_user(arg, info, sizeof(info)) )
123 return -EFAULT;
124 return 0;
125 }
127 case XENVER_parameters:
128 {
129 xen_parameters_info_t info = { .virt_start = HYPERVISOR_VIRT_START };
130 if ( copy_to_user(arg, &info, sizeof(info)) )
131 return -EFAULT;
132 return 0;
134 }
136 case XENVER_changeset:
137 {
138 xen_changeset_info_t chgset;
139 safe_strcpy(chgset, XEN_CHANGESET);
140 if ( copy_to_user(arg, chgset, sizeof(chgset)) )
141 return -EFAULT;
142 return 0;
143 }
144 }
146 return -ENOSYS;
147 }
149 long do_vm_assist(unsigned int cmd, unsigned int type)
150 {
151 return vm_assist(current->domain, cmd, type);
152 }
154 long do_ni_hypercall(void)
155 {
156 /* No-op hypercall. */
157 return -ENOSYS;
158 }
160 /*
161 * Local variables:
162 * mode: C
163 * c-set-style: "BSD"
164 * c-basic-offset: 4
165 * tab-width: 4
166 * indent-tabs-mode: nil
167 * End:
168 */