diff options
author | jake <jake@FreeBSD.org> | 2000-12-08 08:49:36 +0000 |
---|---|---|
committer | jake <jake@FreeBSD.org> | 2000-12-08 08:49:36 +0000 |
commit | 601ec8e1853accdb6afea835eff3e1a5d42b2390 (patch) | |
tree | e239bde1cc0560f7dfae4dce3587930207ae2779 /sys/amd64/include/mutex.h | |
parent | 5ffb13b6a272087a2d20543809a9e961427b034b (diff) | |
download | FreeBSD-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/amd64/include/mutex.h')
-rw-r--r-- | sys/amd64/include/mutex.h | 24 |
1 files changed, 13 insertions, 11 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; \ |