summaryrefslogtreecommitdiffstats
path: root/drivers/lguest
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2015-03-23 21:21:39 -0400
committerRusty Russell <rusty@rustcorp.com.au>2015-03-23 21:22:08 -0400
commit2f921b5bb0511fb698681d8ef35c48be7a9116bf (patch)
treee4f07e4d66f47c7af9142bf13e5851a77acec77f /drivers/lguest
parent7042cb4eb30967b5eb9eeba04907882f04d6b6e5 (diff)
lguest: suppress interrupts for single insn, not range.
The last patch reduced our interrupt-suppression region to one address, so simplify the code somewhat. Also, remove the obsolete undefined instruction ranges and the comment which refers to lguest_guest.S instead of head_32.S. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest')
-rw-r--r--drivers/lguest/hypercalls.c5
-rw-r--r--drivers/lguest/interrupts_and_traps.c8
-rw-r--r--drivers/lguest/lg.h2
3 files changed, 7 insertions, 8 deletions
diff --git a/drivers/lguest/hypercalls.c b/drivers/lguest/hypercalls.c
index 1219af493c0f..19a32280731d 100644
--- a/drivers/lguest/hypercalls.c
+++ b/drivers/lguest/hypercalls.c
@@ -211,10 +211,9 @@ static void initialize(struct lg_cpu *cpu)
211 211
212 /* 212 /*
213 * The Guest tells us where we're not to deliver interrupts by putting 213 * The Guest tells us where we're not to deliver interrupts by putting
214 * the range of addresses into "struct lguest_data". 214 * the instruction address into "struct lguest_data".
215 */ 215 */
216 if (get_user(cpu->lg->noirq_start, &cpu->lg->lguest_data->noirq_start) 216 if (get_user(cpu->lg->noirq_iret, &cpu->lg->lguest_data->noirq_iret))
217 || get_user(cpu->lg->noirq_end, &cpu->lg->lguest_data->noirq_end))
218 kill_guest(cpu, "bad guest page %p", cpu->lg->lguest_data); 217 kill_guest(cpu, "bad guest page %p", cpu->lg->lguest_data);
219 218
220 /* 219 /*
diff --git a/drivers/lguest/interrupts_and_traps.c b/drivers/lguest/interrupts_and_traps.c
index 70dfcdc29f1f..6d4c072b61e1 100644
--- a/drivers/lguest/interrupts_and_traps.c
+++ b/drivers/lguest/interrupts_and_traps.c
@@ -204,8 +204,7 @@ void try_deliver_interrupt(struct lg_cpu *cpu, unsigned int irq, bool more)
204 * They may be in the middle of an iret, where they asked us never to 204 * They may be in the middle of an iret, where they asked us never to
205 * deliver interrupts. 205 * deliver interrupts.
206 */ 206 */
207 if (cpu->regs->eip >= cpu->lg->noirq_start && 207 if (cpu->regs->eip == cpu->lg->noirq_iret)
208 (cpu->regs->eip < cpu->lg->noirq_end))
209 return; 208 return;
210 209
211 /* If they're halted, interrupts restart them. */ 210 /* If they're halted, interrupts restart them. */
@@ -395,8 +394,9 @@ static bool direct_trap(unsigned int num)
395 * The Guest has the ability to turn its interrupt gates into trap gates, 394 * The Guest has the ability to turn its interrupt gates into trap gates,
396 * if it is careful. The Host will let trap gates can go directly to the 395 * if it is careful. The Host will let trap gates can go directly to the
397 * Guest, but the Guest needs the interrupts atomically disabled for an 396 * Guest, but the Guest needs the interrupts atomically disabled for an
398 * interrupt gate. It can do this by pointing the trap gate at instructions 397 * interrupt gate. The Host could provide a mechanism to register more
399 * within noirq_start and noirq_end, where it can safely disable interrupts. 398 * "no-interrupt" regions, and the Guest could point the trap gate at
399 * instructions within that region, where it can safely disable interrupts.
400 */ 400 */
401 401
402/*M:006 402/*M:006
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index 307e8b39e7d1..ac8ad0461e80 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -102,7 +102,7 @@ struct lguest {
102 102
103 struct pgdir pgdirs[4]; 103 struct pgdir pgdirs[4];
104 104
105 unsigned long noirq_start, noirq_end; 105 unsigned long noirq_iret;
106 106
107 unsigned int stack_pages; 107 unsigned int stack_pages;
108 u32 tsc_khz; 108 u32 tsc_khz;