diff --git a/include/qemu.h b/include/qemu.h
index f0a727e3..26cbd141 100644
--- a/include/qemu.h
+++ b/include/qemu.h
@@ -14,7 +14,6 @@ struct uc_struct;
#include "qemu/thread.h"
#include "include/qom/cpu.h"
-#include "exec/spinlock.h"
#include "vl.h"
diff --git a/include/uc_priv.h b/include/uc_priv.h
index dd4a211b..23889332 100644
--- a/include/uc_priv.h
+++ b/include/uc_priv.h
@@ -177,7 +177,6 @@ struct uc_struct {
RAMList ram_list; // qemu/exec.c
BounceBuffer bounce; // qemu/cpu-exec.c
volatile sig_atomic_t exit_request; // qemu/cpu-exec.c
- spinlock_t x86_global_cpu_lock; // for X86 arch only
bool global_dirty_log; // qemu/memory.c
/* This is a multi-level map on the virtual address space.
The bottom level has pointers to PageDesc. */
diff --git a/qemu/aarch64.h b/qemu/aarch64.h
index b641ed02..1e89318e 100644
--- a/qemu/aarch64.h
+++ b/qemu/aarch64.h
@@ -2597,8 +2597,6 @@
#define softmmu_unlock_user softmmu_unlock_user_aarch64
#define sort_constraints sort_constraints_aarch64
#define sp_el0_access sp_el0_access_aarch64
-#define spin_lock spin_lock_aarch64
-#define spin_unlock spin_unlock_aarch64
#define spsel_read spsel_read_aarch64
#define spsel_write spsel_write_aarch64
#define start_list start_list_aarch64
diff --git a/qemu/arm.h b/qemu/arm.h
index 090ec4de..d92233aa 100644
--- a/qemu/arm.h
+++ b/qemu/arm.h
@@ -2597,8 +2597,6 @@
#define softmmu_unlock_user softmmu_unlock_user_arm
#define sort_constraints sort_constraints_arm
#define sp_el0_access sp_el0_access_arm
-#define spin_lock spin_lock_arm
-#define spin_unlock spin_unlock_arm
#define spsel_read spsel_read_arm
#define spsel_write spsel_write_arm
#define start_list start_list_arm
diff --git a/qemu/cpu-exec.c b/qemu/cpu-exec.c
index 61b11f30..8a44dfe0 100644
--- a/qemu/cpu-exec.c
+++ b/qemu/cpu-exec.c
@@ -67,9 +67,6 @@ int cpu_exec(struct uc_struct *uc, CPUArchState *env) // qq
struct hook *hook;
- /* This must be volatile so it is not trashed by longjmp() */
- volatile bool have_tb_lock = false;
-
if (cpu->halted) {
if (!cpu_has_work(cpu)) {
return EXCP_HALTED;
@@ -208,8 +205,6 @@ int cpu_exec(struct uc_struct *uc, CPUArchState *env) // qq
cpu->exception_index = EXCP_INTERRUPT;
cpu_loop_exit(cpu);
}
- spin_lock(&tcg_ctx->tb_ctx.tb_lock);
- have_tb_lock = true;
tb = tb_find_fast(env); // qq
if (!tb) { // invalid TB due to invalid code?
uc->invalid_error = UC_ERR_FETCH_UNMAPPED;
@@ -232,8 +227,6 @@ int cpu_exec(struct uc_struct *uc, CPUArchState *env) // qq
tb_add_jump((TranslationBlock *)(next_tb & ~TB_EXIT_MASK),
next_tb & TB_EXIT_MASK, tb);
}
- have_tb_lock = false;
- spin_unlock(&tcg_ctx->tb_ctx.tb_lock);
/* cpu_interrupt might be called while translating the
TB, but before it is linked into a potentially
@@ -275,10 +268,6 @@ int cpu_exec(struct uc_struct *uc, CPUArchState *env) // qq
#ifdef TARGET_I386
x86_cpu = X86_CPU(uc, cpu);
#endif
- if (have_tb_lock) {
- spin_unlock(&tcg_ctx->tb_ctx.tb_lock);
- have_tb_lock = false;
- }
}
} /* for(;;) */
diff --git a/qemu/header_gen.py b/qemu/header_gen.py
index 35b84d4d..0e527241 100644
--- a/qemu/header_gen.py
+++ b/qemu/header_gen.py
@@ -2603,8 +2603,6 @@ symbols = (
'softmmu_unlock_user',
'sort_constraints',
'sp_el0_access',
- 'spin_lock',
- 'spin_unlock',
'spsel_read',
'spsel_write',
'start_list',
diff --git a/qemu/include/exec/exec-all.h b/qemu/include/exec/exec-all.h
index cdf888f4..ea04678d 100644
--- a/qemu/include/exec/exec-all.h
+++ b/qemu/include/exec/exec-all.h
@@ -169,8 +169,6 @@ struct TranslationBlock {
uint32_t icount;
};
-#include "exec/spinlock.h"
-
typedef struct TBContext TBContext;
struct TBContext {
@@ -178,8 +176,6 @@ struct TBContext {
TranslationBlock *tbs;
TranslationBlock *tb_phys_hash[CODE_GEN_PHYS_HASH_SIZE];
int nb_tbs;
- /* any access to the tbs or the page table must use this lock */
- spinlock_t tb_lock;
/* statistics */
int tb_flush_count;
diff --git a/qemu/include/exec/spinlock.h b/qemu/include/exec/spinlock.h
deleted file mode 100644
index 215b27b4..00000000
--- a/qemu/include/exec/spinlock.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2003 Fabrice Bellard
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, see
- */
-
-/* configure guarantees us that we have pthreads on any host except
- * mingw32, which doesn't support any of the user-only targets.
- * So we can simply assume we have pthread mutexes here.
- */
-#ifndef QEMU_EXEC_SPINLOCK_H
-#define QEMU_EXEC_SPINLOCK_H
-
-#if defined(CONFIG_USER_ONLY)
-
-#include
-#define spin_lock pthread_mutex_lock
-#define spin_unlock pthread_mutex_unlock
-#define spinlock_t pthread_mutex_t
-#define SPIN_LOCK_UNLOCKED PTHREAD_MUTEX_INITIALIZER
-
-#else
-
-/* Empty implementations, on the theory that system mode emulation
- * is single-threaded. This means that these functions should only
- * be used from code run in the TCG cpu thread, and cannot protect
- * data structures which might also be accessed from the IO thread
- * or from signal handlers.
- */
-typedef int spinlock_t;
-#define SPIN_LOCK_UNLOCKED 0
-
-static inline void spin_lock(spinlock_t *lock)
-{
-}
-
-static inline void spin_unlock(spinlock_t *lock)
-{
-}
-
-#endif
-#endif
diff --git a/qemu/m68k.h b/qemu/m68k.h
index b6c94a0d..850d8fad 100644
--- a/qemu/m68k.h
+++ b/qemu/m68k.h
@@ -2597,8 +2597,6 @@
#define softmmu_unlock_user softmmu_unlock_user_m68k
#define sort_constraints sort_constraints_m68k
#define sp_el0_access sp_el0_access_m68k
-#define spin_lock spin_lock_m68k
-#define spin_unlock spin_unlock_m68k
#define spsel_read spsel_read_m68k
#define spsel_write spsel_write_m68k
#define start_list start_list_m68k
diff --git a/qemu/mips.h b/qemu/mips.h
index 18e73078..c151426c 100644
--- a/qemu/mips.h
+++ b/qemu/mips.h
@@ -2597,8 +2597,6 @@
#define softmmu_unlock_user softmmu_unlock_user_mips
#define sort_constraints sort_constraints_mips
#define sp_el0_access sp_el0_access_mips
-#define spin_lock spin_lock_mips
-#define spin_unlock spin_unlock_mips
#define spsel_read spsel_read_mips
#define spsel_write spsel_write_mips
#define start_list start_list_mips
diff --git a/qemu/mips64.h b/qemu/mips64.h
index 155494bd..ff74feb8 100644
--- a/qemu/mips64.h
+++ b/qemu/mips64.h
@@ -2597,8 +2597,6 @@
#define softmmu_unlock_user softmmu_unlock_user_mips64
#define sort_constraints sort_constraints_mips64
#define sp_el0_access sp_el0_access_mips64
-#define spin_lock spin_lock_mips64
-#define spin_unlock spin_unlock_mips64
#define spsel_read spsel_read_mips64
#define spsel_write spsel_write_mips64
#define start_list start_list_mips64
diff --git a/qemu/mips64el.h b/qemu/mips64el.h
index 004a8f47..cbebb6a1 100644
--- a/qemu/mips64el.h
+++ b/qemu/mips64el.h
@@ -2597,8 +2597,6 @@
#define softmmu_unlock_user softmmu_unlock_user_mips64el
#define sort_constraints sort_constraints_mips64el
#define sp_el0_access sp_el0_access_mips64el
-#define spin_lock spin_lock_mips64el
-#define spin_unlock spin_unlock_mips64el
#define spsel_read spsel_read_mips64el
#define spsel_write spsel_write_mips64el
#define start_list start_list_mips64el
diff --git a/qemu/mipsel.h b/qemu/mipsel.h
index cb76e4ce..d6fe1ea3 100644
--- a/qemu/mipsel.h
+++ b/qemu/mipsel.h
@@ -2597,8 +2597,6 @@
#define softmmu_unlock_user softmmu_unlock_user_mipsel
#define sort_constraints sort_constraints_mipsel
#define sp_el0_access sp_el0_access_mipsel
-#define spin_lock spin_lock_mipsel
-#define spin_unlock spin_unlock_mipsel
#define spsel_read spsel_read_mipsel
#define spsel_write spsel_write_mipsel
#define start_list start_list_mipsel
diff --git a/qemu/powerpc.h b/qemu/powerpc.h
index 62a8c366..b973ed72 100644
--- a/qemu/powerpc.h
+++ b/qemu/powerpc.h
@@ -2597,8 +2597,6 @@
#define softmmu_unlock_user softmmu_unlock_user_powerpc
#define sort_constraints sort_constraints_powerpc
#define sp_el0_access sp_el0_access_powerpc
-#define spin_lock spin_lock_powerpc
-#define spin_unlock spin_unlock_powerpc
#define spsel_read spsel_read_powerpc
#define spsel_write spsel_write_powerpc
#define start_list start_list_powerpc
diff --git a/qemu/sparc.h b/qemu/sparc.h
index 7259b6ba..af888648 100644
--- a/qemu/sparc.h
+++ b/qemu/sparc.h
@@ -2597,8 +2597,6 @@
#define softmmu_unlock_user softmmu_unlock_user_sparc
#define sort_constraints sort_constraints_sparc
#define sp_el0_access sp_el0_access_sparc
-#define spin_lock spin_lock_sparc
-#define spin_unlock spin_unlock_sparc
#define spsel_read spsel_read_sparc
#define spsel_write spsel_write_sparc
#define start_list start_list_sparc
diff --git a/qemu/sparc64.h b/qemu/sparc64.h
index 664d308a..09759477 100644
--- a/qemu/sparc64.h
+++ b/qemu/sparc64.h
@@ -2597,8 +2597,6 @@
#define softmmu_unlock_user softmmu_unlock_user_sparc64
#define sort_constraints sort_constraints_sparc64
#define sp_el0_access sp_el0_access_sparc64
-#define spin_lock spin_lock_sparc64
-#define spin_unlock spin_unlock_sparc64
#define spsel_read spsel_read_sparc64
#define spsel_write spsel_write_sparc64
#define start_list start_list_sparc64
diff --git a/qemu/target-i386/mem_helper.c b/qemu/target-i386/mem_helper.c
index f3ca92ef..f92c736c 100644
--- a/qemu/target-i386/mem_helper.c
+++ b/qemu/target-i386/mem_helper.c
@@ -27,12 +27,10 @@
void helper_lock(CPUX86State *env)
{
- spin_lock(&x86_env_get_cpu(env)->parent_obj.uc->x86_global_cpu_lock);
}
void helper_unlock(CPUX86State *env)
{
- spin_unlock(&x86_env_get_cpu(env)->parent_obj.uc->x86_global_cpu_lock);
}
void helper_cmpxchg8b(CPUX86State *env, target_ulong a0)
diff --git a/qemu/x86_64.h b/qemu/x86_64.h
index a9efa494..865c6ef8 100644
--- a/qemu/x86_64.h
+++ b/qemu/x86_64.h
@@ -2597,8 +2597,6 @@
#define softmmu_unlock_user softmmu_unlock_user_x86_64
#define sort_constraints sort_constraints_x86_64
#define sp_el0_access sp_el0_access_x86_64
-#define spin_lock spin_lock_x86_64
-#define spin_unlock spin_unlock_x86_64
#define spsel_read spsel_read_x86_64
#define spsel_write spsel_write_x86_64
#define start_list start_list_x86_64
diff --git a/uc.c b/uc.c
index 46b019cc..19aedaee 100644
--- a/uc.c
+++ b/uc.c
@@ -157,8 +157,6 @@ uc_err uc_open(uc_arch arch, uc_mode mode, uc_engine **result)
uc->ram_list.blocks.tqh_first = NULL;
uc->ram_list.blocks.tqh_last = &(uc->ram_list.blocks.tqh_first);
- uc->x86_global_cpu_lock = SPIN_LOCK_UNLOCKED;
-
uc->memory_listeners.tqh_first = NULL;
uc->memory_listeners.tqh_last = &uc->memory_listeners.tqh_first;