summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authorunknown <heikki@donna.mysql.fi>2001-05-31 15:23:40 +0300
committerunknown <heikki@donna.mysql.fi>2001-05-31 15:23:40 +0300
commit439b74179f2363b6086a39fc075985f05e6a1f3b (patch)
tree2d009ee5f802e1c4cc3657fc6f88c1af5c942d71 /innobase
parentc01c86f90eceb7994df2b8075322b4149a4e5700 (diff)
downloadmariadb-git-439b74179f2363b6086a39fc075985f05e6a1f3b.tar.gz
sync0sync.ic Use XCHG also to reset the mutex lock word: it makes a serialization point to code on Intel and gives more safety
innobase/include/sync0sync.ic: Use XCHG also to reset the mutex lock word: it makes a serialization point to code on Intel and gives more safety BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'innobase')
-rw-r--r--innobase/include/sync0sync.ic24
1 files changed, 19 insertions, 5 deletions
diff --git a/innobase/include/sync0sync.ic b/innobase/include/sync0sync.ic
index 5a872c6b093..ba948ff35cd 100644
--- a/innobase/include/sync0sync.ic
+++ b/innobase/include/sync0sync.ic
@@ -94,10 +94,12 @@ mutex_test_and_set(
/* In assembly we use the so-called AT & T syntax where
the order of operands is inverted compared to the ordinary Intel
- syntax. The 'l' after the mnemonics denotes a 32-bit operation. */
+ syntax. The 'l' after the mnemonics denotes a 32-bit operation.
+ The line after the code tells which values come out of the asm
+ code, and the second line tells the input to the asm code. */
asm volatile("movl $1, %%eax; xchgl (%%ecx), %%eax" :
- "=eax" (res):
+ "=eax" (res), "=m" (*lw) :
"ecx" (lw));
return(res);
#else
@@ -132,12 +134,24 @@ mutex_reset_lock_word(
__asm MOV EDX, 0
__asm MOV ECX, lw
__asm XCHG EDX, DWORD PTR [ECX]
+#elif defined(__GNUC__) && defined(UNIV_INTEL_X86)
+ ulint* lw;
+
+ lw = &(mutex->lock_word);
+
+ /* In assembly we use the so-called AT & T syntax where
+ the order of operands is inverted compared to the ordinary Intel
+ syntax. The 'l' after the mnemonics denotes a 32-bit operation. */
+
+ asm volatile("movl $0, %%eax; xchgl (%%ecx), %%eax" :
+ "=m" (*lw) :
+ "ecx" (lw) :
+ "eax"); /* gcc does not seem to understand
+ that our asm code resets eax: tell it
+ explicitly that after the third ':' */
#else
- mutex->lock_word = 0;
-#if !(defined(__GNUC__) && defined(UNIV_INTEL_X86))
os_fast_mutex_unlock(&(mutex->os_fast_mutex));
#endif
-#endif
}
/**********************************************************************