Update of /cvsroot/linux-mips/linux/include/asm-mips64
In directory usw-pr-cvs1:/tmp/cvs-serv30438
Modified Files:
system.h
Log Message:
Rewrite __sti, __cli, __save_flags, __restore_flags and save_and_cli in a way that makes debugging gcc output quite a bit easier.
Index: system.h
===================================================================
RCS file: /cvsroot/linux-mips/linux/include/asm-mips64/system.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- system.h 2001/10/04 16:26:39 1.3
+++ system.h 2001/10/08 16:25:25 1.4
@@ -17,17 +17,23 @@
#include <linux/kernel.h>
-static inline void __sti(void)
+__asm__ (
+ ".macro\t__sti\n\t"
+ ".set\tpush\n\t"
+ ".set\treorder\n\t"
+ ".set\tnoat\n\t"
+ "mfc0\t$1,$12\n\t"
+ "ori\t$1,0x1f\n\t"
+ "xori\t$1,0x1e\n\t"
+ "mtc0\t$1,$12\n\t"
+ ".set\tpop\n\t"
+ ".endm");
+
+extern __inline__ void
+__sti(void)
{
__asm__ __volatile__(
- ".set\tnoreorder\n\t"
- ".set\tnoat\n\t"
- "mfc0\t$1,$12\n\t"
- "ori\t$1,0x1f\n\t"
- "xori\t$1,0x1e\n\t"
- "mtc0\t$1,$12\n\t"
- ".set\tat\n\t"
- ".set\treorder"
+ "__sti"
: /* no outputs */
: /* no inputs */
: "memory");
@@ -40,67 +46,90 @@
* R4000/R4400 need three nops, the R4600 two nops and the R10000 needs
* no nops at all.
*/
-static inline void __cli(void)
+__asm__ (
+ ".macro\t__cli\n\t"
+ ".set\tpush\n\t"
+ ".set\treorder\n\t"
+ ".set\tnoat\n\t"
+ "mfc0\t$1,$12\n\t"
+ "ori\t$1,1\n\t"
+ "xori\t$1,1\n\t"
+ ".set\tnoreorder\n\t"
+ "mtc0\t$1,$12\n\t"
+ "nop\n\t"
+ "nop\n\t"
+ "nop\n\t"
+ ".set\tpop\n\t"
+ ".endm");
+
+extern __inline__ void
+__cli(void)
{
__asm__ __volatile__(
- ".set\tnoreorder\n\t"
- ".set\tnoat\n\t"
- "mfc0\t$1,$12\n\t"
- "ori\t$1,1\n\t"
- "xori\t$1,1\n\t"
- "mtc0\t$1,$12\n\t"
- "nop\n\t"
- "nop\n\t"
- "nop\n\t"
- ".set\tat\n\t"
- ".set\treorder"
+ "__cli"
: /* no outputs */
: /* no inputs */
: "memory");
}
+__asm__ (
+ ".macro\t__save_flags flags\n\t"
+ ".set\tpush\n\t"
+ ".set\treorder\n\t"
+ "mfc0\t\\flags, $12\n\t"
+ ".set\tpop\n\t"
+ ".endm");
+
#define __save_flags(x) \
__asm__ __volatile__( \
- ".set\tnoreorder\n\t" \
- "mfc0\t%0,$12\n\t" \
- ".set\treorder" \
+ "__save_flags %0" \
: "=r" (x))
+__asm__ (
+ ".macro\t__save_and_cli result\n\t"
+ ".set\tpush\n\t"
+ ".set\treorder\n\t"
+ ".set\tnoat\n\t"
+ "mfc0\t\\result, $12\n\t"
+ "ori\t$1, \\result, 1\n\t"
+ "xori\t$1, 1\n\t"
+ ".set\tnoreorder\n\t"
+ "mtc0\t$1, $12\n\t"
+ "nop\n\t"
+ "nop\n\t"
+ "nop\n\t"
+ ".set\tpop\n\t"
+ ".endm");
+
#define __save_and_cli(x) \
__asm__ __volatile__( \
- ".set\tnoreorder\n\t" \
- ".set\tnoat\n\t" \
- "mfc0\t%0,$12\n\t" \
- "ori\t$1,%0,1\n\t" \
- "xori\t$1,1\n\t" \
- "mtc0\t$1,$12\n\t" \
- "nop\n\t" \
- "nop\n\t" \
- "nop\n\t" \
- ".set\tat\n\t" \
- ".set\treorder" \
+ "__save_and_cli\t%0" \
: "=r" (x) \
: /* no inputs */ \
: "memory")
+__asm__(".macro\t__restore_flags flags\n\t"
+ ".set\tnoreorder\n\t"
+ ".set\tnoat\n\t"
+ "mfc0\t$1, $12\n\t"
+ "andi\t\\flags, 1\n\t"
+ "ori\t$1, 1\n\t"
+ "xori\t$1, 1\n\t"
+ "or\t\\flags, $1\n\t"
+ "mtc0\t\\flags, $12\n\t"
+ "nop\n\t"
+ "nop\n\t"
+ "nop\n\t"
+ ".set\tat\n\t"
+ ".set\treorder\n\t"
+ ".endm");
+
#define __restore_flags(flags) \
do { \
unsigned long __tmp1; \
\
__asm__ __volatile__( \
- ".set\tnoreorder\t\t\t# __restore_flags\n\t" \
- ".set\tnoat\n\t" \
- "mfc0\t$1, $12\n\t" \
- "andi\t%0, 1\n\t" \
- "ori\t$1, 1\n\t" \
- "xori\t$1, 1\n\t" \
- "or\t%0, $1\n\t" \
- "mtc0\t%0, $12\n\t" \
- "nop\n\t" \
- "nop\n\t" \
- "nop\n\t" \
- ".set\tat\n\t" \
- ".set\treorder" \
+ "__restore_flags\t%0" \
: "=r" (__tmp1) \
: "0" (flags) \
: "memory"); \
|