[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Better i386 interrupt macros
- Date: 17 Feb 1999 14:48:29 -0500
- From: ian at airs.com (Ian Lance Taylor)
- Subject: Better i386 interrupt macros
Here is a patch which slightly improves the i386 interrupt handling
macros. These macros were written to use both input and output
parameters, which is not necessary. This patch changes them to use
only an input or output parameter, as appropriate. It also changes
the constraints to permit the interrupt level to be loaded directly in
and out of memory, rather than always requiring a register. This
patch is to
c/src/lb/libcpu/i386/cpu.h
Please let me know if you see any problems with this patch.
Ian
Index: cpu.h
===================================================================
RCS file: /zembu/cvsfiles/devo/rtems/c/src/lib/libcpu/i386/cpu.h,v
retrieving revision 1.2
diff -u -r1.2 cpu.h
--- cpu.h 1998/10/17 18:47:32 1.2
+++ cpu.h 1999/02/17 19:42:35
@@ -32,35 +32,34 @@
#define i386_disable_interrupts( _level ) \
{ \
- _level = 0; /* avoids warnings */ \
asm volatile ( "pushf ; cli ; pop %0" \
- : "=r" ((_level)) : "0" ((_level)) \
+ : "=rm" ((_level)) \
); \
}
#define i386_enable_interrupts( _level ) \
{ \
asm volatile ( "push %0 ; popf" \
- : "=r" ((_level)) : "0" ((_level)) \
+ : : "rm" ((_level)) \
); \
}
#define i386_flash_interrupts( _level ) \
{ \
asm volatile ( "push %0 ; popf ; cli" \
- : "=r" ((_level)) : "0" ((_level)) \
+ : : "rm" ((_level)) \
); \
}
#define i386_get_interrupt_level( _level ) \
do { \
- register unsigned32 _eflags = 0; \
+ register unsigned32 _eflags; \
\
asm volatile ( "pushf ; pop %0" \
- : "=r" ((_eflags)) : "0" ((_eflags)) \
+ : "=rm" ((_eflags)) \
); \
\
- _level = (_eflags & EFLAGS_INTR_ENABLE) ? 0 : 1; \
+ _level = (_eflags & EFLAGS_INTR_ENABLE) ? 0 : 1; \
} while (0)
#define _CPU_ISR_Disable( _level ) i386_disable_interrupts( _level )