--- zzzz-none-000/linux-2.4.17/include/asm-sh/system.h 2001-09-08 19:29:09.000000000 +0000 +++ sangam-fb-322/linux-2.4.17/include/asm-sh/system.h 2004-11-24 13:21:35.000000000 +0000 @@ -103,6 +103,58 @@ #define set_mb(var, value) do { xchg(&var, value); } while (0) #define set_wmb(var, value) do { var = value; wmb(); } while (0) +#ifdef CONFIG_ILATENCY +extern void intr_cli(const char *, unsigned); +extern void intr_sti(const char *, unsigned, int); +extern void intr_restore_flags(const char *, unsigned, unsigned); + +#define __cli() intr_cli(__BASE_FILE__, __LINE__) +#define __sti() intr_sti(__BASE_FILE__, __LINE__,0) + +/* Interrupt Control */ +static __inline__ void __intr_sti(void) +{ + unsigned long __dummy0, __dummy1; + + __asm__ __volatile__("stc sr, %0\n\t" + "and %1, %0\n\t" + "stc r6_bank, %1\n\t" + "or %1, %0\n\t" + "ldc %0, sr" + : "=&r" (__dummy0), "=r" (__dummy1) + : "1" (~0x000000f0) + : "memory"); +} + +static __inline__ void __intr_cli(void) +{ + unsigned long __dummy; + __asm__ __volatile__("stc sr, %0\n\t" + "or #0xf0, %0\n\t" + "ldc %0, sr" + : "=&z" (__dummy) + : /* no inputs */ + : "memory"); +} + +#define __save_flags(x) \ + __asm__ __volatile__("stc sr, %0\n\t" \ + "and #0xf0, %0" \ + : "=&z" (x) :/**/: "memory" ) + +#define __save_and_cli(void)\ +({ \ + unsigned long flags; \ + \ + __save_flags(flags); \ + __cli(); \ + flags; \ +}) + +#define __intr_restore_flags(x) __restore_flags(x) + +#else /* !CONFIG_ILATENCY */ + /* Interrupt Control */ static __inline__ void __sti(void) { @@ -130,7 +182,9 @@ } #define __save_flags(x) \ - __asm__("stc sr, %0; and #0xf0, %0" : "=&z" (x) :/**/: "memory" ) + __asm__ __volatile__("stc sr, %0\n\t" \ + "and #0xf0, %0" \ + : "=&z" (x) :/**/: "memory" ) static __inline__ unsigned long __save_and_cli(void) { @@ -148,6 +202,8 @@ return flags; } +#endif /* CONFIG_ILATENCY */ + #ifdef DEBUG_CLI_STI static __inline__ void __restore_flags(unsigned long x) {