aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest/x86
diff options
context:
space:
mode:
authorGlauber de Oliveira Costa <gcosta@redhat.com>2008-01-07 08:05:25 -0500
committerRusty Russell <rusty@rustcorp.com.au>2008-01-30 06:50:06 -0500
commitd0953d42c3445a120299fac9ad70e672d77898e9 (patch)
treea631abb2c154bec66cec05508423da705d02f35b /drivers/lguest/x86
parent4dcc53da49c2387078fe8ceb7a420d125e027fc6 (diff)
lguest: per-cpu run guest
This patch makes the run_guest() routine use the lg_cpu struct. This is required since in a smp guest environment, there's no more the notion of "running the guest", but rather, it is "running the vcpu" Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/x86')
-rw-r--r--drivers/lguest/x86/core.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
index 96d0fd07c57d..3d2131e169fd 100644
--- a/drivers/lguest/x86/core.c
+++ b/drivers/lguest/x86/core.c
@@ -73,8 +73,9 @@ static DEFINE_PER_CPU(struct lguest *, last_guest);
73 * since it last ran. We saw this set in interrupts_and_traps.c and 73 * since it last ran. We saw this set in interrupts_and_traps.c and
74 * segments.c. 74 * segments.c.
75 */ 75 */
76static void copy_in_guest_info(struct lguest *lg, struct lguest_pages *pages) 76static void copy_in_guest_info(struct lg_cpu *cpu, struct lguest_pages *pages)
77{ 77{
78 struct lguest *lg = cpu->lg;
78 /* Copying all this data can be quite expensive. We usually run the 79 /* Copying all this data can be quite expensive. We usually run the
79 * same Guest we ran last time (and that Guest hasn't run anywhere else 80 * same Guest we ran last time (and that Guest hasn't run anywhere else
80 * meanwhile). If that's not the case, we pretend everything in the 81 * meanwhile). If that's not the case, we pretend everything in the
@@ -113,14 +114,15 @@ static void copy_in_guest_info(struct lguest *lg, struct lguest_pages *pages)
113} 114}
114 115
115/* Finally: the code to actually call into the Switcher to run the Guest. */ 116/* Finally: the code to actually call into the Switcher to run the Guest. */
116static void run_guest_once(struct lguest *lg, struct lguest_pages *pages) 117static void run_guest_once(struct lg_cpu *cpu, struct lguest_pages *pages)
117{ 118{
118 /* This is a dummy value we need for GCC's sake. */ 119 /* This is a dummy value we need for GCC's sake. */
119 unsigned int clobber; 120 unsigned int clobber;
121 struct lguest *lg = cpu->lg;
120 122
121 /* Copy the guest-specific information into this CPU's "struct 123 /* Copy the guest-specific information into this CPU's "struct
122 * lguest_pages". */ 124 * lguest_pages". */
123 copy_in_guest_info(lg, pages); 125 copy_in_guest_info(cpu, pages);
124 126
125 /* Set the trap number to 256 (impossible value). If we fault while 127 /* Set the trap number to 256 (impossible value). If we fault while
126 * switching to the Guest (bad segment registers or bug), this will 128 * switching to the Guest (bad segment registers or bug), this will
@@ -161,8 +163,10 @@ static void run_guest_once(struct lguest *lg, struct lguest_pages *pages)
161 163
162/*H:040 This is the i386-specific code to setup and run the Guest. Interrupts 164/*H:040 This is the i386-specific code to setup and run the Guest. Interrupts
163 * are disabled: we own the CPU. */ 165 * are disabled: we own the CPU. */
164void lguest_arch_run_guest(struct lguest *lg) 166void lguest_arch_run_guest(struct lg_cpu *cpu)
165{ 167{
168 struct lguest *lg = cpu->lg;
169
166 /* Remember the awfully-named TS bit? If the Guest has asked to set it 170 /* Remember the awfully-named TS bit? If the Guest has asked to set it
167 * we set it now, so we can trap and pass that trap to the Guest if it 171 * we set it now, so we can trap and pass that trap to the Guest if it
168 * uses the FPU. */ 172 * uses the FPU. */
@@ -180,7 +184,7 @@ void lguest_arch_run_guest(struct lguest *lg)
180 /* Now we actually run the Guest. It will return when something 184 /* Now we actually run the Guest. It will return when something
181 * interesting happens, and we can examine its registers to see what it 185 * interesting happens, and we can examine its registers to see what it
182 * was doing. */ 186 * was doing. */
183 run_guest_once(lg, lguest_pages(raw_smp_processor_id())); 187 run_guest_once(cpu, lguest_pages(raw_smp_processor_id()));
184 188
185 /* Note that the "regs" pointer contains two extra entries which are 189 /* Note that the "regs" pointer contains two extra entries which are
186 * not really registers: a trap number which says what interrupt or 190 * not really registers: a trap number which says what interrupt or