lkml.org 
[lkml]   [2015]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: lguest: bug in lg_irq_enable?
Date
Denys Vlasenko <vda.linux@googlemail.com> writes:
> ENTRY(lg_irq_enable)
> /*
> * The reverse of irq_disable, this sets lguest_data.irq_enabled to
> * X86_EFLAGS_IF (ie. "Interrupts enabled").
> */
> movl $X86_EFLAGS_IF, lguest_data+LGUEST_DATA_irq_enabled
> /*
> * But now we need to check if the Host wants to know: there might have
> * been interrupts waiting to be delivered, in which case it will have
> * set lguest_data.irq_pending to X86_EFLAGS_IF. If it's not zero, we
> * jump to send_interrupts, otherwise we're done.
> */
> testl $0, lguest_data+LGUEST_DATA_irq_pending
> ^^^^^^^^^^^^^^^^^??????????

Heh, that should be cmpl! Nice catch!

Cheers,
Rusty.

Subject: lguest: fix pending interrupt test.

Denys says:
TEST with zero will always set ZF. Thus, "jnz send_interrupts" never jumps.

We get interrupts regularly enough that this didn't cause immediate problems.

Reported-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

diff --git a/arch/x86/lguest/head_32.S b/arch/x86/lguest/head_32.S
index 6ddfe4fc23c3..05b0a85507ce 100644
--- a/arch/x86/lguest/head_32.S
+++ b/arch/x86/lguest/head_32.S
@@ -84,7 +84,7 @@ ENTRY(lg_irq_enable)
* set lguest_data.irq_pending to X86_EFLAGS_IF. If it's not zero, we
* jump to send_interrupts, otherwise we're done.
*/
- testl $0, lguest_data+LGUEST_DATA_irq_pending
+ cmpl $0, lguest_data+LGUEST_DATA_irq_pending
jnz send_interrupts
/*
* One cool thing about x86 is that you can do many things without using


\
 
 \ /
  Last update: 2015-03-02 11:41    [W:1.837 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site