diff options
Diffstat (limited to 'drivers/lguest/core.c')
-rw-r--r-- | drivers/lguest/core.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c index 6590558d1d31..7dc93aa004c8 100644 --- a/drivers/lguest/core.c +++ b/drivers/lguest/core.c | |||
@@ -208,6 +208,14 @@ void __lgwrite(struct lg_cpu *cpu, unsigned long addr, const void *b, | |||
208 | */ | 208 | */ |
209 | int run_guest(struct lg_cpu *cpu, unsigned long __user *user) | 209 | int run_guest(struct lg_cpu *cpu, unsigned long __user *user) |
210 | { | 210 | { |
211 | /* If the launcher asked for a register with LHREQ_GETREG */ | ||
212 | if (cpu->reg_read) { | ||
213 | if (put_user(*cpu->reg_read, user)) | ||
214 | return -EFAULT; | ||
215 | cpu->reg_read = NULL; | ||
216 | return sizeof(*cpu->reg_read); | ||
217 | } | ||
218 | |||
211 | /* We stop running once the Guest is dead. */ | 219 | /* We stop running once the Guest is dead. */ |
212 | while (!cpu->lg->dead) { | 220 | while (!cpu->lg->dead) { |
213 | unsigned int irq; | 221 | unsigned int irq; |
@@ -217,21 +225,12 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user) | |||
217 | if (cpu->hcall) | 225 | if (cpu->hcall) |
218 | do_hypercalls(cpu); | 226 | do_hypercalls(cpu); |
219 | 227 | ||
220 | /* | 228 | /* Do we have to tell the Launcher about a trap? */ |
221 | * It's possible the Guest did a NOTIFY hypercall to the | 229 | if (cpu->pending.trap) { |
222 | * Launcher. | 230 | if (copy_to_user(user, &cpu->pending, |
223 | */ | 231 | sizeof(cpu->pending))) |
224 | if (cpu->pending_notify) { | 232 | return -EFAULT; |
225 | /* | 233 | return sizeof(cpu->pending); |
226 | * Does it just needs to write to a registered | ||
227 | * eventfd (ie. the appropriate virtqueue thread)? | ||
228 | */ | ||
229 | if (!send_notify_to_eventfd(cpu)) { | ||
230 | /* OK, we tell the main Launcher. */ | ||
231 | if (put_user(cpu->pending_notify, user)) | ||
232 | return -EFAULT; | ||
233 | return sizeof(cpu->pending_notify); | ||
234 | } | ||
235 | } | 234 | } |
236 | 235 | ||
237 | /* | 236 | /* |