Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/m68k/include Some micro-optimisations to _spl() and...
details: https://anonhg.NetBSD.org/src/rev/8ae672ddb679
branches: trunk
changeset: 500425:8ae672ddb679
user: scw <scw%NetBSD.org@localhost>
date: Mon Dec 11 20:05:33 2000 +0000
description:
Some micro-optimisations to _spl() and _splraise(), saving one instruction
in the former, and three to seven in the latter.
diffstat:
sys/arch/m68k/include/psl.h | 54 ++++++++++++++++++++-------------------------
1 files changed, 24 insertions(+), 30 deletions(-)
diffs (71 lines):
diff -r 676f46f170d4 -r 8ae672ddb679 sys/arch/m68k/include/psl.h
--- a/sys/arch/m68k/include/psl.h Mon Dec 11 19:53:06 2000 +0000
+++ b/sys/arch/m68k/include/psl.h Mon Dec 11 20:05:33 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: psl.h,v 1.7 1999/11/06 17:42:33 thorpej Exp $ */
+/* $NetBSD: psl.h,v 1.8 2000/12/11 20:05:33 scw Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@@ -74,38 +74,32 @@
#if defined(_KERNEL) && !defined(_LOCORE)
/*
- * spl functions; platform-specific code must define spl0.
+ * spl functions; platform-specific code must define spl0 and splx().
*/
-#define _spl(s) \
-({ \
- register int _spl_r; \
- \
- __asm __volatile ("clrl %0; movew %%sr,%0; movew %1,%%sr" : \
- "&=d" (_spl_r) : "di" (s)); \
- _spl_r; \
-})
+static __inline int
+_spl(int s)
+{
+ int sr;
+
+ __asm __volatile ("movew %%sr,%0; movew %1,%%sr" :
+ "&=d" (sr) : "di" (s));
+
+ return sr;
+}
-#define _splraise(s) \
-({ \
- int _spl_r; \
- \
- __asm __volatile (" \
- clrl %%d0 ; \
- movw %%sr,%%d0 ; \
- movl %%d0,%0 ; \
- andw #0x700,%%d0 ; \
- movw %1,%%d1 ; \
- andw #0x700,%%d1 ; \
- cmpw %%d0,%%d1 ; \
- jle 1f ; \
- movw %1,%%sr ; \
- 1:" : \
- "&=d" (_spl_r) : \
- "di" (s) : \
- "d0", "d1"); \
- _spl_r; \
-})
+static __inline int
+_splraise(int level)
+{
+ int sr;
+
+ __asm __volatile("movw %%sr,%0" : "=d" (sr));
+
+ if ((u_int16_t)level >= PSL_HIGHIPL || (u_int16_t)level > (u_int16_t)sr)
+ __asm __volatile("movw %0,%%sr" :: "di" (level));
+
+ return sr;
+}
/* spl0 may require checking for software interrupts */
#define _spl0() _spl(PSL_S|PSL_IPL0)
Home |
Main Index |
Thread Index |
Old Index