summaryrefslogtreecommitdiffstats
path: root/drivers/lguest/interrupts_and_traps.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2007-07-20 22:11:13 +1000
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-20 09:05:16 -0700
commite5faff45b381e053c31214713ed783d97f49177b (patch)
tree0a2b906f9f087b33e4ca9cb892f35f649ab67fb6 /drivers/lguest/interrupts_and_traps.c
parentbd6dc742a4b1945861795a66dc27c65365c5f28e (diff)
downloadlinux-e5faff45b381e053c31214713ed783d97f49177b.tar.bz2
lguest: fix sense if IF flag on interrupt injection
The sense of the IF bit is backwards in the host interrupt handling. This means we always save "IF=1" on the stack when injecting an interrupt. It turns out this is almost always correct (unless the guest is taking a page fault in an interrupt due to an unpopulated vmalloc mapping), so went unnoticed. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/lguest/interrupts_and_traps.c')
-rw-r--r--drivers/lguest/interrupts_and_traps.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/lguest/interrupts_and_traps.c b/drivers/lguest/interrupts_and_traps.c
index d9de5bbc613f..bee029bb2c7b 100644
--- a/drivers/lguest/interrupts_and_traps.c
+++ b/drivers/lguest/interrupts_and_traps.c
@@ -38,12 +38,12 @@ static void set_guest_interrupt(struct lguest *lg, u32 lo, u32 hi, int has_err)
ss = lg->regs->ss;
}
- /* We use IF bit in eflags to indicate whether irqs were disabled
- (it's always 0, since irqs are enabled when guest is running). */
+ /* We use IF bit in eflags to indicate whether irqs were enabled
+ (it's always 1, since irqs are enabled when guest is running). */
eflags = lg->regs->eflags;
- if (get_user(irq_enable, &lg->lguest_data->irq_enabled))
- irq_enable = 0;
- eflags |= (irq_enable & X86_EFLAGS_IF);
+ if (get_user(irq_enable, &lg->lguest_data->irq_enabled) == 0
+ && !(irq_enable & X86_EFLAGS_IF))
+ eflags &= ~X86_EFLAGS_IF;
push_guest_stack(lg, &gstack, eflags);
push_guest_stack(lg, &gstack, lg->regs->cs);