summaryrefslogtreecommitdiff
path: root/innobase/sync/sync0sync.c
diff options
context:
space:
mode:
authorunknown <serg@serg.mysql.com>2001-07-02 21:52:22 +0200
committerunknown <serg@serg.mysql.com>2001-07-02 21:52:22 +0200
commita1826b55198ebd1ea5a3bafb88a52d1cf0c2f427 (patch)
treeb02cd20fcbc632447cd4b10782204969c9e6af34 /innobase/sync/sync0sync.c
parent2d28c646cbd53c1fcdf800dc408580aa5377f3b9 (diff)
parentcdfc04fb0819109ba3f7b78e87191b9b8311b9bf (diff)
downloadmariadb-git-a1826b55198ebd1ea5a3bafb88a52d1cf0c2f427.tar.gz
merged
include/my_base.h: Auto merged include/myisam.h: Auto merged myisam/mi_open.c: Auto merged myisam/myisamdef.h: Auto merged myisam/myisampack.c: Auto merged mysql-test/t/alter_table.test: Auto merged mysys/tree.c: Auto merged sql/ha_myisam.cc: Auto merged sql/item_sum.cc: Auto merged sql/mysqld.cc: Auto merged sql/sql_table.cc: Auto merged
Diffstat (limited to 'innobase/sync/sync0sync.c')
-rw-r--r--innobase/sync/sync0sync.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/innobase/sync/sync0sync.c b/innobase/sync/sync0sync.c
index 7153355d2a9..c3a1ac3b47f 100644
--- a/innobase/sync/sync0sync.c
+++ b/innobase/sync/sync0sync.c
@@ -166,6 +166,46 @@ struct sync_level_struct{
ulint level; /* level of the latch in the latching order */
};
+
+#if defined(__GNUC__) && defined(UNIV_INTEL_X86)
+
+ulint
+sync_gnuc_intelx86_test_and_set(
+ /* out: old value of the lock word */
+ ulint* lw) /* in: pointer to the lock word */
+{
+ ulint res;
+
+ /* 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.
+ 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), "=m" (*lw) :
+ "ecx" (lw));
+ return(res);
+}
+
+void
+sync_gnuc_intelx86_reset(
+ ulint* lw) /* in: pointer to the 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 ':' */
+}
+
+#endif
+
/**********************************************************************
Creates, or rather, initializes a mutex object in a specified memory
location (which must be appropriately aligned). The mutex is initialized