diff options
Diffstat (limited to 'drivers/lguest/interrupts_and_traps.c')
-rw-r--r-- | drivers/lguest/interrupts_and_traps.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/lguest/interrupts_and_traps.c b/drivers/lguest/interrupts_and_traps.c index a8c966fee1e4..5a10754b4790 100644 --- a/drivers/lguest/interrupts_and_traps.c +++ b/drivers/lguest/interrupts_and_traps.c | |||
@@ -131,7 +131,7 @@ static void set_guest_interrupt(struct lg_cpu *cpu, u32 lo, u32 hi, | |||
131 | * interrupt_pending() returns the first pending interrupt which isn't blocked | 131 | * interrupt_pending() returns the first pending interrupt which isn't blocked |
132 | * by the Guest. It is called before every entry to the Guest, and just before | 132 | * by the Guest. It is called before every entry to the Guest, and just before |
133 | * we go to sleep when the Guest has halted itself. */ | 133 | * we go to sleep when the Guest has halted itself. */ |
134 | unsigned int interrupt_pending(struct lg_cpu *cpu) | 134 | unsigned int interrupt_pending(struct lg_cpu *cpu, bool *more) |
135 | { | 135 | { |
136 | unsigned int irq; | 136 | unsigned int irq; |
137 | DECLARE_BITMAP(blk, LGUEST_IRQS); | 137 | DECLARE_BITMAP(blk, LGUEST_IRQS); |
@@ -149,13 +149,14 @@ unsigned int interrupt_pending(struct lg_cpu *cpu) | |||
149 | 149 | ||
150 | /* Find the first interrupt. */ | 150 | /* Find the first interrupt. */ |
151 | irq = find_first_bit(blk, LGUEST_IRQS); | 151 | irq = find_first_bit(blk, LGUEST_IRQS); |
152 | *more = find_next_bit(blk, LGUEST_IRQS, irq+1); | ||
152 | 153 | ||
153 | return irq; | 154 | return irq; |
154 | } | 155 | } |
155 | 156 | ||
156 | /* This actually diverts the Guest to running an interrupt handler, once an | 157 | /* This actually diverts the Guest to running an interrupt handler, once an |
157 | * interrupt has been identified by interrupt_pending(). */ | 158 | * interrupt has been identified by interrupt_pending(). */ |
158 | void try_deliver_interrupt(struct lg_cpu *cpu, unsigned int irq) | 159 | void try_deliver_interrupt(struct lg_cpu *cpu, unsigned int irq, bool more) |
159 | { | 160 | { |
160 | struct desc_struct *idt; | 161 | struct desc_struct *idt; |
161 | 162 | ||
@@ -178,8 +179,12 @@ void try_deliver_interrupt(struct lg_cpu *cpu, unsigned int irq) | |||
178 | u32 irq_enabled; | 179 | u32 irq_enabled; |
179 | if (get_user(irq_enabled, &cpu->lg->lguest_data->irq_enabled)) | 180 | if (get_user(irq_enabled, &cpu->lg->lguest_data->irq_enabled)) |
180 | irq_enabled = 0; | 181 | irq_enabled = 0; |
181 | if (!irq_enabled) | 182 | if (!irq_enabled) { |
183 | /* Make sure they know an IRQ is pending. */ | ||
184 | put_user(X86_EFLAGS_IF, | ||
185 | &cpu->lg->lguest_data->irq_pending); | ||
182 | return; | 186 | return; |
187 | } | ||
183 | } | 188 | } |
184 | 189 | ||
185 | /* Look at the IDT entry the Guest gave us for this interrupt. The | 190 | /* Look at the IDT entry the Guest gave us for this interrupt. The |
@@ -202,6 +207,11 @@ void try_deliver_interrupt(struct lg_cpu *cpu, unsigned int irq) | |||
202 | * here is a compromise which means at least it gets updated every | 207 | * here is a compromise which means at least it gets updated every |
203 | * timer interrupt. */ | 208 | * timer interrupt. */ |
204 | write_timestamp(cpu); | 209 | write_timestamp(cpu); |
210 | |||
211 | /* If there are no other interrupts we want to deliver, clear | ||
212 | * the pending flag. */ | ||
213 | if (!more) | ||
214 | put_user(0, &cpu->lg->lguest_data->irq_pending); | ||
205 | } | 215 | } |
206 | /*:*/ | 216 | /*:*/ |
207 | 217 | ||