summaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2012-07-05 17:31:39 +0200
committerJunfeng Dong <junfeng.dong@intel.com>2013-11-19 18:57:37 +0800
commitc4721bdf400b21a4c2a356ad962e3cfba4a0133a (patch)
tree0ca35bfbd3874241fbc78c254c9d801e2756a0a1 /linux-user
parenta0e5915d9201986c22372dcdf418d686490cfc04 (diff)
downloadqemu-c4721bdf400b21a4c2a356ad962e3cfba4a0133a.tar.gz
qemu-c4721bdf400b21a4c2a356ad962e3cfba4a0133a.tar.bz2
qemu-c4721bdf400b21a4c2a356ad962e3cfba4a0133a.zip
linux-user: lock tcg
The tcg code generator is not thread safe. Lock its generation between different threads. Signed-off-by: Alexander Graf <agraf@suse.de> [AF: Rebased onto exec.c/translate-all.c split for 1.4] Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/mmap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 34a561512..7ebf953c9 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -30,6 +30,7 @@
#include "qemu.h"
#include "qemu-common.h"
+#include "tcg.h"
//#define DEBUG_MMAP
@@ -40,6 +41,7 @@ void mmap_lock(void)
{
if (mmap_lock_count++ == 0) {
pthread_mutex_lock(&mmap_mutex);
+ tcg_lock();
}
}
@@ -47,6 +49,7 @@ void mmap_unlock(void)
{
if (--mmap_lock_count == 0) {
pthread_mutex_unlock(&mmap_mutex);
+ tcg_unlock();
}
}