Re: [PATCH] Define EFLAGS_IF

2007-04-06 Thread Andi Kleen
On Thu, Apr 05, 2007 at 06:06:16PM -0700, H. Peter Anvin wrote:
 Andi Kleen wrote:
 
 No processor.h is such a hodgepodge of unrelated stuff that any
 splitting up is a good thing.
 
 
 Fair enough.  However, I'd still like to see the X86_CR* constants 
 moved, too (and constants added for at least CR0 as well.)

Send patches then.

-Andi
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/virtualization


Re: [PATCH] Define EFLAGS_IF

2007-04-06 Thread H. Peter Anvin
Andi Kleen wrote:
 On Thu, Apr 05, 2007 at 06:06:16PM -0700, H. Peter Anvin wrote:
 Andi Kleen wrote:
 No processor.h is such a hodgepodge of unrelated stuff that any
 splitting up is a good thing.

 Fair enough.  However, I'd still like to see the X86_CR* constants 
 moved, too (and constants added for at least CR0 as well.)
 
 Send patches then.

I will, unless Rusty does, first.  No desire to step on each other.

-hpa
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/virtualization


Re: [PATCH] Define EFLAGS_IF

2007-04-05 Thread H. Peter Anvin
Rusty Russell wrote:
 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.

How about defining all the other EFLAGS in one place?

-hpa
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/virtualization


Re: [PATCH] Define EFLAGS_IF

2007-04-05 Thread Jeremy Fitzhardinge
H. Peter Anvin wrote:
 Rusty Russell wrote:
   
 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.
 

 How about defining all the other EFLAGS in one place?
   

That patch got dropped, and replaced by one which pulled all the flags
definitions out of asm/processor.h

J
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/virtualization


Re: [PATCH] Define EFLAGS_IF

2007-04-05 Thread H. Peter Anvin
Jeremy Fitzhardinge wrote:
 
 That patch got dropped, and replaced by one which pulled all the flags
 definitions out of asm/processor.h
 

Saw that a little too late :)

In general, it would be nice if the various CPU constants were all 
defined in one place, so I'd rather suggest protecting the appropriate 
parts of asm/processor.h with #ifndef __ASSEMBLY__.

-hpa
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/virtualization


Re: [PATCH] Define EFLAGS_IF

2007-04-05 Thread Andi Kleen
On Thu, Apr 05, 2007 at 05:29:52PM -0700, H. Peter Anvin wrote:
 Jeremy Fitzhardinge wrote:
 
 That patch got dropped, and replaced by one which pulled all the flags
 definitions out of asm/processor.h
 
 
 Saw that a little too late :)
 
 In general, it would be nice if the various CPU constants were all 
 defined in one place, so I'd rather suggest protecting the appropriate 
 parts of asm/processor.h with #ifndef __ASSEMBLY__.

No processor.h is such a hodgepodge of unrelated stuff that any
splitting up is a good thing.

-Andi
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/virtualization


Re: [PATCH] Define EFLAGS_IF

2007-04-05 Thread H. Peter Anvin
Andi Kleen wrote:
 
 No processor.h is such a hodgepodge of unrelated stuff that any
 splitting up is a good thing.
 

Fair enough.  However, I'd still like to see the X86_CR* constants 
moved, too (and constants added for at least CR0 as well.)

-hpa
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/virtualization


[PATCH] Define EFLAGS_IF

2007-03-21 Thread Rusty Russell
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 [EMAIL PROTECTED]

--- 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)


___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/virtualization