summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2000-12-08 08:49:36 +0000
committerjake <jake@FreeBSD.org>2000-12-08 08:49:36 +0000
commit601ec8e1853accdb6afea835eff3e1a5d42b2390 (patch)
treee239bde1cc0560f7dfae4dce3587930207ae2779 /sys
parent5ffb13b6a272087a2d20543809a9e961427b034b (diff)
downloadFreeBSD-src-601ec8e1853accdb6afea835eff3e1a5d42b2390.zip
FreeBSD-src-601ec8e1853accdb6afea835eff3e1a5d42b2390.tar.gz
Change the calling conventions of the MTX_ENTER macro to match
that of MTX_EXIT. Don't assume that the reg parameter to MTX_ENTER holds curproc, load it explicitly. Put semi-colons at the end of the macros to be more consistent and so its harder to forget them when these change.
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/include/mutex.h24
-rw-r--r--sys/i386/include/mutex.h24
2 files changed, 26 insertions, 22 deletions
diff --git a/sys/amd64/include/mutex.h b/sys/amd64/include/mutex.h
index 1c0ea08..34fe04e 100644
--- a/sys/amd64/include/mutex.h
+++ b/sys/amd64/include/mutex.h
@@ -258,26 +258,28 @@ extern char STR_SIEN[];
#else /* !LOCORE */
/*
- * Simple assembly macros to get and release non-recursive spin locks
+ * Simple assembly macros to get and release spin locks
*/
#if defined(I386_CPU)
-#define MTX_ENTER(reg, lck) \
- pushf; \
+#define MTX_ENTER(lck, reg) \
+ movl _curproc,reg; \
+ pushfl; \
cli; \
movl reg,lck+MTX_LOCK; \
- popl lck+MTX_SAVEINTR
+ popl lck+MTX_SAVEINTR;
#define MTX_EXIT(lck, reg) \
pushl lck+MTX_SAVEINTR; \
movl $ MTX_UNOWNED,lck+MTX_LOCK; \
- popf
+ popfl;
#else /* I386_CPU */
-#define MTX_ENTER(reg, lck) \
- pushf; \
+#define MTX_ENTER(lck, reg) \
+ movl _curproc,reg; \
+ pushfl; \
cli; \
9: movl $ MTX_UNOWNED,%eax; \
MPLOCKED \
@@ -286,15 +288,15 @@ extern char STR_SIEN[];
popl lck+MTX_SAVEINTR;
/* Must use locked bus op (cmpxchg) when setting to unowned (barrier) */
-#define MTX_EXIT(lck,reg) \
+#define MTX_EXIT(lck, reg) \
pushl lck+MTX_SAVEINTR; \
movl lck+MTX_LOCK,%eax; \
movl $ MTX_UNOWNED,reg; \
MPLOCKED \
cmpxchgl reg,lck+MTX_LOCK; \
- popf
+ popfl;
-#define MTX_ENTER_WITH_RECURSION(reg, lck) \
+#define MTX_ENTER_WITH_RECURSION(lck, reg) \
pushf; \
cli; \
movl lck+MTX_LOCK,%eax; \
@@ -311,7 +313,7 @@ extern char STR_SIEN[];
8: add $4,%esp; \
9:
-#define MTX_EXIT_WITH_RECURSION(lck,reg) \
+#define MTX_EXIT_WITH_RECURSION(lck, reg) \
movl lck+MTX_RECURSE,%eax; \
decl %eax; \
js 8f; \
diff --git a/sys/i386/include/mutex.h b/sys/i386/include/mutex.h
index 1c0ea08..34fe04e 100644
--- a/sys/i386/include/mutex.h
+++ b/sys/i386/include/mutex.h
@@ -258,26 +258,28 @@ extern char STR_SIEN[];
#else /* !LOCORE */
/*
- * Simple assembly macros to get and release non-recursive spin locks
+ * Simple assembly macros to get and release spin locks
*/
#if defined(I386_CPU)
-#define MTX_ENTER(reg, lck) \
- pushf; \
+#define MTX_ENTER(lck, reg) \
+ movl _curproc,reg; \
+ pushfl; \
cli; \
movl reg,lck+MTX_LOCK; \
- popl lck+MTX_SAVEINTR
+ popl lck+MTX_SAVEINTR;
#define MTX_EXIT(lck, reg) \
pushl lck+MTX_SAVEINTR; \
movl $ MTX_UNOWNED,lck+MTX_LOCK; \
- popf
+ popfl;
#else /* I386_CPU */
-#define MTX_ENTER(reg, lck) \
- pushf; \
+#define MTX_ENTER(lck, reg) \
+ movl _curproc,reg; \
+ pushfl; \
cli; \
9: movl $ MTX_UNOWNED,%eax; \
MPLOCKED \
@@ -286,15 +288,15 @@ extern char STR_SIEN[];
popl lck+MTX_SAVEINTR;
/* Must use locked bus op (cmpxchg) when setting to unowned (barrier) */
-#define MTX_EXIT(lck,reg) \
+#define MTX_EXIT(lck, reg) \
pushl lck+MTX_SAVEINTR; \
movl lck+MTX_LOCK,%eax; \
movl $ MTX_UNOWNED,reg; \
MPLOCKED \
cmpxchgl reg,lck+MTX_LOCK; \
- popf
+ popfl;
-#define MTX_ENTER_WITH_RECURSION(reg, lck) \
+#define MTX_ENTER_WITH_RECURSION(lck, reg) \
pushf; \
cli; \
movl lck+MTX_LOCK,%eax; \
@@ -311,7 +313,7 @@ extern char STR_SIEN[];
8: add $4,%esp; \
9:
-#define MTX_EXIT_WITH_RECURSION(lck,reg) \
+#define MTX_EXIT_WITH_RECURSION(lck, reg) \
movl lck+MTX_RECURSE,%eax; \
decl %eax; \
js 8f; \
OpenPOWER on IntegriCloud