From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: [PATCH 1/3] x86/irq: local_irq_restore() should not blindly popf Date: Mon, 21 Oct 2013 14:41:31 +0100 Message-ID: <1382362893-12603-2-git-send-email-andrew.cooper3@citrix.com> References: <1382362893-12603-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1382362893-12603-1-git-send-email-andrew.cooper3@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Andrew Cooper , Keir Fraser , Jan Beulich List-Id: xen-devel@lists.xenproject.org local_irq_restore() should only be concerned with possibly changing the interrupt flag. A blind popf could corrupt other system flags. Signed-off-by: Andrew Cooper CC: Keir Fraser CC: Jan Beulich --- xen/include/asm-x86/system.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xen/include/asm-x86/system.h b/xen/include/asm-x86/system.h index 6ab7d56..cbf0f6a 100644 --- a/xen/include/asm-x86/system.h +++ b/xen/include/asm-x86/system.h @@ -159,8 +159,10 @@ static always_inline unsigned long __cmpxchg( #define local_irq_restore(x) \ ({ \ BUILD_BUG_ON(sizeof(x) != sizeof(long)); \ - asm volatile ( "push" __OS " %0 ; popf" __OS \ - : : "g" (x) : "memory", "cc" ); \ + if ( x & X86_EFLAGS_IF ) \ + local_irq_enable(); \ + else \ + local_irq_disable(); \ }) static inline int local_irq_is_enabled(void) -- 1.7.10.4