patch-2.1.36 linux/include/asm-sparc/system.h
Next file: linux/include/asm-sparc/viking.h
Previous file: linux/include/asm-sparc/spinlock.h
Back to the patch index
Back to the overall index
- Lines: 167
- Date:
Tue Apr 22 22:39:21 1997
- Orig file:
v2.1.35/linux/include/asm-sparc/system.h
- Orig date:
Mon Apr 14 16:28:21 1997
diff -u --recursive --new-file v2.1.35/linux/include/asm-sparc/system.h linux/include/asm-sparc/system.h
@@ -1,4 +1,4 @@
-/* $Id: system.h,v 1.56 1997/04/14 05:39:30 davem Exp $ */
+/* $Id: system.h,v 1.58 1997/04/18 05:44:54 davem Exp $ */
#ifndef __SPARC_SYSTEM_H
#define __SPARC_SYSTEM_H
@@ -93,9 +93,7 @@
"rd %%wim, %%g5\n\t" \
"wr %%g4, 0x20, %%psr\n\t" \
"nop\n\t" \
- "mov %5, %%g7\n\t" \
"std %%g4, [%%g6 + %2]\n\t" \
- "st %%g7, [%%g6 + %6]\n\t" \
"ldd [%1 + %2], %%g4\n\t" \
"mov %1, %%g6\n\t" \
"st %1, [%0]\n\t" \
@@ -113,8 +111,7 @@
" nop\n\t" : : "r" (&(current_set[smp_processor_id()])), "r" (next), \
"i" ((const unsigned long)(&((struct task_struct *)0)->tss.kpsr)), \
"i" ((const unsigned long)(&((struct task_struct *)0)->tss.ksp)), \
- "r" (task_pc), "i" (255), \
- "i" ((const unsigned long)(&((struct task_struct *)0)->processor)) \
+ "r" (task_pc) \
: "g1", "g2", "g3", "g4", "g5", "g7", "l2", "l3", \
"l4", "l5", "l6", "l7", "i0", "i1", "i2", "i3", "i4", "i5", "o0", "o1", "o2", \
"o3"); \
@@ -127,9 +124,7 @@
{
__asm__ __volatile__("
wr %0, 0x0, %%psr
- nop
- nop
- nop
+ nop; nop; nop
" : /* no outputs */
: "r" (__orig_psr)
: "memory", "cc");
@@ -141,14 +136,9 @@
__asm__ __volatile__("
rd %%psr, %0
- andcc %0, %1, %%g0
- bne 1f
- nop
- wr %0, %1, %%psr
- nop
- nop
- nop
-1:
+ or %0, %1, %0
+ wr %0, 0x0, %%psr
+ nop; nop; nop
" : "=r" (tmp)
: "i" (PSR_PIL)
: "memory");
@@ -160,14 +150,9 @@
__asm__ __volatile__("
rd %%psr, %0
- andcc %0, %1, %%g0
- be 1f
- nop
- wr %0, %1, %%psr
- nop
- nop
- nop
-1:
+ andn %0, %1, %0
+ wr %0, 0x0, %%psr
+ nop; nop; nop
" : "=r" (tmp)
: "i" (PSR_PIL)
: "memory");
@@ -192,7 +177,7 @@
xorcc %1, %2, %%g0
be 1f
nop
- wr %0, %4, %%psr
+ wr %0, %4, %%psr
nop
nop
nop
@@ -210,38 +195,64 @@
__asm__ __volatile__("
rd %%psr, %0
- andcc %0, %1, %%g0
- bne 1f
- nop
- wr %0, %1, %%psr
- nop
- nop
- nop
-1:
+ or %0, %1, %%g1
+ wr %%g1, 0x0, %%psr
+ nop; nop; nop
" : "=r" (retval)
: "i" (PSR_PIL)
- : "memory");
+ : "g1", "memory");
return retval;
}
-extern char spdeb_buf[256];
-
#define __save_flags(flags) ((flags) = getipl())
#define __save_and_cli(flags) ((flags) = read_psr_and_cli())
#define __restore_flags(flags) setipl((flags))
#ifdef __SMP__
-extern void __global_cli(void);
-extern void __global_sti(void);
-extern unsigned long __global_save_flags(void);
-extern void __global_restore_flags(unsigned long);
-#define cli() __global_cli()
-#define sti() __global_sti()
-#define save_flags(x) ((x)=__global_save_flags())
-#define restore_flags(x) __global_restore_flags(x)
-#define save_and_cli(x) do { (x)=__global_save_flags(); __global_cli(); } while(0)
+/* Visit arch/sparc/lib/irqlock.S for all the fun details... */
+#define cli() __asm__ __volatile__("mov %%o7, %%g4\n\t" \
+ "call ___global_cli\n\t" \
+ " rd %%tbr, %%g7" : : \
+ : "g1", "g2", "g3", "g4", "g5", "g7", \
+ "memory", "cc")
+
+#define sti() \
+do { register unsigned long bits asm("g7"); \
+ bits = 0; \
+ __asm__ __volatile__("mov %%o7, %%g4\n\t" \
+ "call ___global_sti\n\t" \
+ " rd %%tbr, %%g2" \
+ : /* no outputs */ \
+ : "r" (bits) \
+ : "g1", "g2", "g3", "g4", "g5", \
+ "memory", "cc"); \
+} while(0)
+
+extern unsigned char global_irq_holder;
+
+#define save_flags(x) \
+do { int cpuid; \
+ __asm__ __volatile__("rd %%tbr, %0; srl %0, 12, %0; and %0, 3, %0" \
+ : "=r" (cpuid)); \
+ ((x) = ((global_irq_holder == (unsigned char) cpuid) ? 1 : \
+ ((getipl() & PSR_PIL) ? 2 : 0))); \
+} while(0)
+
+#define restore_flags(flags) \
+do { register unsigned long bits asm("g7"); \
+ bits = flags; \
+ __asm__ __volatile__("mov %%o7, %%g4\n\t" \
+ "call ___global_restore_flags\n\t" \
+ " andcc %%g7, 0x1, %%g0" \
+ : "=&r" (bits) \
+ : "0" (bits) \
+ : "g1", "g2", "g3", "g4", "g5", \
+ "memory", "cc"); \
+} while(0)
+
+#define save_and_cli(flags) do { save_flags(flags); cli(); } while(0)
#else
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov