Re: [PATCH] Use X86_EFLAGS_IF in irqflags.h, lguest.

2007-03-21 Thread Keith Owens
Rusty Russell (on Thu, 22 Mar 2007 14:52:29 +1100) wrote:
>On Thu, 2007-03-22 at 14:24 +1100, Rusty Russell wrote:
>> Belay this: there's a X86_EFLAGS_IF in asm/processor.h which we should
>> use.  Will send patch.
>
>How's this.  There may be other users, but they're not easy to grep for.

One less set of definitions for KDB to create - Thanks.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Use X86_EFLAGS_IF in irqflags.h, lguest.

2007-03-21 Thread Rusty Russell
On Thu, 2007-03-22 at 14:24 +1100, Rusty Russell wrote:
> Belay this: there's a X86_EFLAGS_IF in asm/processor.h which we should
> use.  Will send patch.

How's this.  There may be other users, but they're not easy to grep for.

==
Move X86_EFLAGS_IF et al out to a new header: processor-flags.h, so we
can include it from irqflags.h and use it in raw_irqs_disabled_flags().

As a side-effect, we could now use these flags in .S files.

Lguest also modified to use the flags.

Signed-off-by: Rusty Russell <[EMAIL PROTECTED]>

diff -r bd0a803d9948 include/asm-i386/processor-flags.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/include/asm-i386/processor-flags.hThu Mar 22 14:31:41 2007 +1100
@@ -0,0 +1,26 @@
+#ifndef __ASM_I386_PROCESSOR_FLAGS_H
+#define __ASM_I386_PROCESSOR_FLAGS_H
+/* Various flags defined: can be included from assembler. */
+
+/*
+ * EFLAGS bits
+ */
+#define X86_EFLAGS_CF  0x0001 /* Carry Flag */
+#define X86_EFLAGS_PF  0x0004 /* Parity Flag */
+#define X86_EFLAGS_AF  0x0010 /* Auxillary carry Flag */
+#define X86_EFLAGS_ZF  0x0040 /* Zero Flag */
+#define X86_EFLAGS_SF  0x0080 /* Sign Flag */
+#define X86_EFLAGS_TF  0x0100 /* Trap Flag */
+#define X86_EFLAGS_IF  0x0200 /* Interrupt Flag */
+#define X86_EFLAGS_DF  0x0400 /* Direction Flag */
+#define X86_EFLAGS_OF  0x0800 /* Overflow Flag */
+#define X86_EFLAGS_IOPL0x3000 /* IOPL mask */
+#define X86_EFLAGS_NT  0x4000 /* Nested Task */
+#define X86_EFLAGS_RF  0x0001 /* Resume Flag */
+#define X86_EFLAGS_VM  0x0002 /* Virtual Mode */
+#define X86_EFLAGS_AC  0x0004 /* Alignment Check */
+#define X86_EFLAGS_VIF 0x0008 /* Virtual Interrupt Flag */
+#define X86_EFLAGS_VIP 0x0010 /* Virtual Interrupt Pending */
+#define X86_EFLAGS_ID  0x0020 /* CPUID detection flag */
+
+#endif /* __ASM_I386_PROCESSOR_FLAGS_H */
diff -r bd0a803d9948 include/asm-i386/irqflags.h
--- a/include/asm-i386/irqflags.h   Thu Mar 22 14:13:31 2007 +1100
+++ b/include/asm-i386/irqflags.h   Thu Mar 22 14:47:21 2007 +1100
@@ -9,6 +9,7 @@
  */
 #ifndef _ASM_IRQFLAGS_H
 #define _ASM_IRQFLAGS_H
+#include 
 
 #ifndef __ASSEMBLY__
 static inline unsigned long native_save_fl(void)
@@ -119,7 +120,7 @@ static inline unsigned long __raw_local_
 
 static inline int raw_irqs_disabled_flags(unsigned long flags)
 {
-   return !(flags & (1 << 9));
+   return !(flags & X86_EFLAGS_IF);
 }
 
 static inline int raw_irqs_disabled(void)
diff -r bd0a803d9948 include/asm-i386/processor.h
--- a/include/asm-i386/processor.h  Thu Mar 22 14:13:31 2007 +1100
+++ b/include/asm-i386/processor.h  Thu Mar 22 14:31:58 2007 +1100
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* flag for disabling the tsc */
 extern int tsc_disable;
@@ -125,27 +126,6 @@ extern void detect_ht(struct cpuinfo_x86
 #else
 static inline void detect_ht(struct cpuinfo_x86 *c) {}
 #endif
-
-/*
- * EFLAGS bits
- */
-#define X86_EFLAGS_CF  0x0001 /* Carry Flag */
-#define X86_EFLAGS_PF  0x0004 /* Parity Flag */
-#define X86_EFLAGS_AF  0x0010 /* Auxillary carry Flag */
-#define X86_EFLAGS_ZF  0x0040 /* Zero Flag */
-#define X86_EFLAGS_SF  0x0080 /* Sign Flag */
-#define X86_EFLAGS_TF  0x0100 /* Trap Flag */
-#define X86_EFLAGS_IF  0x0200 /* Interrupt Flag */
-#define X86_EFLAGS_DF  0x0400 /* Direction Flag */
-#define X86_EFLAGS_OF  0x0800 /* Overflow Flag */
-#define X86_EFLAGS_IOPL0x3000 /* IOPL mask */
-#define X86_EFLAGS_NT  0x4000 /* Nested Task */
-#define X86_EFLAGS_RF  0x0001 /* Resume Flag */
-#define X86_EFLAGS_VM  0x0002 /* Virtual Mode */
-#define X86_EFLAGS_AC  0x0004 /* Alignment Check */
-#define X86_EFLAGS_VIF 0x0008 /* Virtual Interrupt Flag */
-#define X86_EFLAGS_VIP 0x0010 /* Virtual Interrupt Pending */
-#define X86_EFLAGS_ID  0x0020 /* CPUID detection flag */
 
 static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
 unsigned int *ecx, unsigned int *edx)
diff -r bd0a803d9948 arch/i386/lguest/interrupts_and_traps.c
--- a/arch/i386/lguest/interrupts_and_traps.c   Thu Mar 22 14:13:31 2007 +1100
+++ b/arch/i386/lguest/interrupts_and_traps.c   Thu Mar 22 14:46:15 2007 +1100
@@ -42,7 +42,7 @@ static void reflect_trap(struct lguest *
   (it's always 0, since irqs are enabled when guest is running). */
eflags = regs->eflags;
get_user(irq_enable, &lg->lguest_data->irq_enabled);
-   eflags |= (irq_enable & 512);
+   eflags |= (irq_enable & X86_EFLAGS_IF);
 
push_guest_stack(lg, &gstack, eflags);
push_guest_stack(lg, &gstack, regs->cs);
@@ -86,7 +86,7 @@ void maybe_do_interrupt(struct lguest *l
/* If they're halted, we re-enable interrupts. */
if (lg->halted) {
/* Re-enable interrupts. */
-   put_user(512, &lg->lguest_data->irq_enabled);
+   put_user(X86_EFLAGS_IF, &l