Make MPLOCKED work again in asm files and stringify it explicitly

where necessary.

Reviewed by: jake
This commit is contained in:
Bosko Milekic 2002-02-28 06:17:05 +00:00
parent 69f7bcf319
commit 71acb2477f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=91469
4 changed files with 20 additions and 20 deletions

View File

@ -80,7 +80,7 @@ void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v);
* the binaries will run on both types of systems.
*/
#if defined(SMP) || !defined(_KERNEL)
#define MPLOCKED "lock ; "
#define MPLOCKED lock ;
#else
#define MPLOCKED
#endif
@ -93,7 +93,7 @@ void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v);
static __inline void \
atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\
{ \
__asm __volatile(MPLOCKED OP \
__asm __volatile(__XSTRING(MPLOCKED) OP \
: "+m" (*p) \
: CONS (V)); \
}
@ -137,7 +137,7 @@ atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)
int res = exp;
__asm __volatile (
" " MPLOCKED " "
" " __XSTRING(MPLOCKED) " "
" cmpxchgl %1,%2 ; "
" setz %%al ; "
" movzbl %%al,%0 ; "
@ -180,7 +180,7 @@ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \
{ \
u_##TYPE res; \
\
__asm __volatile(MPLOCKED LOP \
__asm __volatile(__XSTRING(MPLOCKED) LOP \
: "=a" (res), /* 0 (result) */\
"+m" (*p) /* 1 */ \
: : "memory"); \

View File

@ -57,7 +57,7 @@ extern struct mtx clock_lock;
int _res = MTX_UNOWNED; \
\
__asm __volatile ( \
" " MPLOCKED "" \
" " __XSTRING(MPLOCKED) "" \
" cmpxchgl %3,%1;" /* Try */ \
" jz 1f;" /* Got it */ \
" andl $" _V(MTX_FLAGMASK) ",%0;" /* turn off spec bits */ \
@ -69,7 +69,7 @@ extern struct mtx clock_lock;
" addl $8,%%esp;" \
" jmp 1f;" \
"2:" \
" " MPLOCKED "" \
" " __XSTRING(MPLOCKED) "" \
" orl $" _V(MTX_RECURSE) ",%1;" \
" incl %2;" \
"1:" \
@ -90,7 +90,7 @@ extern struct mtx clock_lock;
__asm __volatile ( \
" pushfl;" \
" cli;" \
" " MPLOCKED "" \
" " __XSTRING(MPLOCKED) "" \
" cmpxchgl %3,%1;" /* Try */ \
" jz 2f;" /* got it */ \
" pushl %4;" \
@ -118,7 +118,7 @@ extern struct mtx clock_lock;
int _res = MTX_UNOWNED; \
\
__asm __volatile ( \
" " MPLOCKED "" \
" " __XSTRING(MPLOCKED) "" \
" cmpxchgl %2,%1;" /* Try */ \
" jz 1f;" /* got it */ \
" pushl %3;" \
@ -143,7 +143,7 @@ extern struct mtx clock_lock;
int _tid = (int)(tid); \
\
__asm __volatile ( \
" " MPLOCKED "" \
" " __XSTRING(MPLOCKED) "" \
" cmpxchgl %4,%0;" /* try easy rel */ \
" jz 1f;" /* released! */ \
" pushl %2;" \
@ -168,7 +168,7 @@ extern struct mtx clock_lock;
int _tid = (int)(tid); \
\
__asm __volatile ( \
" " MPLOCKED "" \
" " __XSTRING(MPLOCKED) "" \
" cmpxchgl %5,%0;" /* try easy rel */ \
" jz 1f;" /* released! */ \
" testl $" _V(MTX_RECURSE) ",%%eax;" /* recursed? */ \

View File

@ -80,7 +80,7 @@ void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v);
* the binaries will run on both types of systems.
*/
#if defined(SMP) || !defined(_KERNEL)
#define MPLOCKED "lock ; "
#define MPLOCKED lock ;
#else
#define MPLOCKED
#endif
@ -93,7 +93,7 @@ void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v);
static __inline void \
atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\
{ \
__asm __volatile(MPLOCKED OP \
__asm __volatile(__XSTRING(MPLOCKED) OP \
: "+m" (*p) \
: CONS (V)); \
}
@ -137,7 +137,7 @@ atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)
int res = exp;
__asm __volatile (
" " MPLOCKED " "
" " __XSTRING(MPLOCKED) " "
" cmpxchgl %1,%2 ; "
" setz %%al ; "
" movzbl %%al,%0 ; "
@ -180,7 +180,7 @@ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \
{ \
u_##TYPE res; \
\
__asm __volatile(MPLOCKED LOP \
__asm __volatile(__XSTRING(MPLOCKED) LOP \
: "=a" (res), /* 0 (result) */\
"+m" (*p) /* 1 */ \
: : "memory"); \

View File

@ -57,7 +57,7 @@ extern struct mtx clock_lock;
int _res = MTX_UNOWNED; \
\
__asm __volatile ( \
" " MPLOCKED "" \
" " __XSTRING(MPLOCKED) "" \
" cmpxchgl %3,%1;" /* Try */ \
" jz 1f;" /* Got it */ \
" andl $" _V(MTX_FLAGMASK) ",%0;" /* turn off spec bits */ \
@ -69,7 +69,7 @@ extern struct mtx clock_lock;
" addl $8,%%esp;" \
" jmp 1f;" \
"2:" \
" " MPLOCKED "" \
" " __XSTRING(MPLOCKED) "" \
" orl $" _V(MTX_RECURSE) ",%1;" \
" incl %2;" \
"1:" \
@ -90,7 +90,7 @@ extern struct mtx clock_lock;
__asm __volatile ( \
" pushfl;" \
" cli;" \
" " MPLOCKED "" \
" " __XSTRING(MPLOCKED) "" \
" cmpxchgl %3,%1;" /* Try */ \
" jz 2f;" /* got it */ \
" pushl %4;" \
@ -118,7 +118,7 @@ extern struct mtx clock_lock;
int _res = MTX_UNOWNED; \
\
__asm __volatile ( \
" " MPLOCKED "" \
" " __XSTRING(MPLOCKED) "" \
" cmpxchgl %2,%1;" /* Try */ \
" jz 1f;" /* got it */ \
" pushl %3;" \
@ -143,7 +143,7 @@ extern struct mtx clock_lock;
int _tid = (int)(tid); \
\
__asm __volatile ( \
" " MPLOCKED "" \
" " __XSTRING(MPLOCKED) "" \
" cmpxchgl %4,%0;" /* try easy rel */ \
" jz 1f;" /* released! */ \
" pushl %2;" \
@ -168,7 +168,7 @@ extern struct mtx clock_lock;
int _tid = (int)(tid); \
\
__asm __volatile ( \
" " MPLOCKED "" \
" " __XSTRING(MPLOCKED) "" \
" cmpxchgl %5,%0;" /* try easy rel */ \
" jz 1f;" /* released! */ \
" testl $" _V(MTX_RECURSE) ",%%eax;" /* recursed? */ \