virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Define EFLAGS_IF
@ 2007-03-22  3:16 Rusty Russell
  2007-03-22  3:24 ` Rusty Russell
  2007-04-06  0:20 ` [PATCH] Define EFLAGS_IF H. Peter Anvin
  0 siblings, 2 replies; 13+ messages in thread
From: Rusty Russell @ 2007-03-22  3:16 UTC (permalink / raw)
  To: Andrew Morton; +Cc: lkml - Kernel Mailing List, virtualization, Andi Kleen

There is now more than one place where we use the fact that bit 9 of
eflags is the interrupt-enabled flag, so define EFLAGS_IF.  We make it
512 so it can be used in asm, too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

--- a/arch/i386/lguest/lguest.c
+++ b/arch/i386/lguest/lguest.c
@@ -107,9 +107,8 @@ static void fastcall irq_disable(void)
 
 static void fastcall irq_enable(void)
 {
-	/* Linux i386 code expects bit 9 set. */
 	/* FIXME: Check if interrupt pending... */
-	lguest_data.irq_enabled = 512;
+	lguest_data.irq_enabled = EFLAGS_IF;
 }
 
 static void fastcall lguest_load_gdt(const struct Xgt_desc_struct *desc)
@@ -394,7 +393,7 @@ static fastcall void lguest_write_idt_en
 	extern const char start_##name[], end_##name[];		\
 	asm("start_" #name ": " code "; end_" #name ":")
 DEF_LGUEST(cli, "movl $0," LGUEST_IRQ);
-DEF_LGUEST(sti, "movl $512," LGUEST_IRQ);
+DEF_LGUEST(sti, "movl $"__stringify(EFLAGS_IF)"," LGUEST_IRQ);
 DEF_LGUEST(popf, "movl %eax," LGUEST_IRQ);
 DEF_LGUEST(pushf, "movl " LGUEST_IRQ ",%eax");
 DEF_LGUEST(pushf_cli, "movl " LGUEST_IRQ ",%eax; movl $0," LGUEST_IRQ);
===================================================================
--- a/include/asm-i386/irqflags.h
+++ b/include/asm-i386/irqflags.h
@@ -87,6 +87,9 @@ static inline unsigned long __raw_local_
 #endif /* __ASSEMBLY__ */
 #endif /* CONFIG_PARAVIRT */
 
+/* Bit 9 of eflags means interrupts are enabled: a raw int for asm. */
+#define EFLAGS_IF 512
+
 #ifndef __ASSEMBLY__
 #define raw_local_save_flags(flags) \
 		do { (flags) = __raw_local_save_flags(); } while (0)
@@ -96,7 +99,7 @@ static inline unsigned long __raw_local_
 
 static inline int raw_irqs_disabled_flags(unsigned long flags)
 {
-	return !(flags & (1 << 9));
+	return !(flags & EFLAGS_IF);
 }
 
 static inline int raw_irqs_disabled(void)

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2007-04-09  1:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-22  3:16 [PATCH] Define EFLAGS_IF Rusty Russell
2007-03-22  3:24 ` Rusty Russell
2007-03-22  3:52   ` [PATCH] Use X86_EFLAGS_IF in irqflags.h, lguest Rusty Russell
2007-03-22  4:03     ` Keith Owens
2007-04-06  0:20 ` [PATCH] Define EFLAGS_IF H. Peter Anvin
2007-04-06  0:22   ` Jeremy Fitzhardinge
2007-04-06  0:29     ` H. Peter Anvin
2007-04-06  0:48       ` Andi Kleen
2007-04-06  1:06         ` H. Peter Anvin
2007-04-06  2:24           ` Rusty Russell
2007-04-06 10:30           ` Andi Kleen
2007-04-06 15:39             ` H. Peter Anvin
2007-04-09  1:11               ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).