diff --git a/include/uc_priv.h b/include/uc_priv.h index e36a8c84..b3401525 100644 --- a/include/uc_priv.h +++ b/include/uc_priv.h @@ -147,7 +147,6 @@ struct uc_struct { uc_mode mode; QemuMutex qemu_global_mutex; // qemu/cpus.c QemuCond qemu_cpu_cond; // qemu/cpus.c - QemuThread *tcg_cpu_thread; // qemu/cpus.c QemuCond *tcg_halt_cond; // qemu/cpus.c struct CPUTailQ cpus; // qemu/cpu-exec.c uc_err errnum; // qemu/cpu-exec.c @@ -163,7 +162,7 @@ struct uc_struct { uc_args_uc_u64_t set_pc; // set PC for tracecode uc_args_int_t stop_interrupt; // check if the interrupt should stop emulation - uc_args_uc_t init_arch, pause_all_vcpus, cpu_exec_init_all; + uc_args_uc_t init_arch, cpu_exec_init_all; uc_args_int_uc_t vm_start; uc_args_tcg_enable_t tcg_enabled; uc_args_uc_long_t tcg_exec_init; diff --git a/qemu/Makefile.objs b/qemu/Makefile.objs index d309d2a4..e3bc755c 100644 --- a/qemu/Makefile.objs +++ b/qemu/Makefile.objs @@ -19,7 +19,7 @@ ifeq ($(CONFIG_SOFTMMU),y) common-obj-y += hw/ common-obj-y += accel.o -common-obj-y += vl.o main-loop.o qemu-timer.o +common-obj-y += vl.o qemu-timer.o endif diff --git a/qemu/aarch64.h b/qemu/aarch64.h index d75c06e1..dd02222b 100644 --- a/qemu/aarch64.h +++ b/qemu/aarch64.h @@ -2258,7 +2258,6 @@ #define parse_value parse_value_aarch64 #define par_write par_write_aarch64 #define patch_reloc patch_reloc_aarch64 -#define pause_all_vcpus pause_all_vcpus_aarch64 #define phys_map_node_alloc phys_map_node_alloc_aarch64 #define phys_map_node_reserve phys_map_node_reserve_aarch64 #define phys_mem_alloc phys_mem_alloc_aarch64 @@ -2418,8 +2417,6 @@ #define qemu_clock_ptr qemu_clock_ptr_aarch64 #define qemu_clocks qemu_clocks_aarch64 #define qemu_cond_destroy qemu_cond_destroy_aarch64 -#define qemu_cpu_is_self qemu_cpu_is_self_aarch64 -#define qemu_cpu_kick_thread qemu_cpu_kick_thread_aarch64 #define qemu_daemon qemu_daemon_aarch64 #define qemu_event_destroy qemu_event_destroy_aarch64 #define qemu_event_init qemu_event_init_aarch64 @@ -2516,9 +2513,7 @@ #define qemu_st_helpers qemu_st_helpers_aarch64 #define qemu_strnlen qemu_strnlen_aarch64 #define qemu_strsep qemu_strsep_aarch64 -#define qemu_tcg_cpu_thread_fn qemu_tcg_cpu_thread_fn_aarch64 #define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_aarch64 -#define qemu_thread_exit qemu_thread_exit_aarch64 #define qemu_try_memalign qemu_try_memalign_aarch64 #define qentry_destroy qentry_destroy_aarch64 #define qerror_human qerror_human_aarch64 diff --git a/qemu/arm.h b/qemu/arm.h index ef850c24..d4fcf42c 100644 --- a/qemu/arm.h +++ b/qemu/arm.h @@ -2258,7 +2258,6 @@ #define parse_value parse_value_arm #define par_write par_write_arm #define patch_reloc patch_reloc_arm -#define pause_all_vcpus pause_all_vcpus_arm #define phys_map_node_alloc phys_map_node_alloc_arm #define phys_map_node_reserve phys_map_node_reserve_arm #define phys_mem_alloc phys_mem_alloc_arm @@ -2418,8 +2417,6 @@ #define qemu_clock_ptr qemu_clock_ptr_arm #define qemu_clocks qemu_clocks_arm #define qemu_cond_destroy qemu_cond_destroy_arm -#define qemu_cpu_is_self qemu_cpu_is_self_arm -#define qemu_cpu_kick_thread qemu_cpu_kick_thread_arm #define qemu_daemon qemu_daemon_arm #define qemu_event_destroy qemu_event_destroy_arm #define qemu_event_init qemu_event_init_arm @@ -2516,9 +2513,7 @@ #define qemu_st_helpers qemu_st_helpers_arm #define qemu_strnlen qemu_strnlen_arm #define qemu_strsep qemu_strsep_arm -#define qemu_tcg_cpu_thread_fn qemu_tcg_cpu_thread_fn_arm #define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_arm -#define qemu_thread_exit qemu_thread_exit_arm #define qemu_try_memalign qemu_try_memalign_arm #define qentry_destroy qentry_destroy_arm #define qerror_human qerror_human_arm diff --git a/qemu/cpus.c b/qemu/cpus.c index 05220405..6961ed2f 100644 --- a/qemu/cpus.c +++ b/qemu/cpus.c @@ -55,28 +55,10 @@ bool cpu_is_stopped(CPUState *cpu) void run_on_cpu(CPUState *cpu, void (*func)(void *data), void *data) { - if (qemu_cpu_is_self(cpu)) { - func(data); - return; - } + func(data); + return; } -// send halt_cond/tcg_halt_cond to @cpu -bool qemu_cpu_is_self(CPUState *cpu) -{ - return qemu_thread_is_self(cpu->thread); -} - -void pause_all_vcpus(struct uc_struct *uc) -{ - CPUState *cpu; - - CPU_FOREACH(cpu) { - qemu_thread_join(cpu->thread); // qq: fix qemu_thread_join() to work for instance - } -} - - int resume_all_vcpus(struct uc_struct *uc) { CPUState *cpu; @@ -112,7 +94,6 @@ int qemu_init_vcpu(CPUState *cpu) cpu->nr_cores = smp_cores; cpu->nr_threads = smp_threads; cpu->stopped = true; - cpu->uc->tcg_cpu_thread = NULL; if (tcg_enabled(cpu->uc)) return qemu_tcg_init_vcpu(cpu); @@ -129,7 +110,6 @@ static void *qemu_tcg_cpu_loop(struct uc_struct *uc) qemu_mutex_lock(&uc->qemu_global_mutex); CPU_FOREACH(cpu) { - cpu->thread_id = qemu_get_thread_id(); cpu->created = true; } qemu_cond_signal(&uc->qemu_cpu_cond); @@ -140,7 +120,6 @@ static void *qemu_tcg_cpu_loop(struct uc_struct *uc) } CPU_FOREACH(cpu) { - cpu->thread_id = 0; cpu->created = false; } @@ -151,33 +130,16 @@ static void *qemu_tcg_cpu_loop(struct uc_struct *uc) -/* For temporary buffers for forming a name */ -#define VCPU_THREAD_NAME_SIZE 16 - static int qemu_tcg_init_vcpu(CPUState *cpu) { struct uc_struct *uc = cpu->uc; - char thread_name[VCPU_THREAD_NAME_SIZE]; tcg_cpu_address_space_init(cpu, cpu->as); /* share a single thread for all cpus with TCG */ - if (!uc->tcg_cpu_thread) { - cpu->thread = g_malloc0(sizeof(QemuThread)); - cpu->halt_cond = g_malloc0(sizeof(QemuCond)); - qemu_cond_init(cpu->halt_cond); - uc->tcg_halt_cond = cpu->halt_cond; - snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/TCG", - cpu->cpu_index); - qemu_thread_get_self(uc, cpu->thread); -#ifdef _WIN32 - cpu->hThread = qemu_thread_get_handle(cpu->thread); -#endif - uc->tcg_cpu_thread = cpu->thread; - } else { - cpu->thread = uc->tcg_cpu_thread; - cpu->halt_cond = uc->tcg_halt_cond; - } + cpu->halt_cond = g_malloc0(sizeof(QemuCond)); + qemu_cond_init(cpu->halt_cond); + uc->tcg_halt_cond = cpu->halt_cond; return 0; } diff --git a/qemu/exec.c b/qemu/exec.c index fcb2b7f4..15c4809f 100644 --- a/qemu/exec.c +++ b/qemu/exec.c @@ -432,10 +432,7 @@ void cpu_exec_init(CPUArchState *env, void *opaque) QTAILQ_INIT(&cpu->watchpoints); cpu->as = &uc->as; -#ifndef CONFIG_USER_ONLY - //cpu->as = &address_space_memory; - cpu->thread_id = qemu_get_thread_id(); -#endif + QTAILQ_INSERT_TAIL(&uc->cpus, cpu, node); //QTAILQ_INSERT_TAIL(&uc->cpus, cpu, node); #if defined(CONFIG_USER_ONLY) diff --git a/qemu/header_gen.py b/qemu/header_gen.py index 46bab7c9..5fcd7f01 100644 --- a/qemu/header_gen.py +++ b/qemu/header_gen.py @@ -2264,7 +2264,6 @@ symbols = ( 'parse_value', 'par_write', 'patch_reloc', - 'pause_all_vcpus', 'phys_map_node_alloc', 'phys_map_node_reserve', 'phys_mem_alloc', @@ -2424,8 +2423,6 @@ symbols = ( 'qemu_clock_ptr', 'qemu_clocks', 'qemu_cond_destroy', - 'qemu_cpu_is_self', - 'qemu_cpu_kick_thread', 'qemu_daemon', 'qemu_event_destroy', 'qemu_event_init', @@ -2522,9 +2519,7 @@ symbols = ( 'qemu_st_helpers', 'qemu_strnlen', 'qemu_strsep', - 'qemu_tcg_cpu_thread_fn', 'qemu_tcg_init_vcpu', - 'qemu_thread_exit', 'qemu_try_memalign', 'qentry_destroy', 'qerror_human', diff --git a/qemu/hw/intc/apic.c b/qemu/hw/intc/apic.c index e58d742b..1f89770e 100644 --- a/qemu/hw/intc/apic.c +++ b/qemu/hw/intc/apic.c @@ -70,7 +70,6 @@ static void apic_sync_vapic(APICCommonState *s, int sync_type) //length = offsetof(VAPICState, enabled) - offsetof(VAPICState, isr); if (sync_type & SYNC_TO_VAPIC) { - assert(qemu_cpu_is_self(CPU(s->cpu))); vapic_state.tpr = s->tpr; vapic_state.enabled = 1; diff --git a/qemu/include/qemu/main-loop.h b/qemu/include/qemu/main-loop.h deleted file mode 100644 index 2f196e1b..00000000 --- a/qemu/include/qemu/main-loop.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * QEMU System Emulator - * - * Copyright (c) 2003-2008 Fabrice Bellard - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef QEMU_MAIN_LOOP_H -#define QEMU_MAIN_LOOP_H 1 - -#define SIG_IPI SIGUSR1 - -struct uc_struct; - -/** - * qemu_init_main_loop: Set up the process so that it can run the main loop. - * - * This includes setting up signal handlers. It should be called before - * any other threads are created. In addition, threads other than the - * main one should block signals that are trapped by the main loop. - * For simplicity, you can consider these signals to be safe: SIGUSR1, - * SIGUSR2, thread signals (SIGFPE, SIGILL, SIGSEGV, SIGBUS) and real-time - * signals if available. Remember that Windows in practice does not have - * signals, though. - * - * In the case of QEMU tools, this will also start/initialize timers. - */ -int qemu_init_main_loop(void); - -/** - * qemu_mutex_lock_iothread: Lock the main loop mutex. - * - * This function locks the main loop mutex. The mutex is taken by - * qemu_init_main_loop and always taken except while waiting on - * external events (such as with select). The mutex should be taken - * by threads other than the main loop thread when calling - * qemu_bh_new(), qemu_set_fd_handler() and basically all other - * functions documented in this file. - * - * NOTE: tools currently are single-threaded and qemu_mutex_lock_iothread - * is a no-op there. - */ -void qemu_mutex_lock_iothread(struct uc_struct* uc); - -/** - * qemu_mutex_unlock_iothread: Unlock the main loop mutex. - * - * This function unlocks the main loop mutex. The mutex is taken by - * qemu_init_main_loop and always taken except while waiting on - * external events (such as with select). The mutex should be unlocked - * as soon as possible by threads other than the main loop thread, - * because it prevents the main loop from processing callbacks, - * including timers and bottom halves. - * - * NOTE: tools currently are single-threaded and qemu_mutex_unlock_iothread - * is a no-op there. - */ -void qemu_mutex_unlock_iothread(struct uc_struct* uc); - -#endif diff --git a/qemu/include/qemu/osdep.h b/qemu/include/qemu/osdep.h index 256bb011..9e4c7403 100644 --- a/qemu/include/qemu/osdep.h +++ b/qemu/include/qemu/osdep.h @@ -183,7 +183,6 @@ int qemu_close(int fd); #endif int qemu_create_pidfile(const char *filename); -int qemu_get_thread_id(void); #ifdef _WIN32 static inline void qemu_timersub(const struct timeval *val1, diff --git a/qemu/include/qemu/thread.h b/qemu/include/qemu/thread.h index 2a402673..67e893e1 100644 --- a/qemu/include/qemu/thread.h +++ b/qemu/include/qemu/thread.h @@ -58,8 +58,6 @@ int qemu_thread_create(struct uc_struct *uc, QemuThread *thread, const char *nam void *(*start_routine)(void *), void *arg, int mode); void *qemu_thread_join(QemuThread *thread); -void qemu_thread_get_self(struct uc_struct *uc, QemuThread *thread); -bool qemu_thread_is_self(QemuThread *thread); void qemu_thread_exit(struct uc_struct *uc, void *retval); #endif diff --git a/qemu/include/qom/cpu.h b/qemu/include/qom/cpu.h index fb666d1e..08cb6ba7 100644 --- a/qemu/include/qom/cpu.h +++ b/qemu/include/qom/cpu.h @@ -436,16 +436,6 @@ static inline bool cpu_has_work(CPUState *cpu) return cc->has_work(cpu); } -/** - * qemu_cpu_is_self: - * @cpu: The vCPU to check against. - * - * Checks whether the caller is executing on the vCPU thread. - * - * Returns: %true if called from @cpu's thread, %false otherwise. - */ -bool qemu_cpu_is_self(CPUState *cpu); - /** * qemu_cpu_kick: * @cpu: The vCPU to kick. diff --git a/qemu/include/sysemu/cpus.h b/qemu/include/sysemu/cpus.h index f22ad69d..72e1deec 100644 --- a/qemu/include/sysemu/cpus.h +++ b/qemu/include/sysemu/cpus.h @@ -6,7 +6,6 @@ struct uc_struct; /* cpus.c */ void qemu_init_cpu_loop(struct uc_struct*); int resume_all_vcpus(struct uc_struct*); -void pause_all_vcpus(struct uc_struct*); void cpu_stop_current(struct uc_struct*); void cpu_synchronize_all_states(void); diff --git a/qemu/include/sysemu/iothread.h b/qemu/include/sysemu/iothread.h deleted file mode 100644 index 7c01a61d..00000000 --- a/qemu/include/sysemu/iothread.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Event loop thread - * - * Copyright Red Hat Inc., 2013 - * - * Authors: - * Stefan Hajnoczi - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - * - */ - -#ifndef IOTHREAD_H -#define IOTHREAD_H - -#include "block/aio.h" -#include "qemu/thread.h" - -#define TYPE_IOTHREAD "iothread" - -typedef struct { - Object parent_obj; - - QemuThread thread; - AioContext *ctx; - QemuMutex init_done_lock; - QemuCond init_done_cond; /* is thread initialization done? */ - bool stopping; - int thread_id; -} IOThread; - -#define IOTHREAD(obj) \ - OBJECT_CHECK(IOThread, obj, TYPE_IOTHREAD) - -IOThread *iothread_find(const char *id); -char *iothread_get_id(IOThread *iothread); -AioContext *iothread_get_aio_context(IOThread *iothread); - -#endif /* IOTHREAD_H */ diff --git a/qemu/include/sysemu/sysemu.h b/qemu/include/sysemu/sysemu.h index f2ab6e95..e5c93292 100644 --- a/qemu/include/sysemu/sysemu.h +++ b/qemu/include/sysemu/sysemu.h @@ -2,8 +2,6 @@ #define SYSEMU_H /* Misc. things related to the system emulator. */ -#include "qemu/main-loop.h" - #include "qemu/timer.h" #include "qapi/error.h" diff --git a/qemu/m68k.h b/qemu/m68k.h index 8e41d569..a26f88a6 100644 --- a/qemu/m68k.h +++ b/qemu/m68k.h @@ -2258,7 +2258,6 @@ #define parse_value parse_value_m68k #define par_write par_write_m68k #define patch_reloc patch_reloc_m68k -#define pause_all_vcpus pause_all_vcpus_m68k #define phys_map_node_alloc phys_map_node_alloc_m68k #define phys_map_node_reserve phys_map_node_reserve_m68k #define phys_mem_alloc phys_mem_alloc_m68k @@ -2418,8 +2417,6 @@ #define qemu_clock_ptr qemu_clock_ptr_m68k #define qemu_clocks qemu_clocks_m68k #define qemu_cond_destroy qemu_cond_destroy_m68k -#define qemu_cpu_is_self qemu_cpu_is_self_m68k -#define qemu_cpu_kick_thread qemu_cpu_kick_thread_m68k #define qemu_daemon qemu_daemon_m68k #define qemu_event_destroy qemu_event_destroy_m68k #define qemu_event_init qemu_event_init_m68k @@ -2516,9 +2513,7 @@ #define qemu_st_helpers qemu_st_helpers_m68k #define qemu_strnlen qemu_strnlen_m68k #define qemu_strsep qemu_strsep_m68k -#define qemu_tcg_cpu_thread_fn qemu_tcg_cpu_thread_fn_m68k #define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_m68k -#define qemu_thread_exit qemu_thread_exit_m68k #define qemu_try_memalign qemu_try_memalign_m68k #define qentry_destroy qentry_destroy_m68k #define qerror_human qerror_human_m68k diff --git a/qemu/main-loop.c b/qemu/main-loop.c deleted file mode 100644 index bb7c3d02..00000000 --- a/qemu/main-loop.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * QEMU System Emulator - * - * Copyright (c) 2003-2008 Fabrice Bellard - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -/* Modified for Unicorn Engine by Nguyen Anh Quynh, 2015 */ - -#include "qemu-common.h" -#include "qemu/timer.h" -#include "qemu/main-loop.h" -#include "qemu/thread.h" -#include "qom/cpu.h" - -#include "uc_priv.h" - -#ifndef _WIN32 -#endif - -static void qemu_cpu_kick_thread(CPUState *cpu); - -void qemu_mutex_lock_iothread(struct uc_struct* uc) -{ - if (!uc->tcg_enabled(uc)) { // arch-dependent - qemu_mutex_lock(&uc->qemu_global_mutex); - } else { - if (qemu_mutex_trylock(&uc->qemu_global_mutex)) { - qemu_cpu_kick_thread(first_cpu); - qemu_mutex_lock(&uc->qemu_global_mutex); - } - } -} - -void qemu_mutex_unlock_iothread(struct uc_struct* uc) -{ - qemu_mutex_unlock(&uc->qemu_global_mutex); -} - -static void qemu_cpu_kick_thread(CPUState *cpu) -{ -#ifndef _WIN32 - int err; - - err = pthread_kill(cpu->thread->thread, SIG_IPI); - if (err) { - fprintf(stderr, "qemu:%s: %s", __func__, strerror(err)); - exit(1); - } -#else /* _WIN32 */ - if (!qemu_thread_is_self(cpu->thread)) { - CONTEXT tcgContext; - - if (SuspendThread(cpu->hThread) == (DWORD)-1) { - fprintf(stderr, "qemu:%s: GetLastError:%lu\n", __func__, - GetLastError()); - exit(1); - } - - /* On multi-core systems, we are not sure that the thread is actually - * suspended until we can get the context. - */ - tcgContext.ContextFlags = CONTEXT_CONTROL; - while (GetThreadContext(cpu->hThread, &tcgContext) != 0) { - continue; - } - - // FIXME(danghvu): anysignal ? - // cpu_signal(0); - - if (ResumeThread(cpu->hThread) == (DWORD)-1) { - fprintf(stderr, "qemu:%s: GetLastError:%lu\n", __func__, - GetLastError()); - exit(1); - } - } -#endif -} - - -#if 0 -static int qemu_signal_init(void) -{ - sigset_t set; - - /* - * SIG_IPI must be blocked in the main thread and must not be caught - * by sigwait() in the signal thread. Otherwise, the cpu thread will - * not catch it reliably. - */ - sigemptyset(&set); - sigaddset(&set, SIG_IPI); - sigaddset(&set, SIGIO); - sigaddset(&set, SIGALRM); - sigaddset(&set, SIGBUS); - /* SIGINT cannot be handled via signalfd, so that ^C can be used - * to interrupt QEMU when it is being run under gdb. SIGHUP and - * SIGTERM are also handled asynchronously, even though it is not - * strictly necessary, because they use the same handler as SIGINT. - */ - pthread_sigmask(SIG_BLOCK, &set, NULL); - - sigdelset(&set, SIG_IPI); - return 0; -} -#endif - -/* -static int qemu_signal_init(void) -{ - return 0; -}*/ - -/* -static int qemu_init_main_loop(void) -{ - init_clocks(); - - return qemu_signal_init(); -}*/ - - diff --git a/qemu/mips.h b/qemu/mips.h index 0861ed05..32ef4c00 100644 --- a/qemu/mips.h +++ b/qemu/mips.h @@ -2258,7 +2258,6 @@ #define parse_value parse_value_mips #define par_write par_write_mips #define patch_reloc patch_reloc_mips -#define pause_all_vcpus pause_all_vcpus_mips #define phys_map_node_alloc phys_map_node_alloc_mips #define phys_map_node_reserve phys_map_node_reserve_mips #define phys_mem_alloc phys_mem_alloc_mips @@ -2418,8 +2417,6 @@ #define qemu_clock_ptr qemu_clock_ptr_mips #define qemu_clocks qemu_clocks_mips #define qemu_cond_destroy qemu_cond_destroy_mips -#define qemu_cpu_is_self qemu_cpu_is_self_mips -#define qemu_cpu_kick_thread qemu_cpu_kick_thread_mips #define qemu_daemon qemu_daemon_mips #define qemu_event_destroy qemu_event_destroy_mips #define qemu_event_init qemu_event_init_mips @@ -2516,9 +2513,7 @@ #define qemu_st_helpers qemu_st_helpers_mips #define qemu_strnlen qemu_strnlen_mips #define qemu_strsep qemu_strsep_mips -#define qemu_tcg_cpu_thread_fn qemu_tcg_cpu_thread_fn_mips #define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_mips -#define qemu_thread_exit qemu_thread_exit_mips #define qemu_try_memalign qemu_try_memalign_mips #define qentry_destroy qentry_destroy_mips #define qerror_human qerror_human_mips diff --git a/qemu/mips64.h b/qemu/mips64.h index be1a4b4c..67fbd77f 100644 --- a/qemu/mips64.h +++ b/qemu/mips64.h @@ -2258,7 +2258,6 @@ #define parse_value parse_value_mips64 #define par_write par_write_mips64 #define patch_reloc patch_reloc_mips64 -#define pause_all_vcpus pause_all_vcpus_mips64 #define phys_map_node_alloc phys_map_node_alloc_mips64 #define phys_map_node_reserve phys_map_node_reserve_mips64 #define phys_mem_alloc phys_mem_alloc_mips64 @@ -2418,8 +2417,6 @@ #define qemu_clock_ptr qemu_clock_ptr_mips64 #define qemu_clocks qemu_clocks_mips64 #define qemu_cond_destroy qemu_cond_destroy_mips64 -#define qemu_cpu_is_self qemu_cpu_is_self_mips64 -#define qemu_cpu_kick_thread qemu_cpu_kick_thread_mips64 #define qemu_daemon qemu_daemon_mips64 #define qemu_event_destroy qemu_event_destroy_mips64 #define qemu_event_init qemu_event_init_mips64 @@ -2516,9 +2513,7 @@ #define qemu_st_helpers qemu_st_helpers_mips64 #define qemu_strnlen qemu_strnlen_mips64 #define qemu_strsep qemu_strsep_mips64 -#define qemu_tcg_cpu_thread_fn qemu_tcg_cpu_thread_fn_mips64 #define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_mips64 -#define qemu_thread_exit qemu_thread_exit_mips64 #define qemu_try_memalign qemu_try_memalign_mips64 #define qentry_destroy qentry_destroy_mips64 #define qerror_human qerror_human_mips64 diff --git a/qemu/mips64el.h b/qemu/mips64el.h index 9e144d9b..a97749fe 100644 --- a/qemu/mips64el.h +++ b/qemu/mips64el.h @@ -2258,7 +2258,6 @@ #define parse_value parse_value_mips64el #define par_write par_write_mips64el #define patch_reloc patch_reloc_mips64el -#define pause_all_vcpus pause_all_vcpus_mips64el #define phys_map_node_alloc phys_map_node_alloc_mips64el #define phys_map_node_reserve phys_map_node_reserve_mips64el #define phys_mem_alloc phys_mem_alloc_mips64el @@ -2418,8 +2417,6 @@ #define qemu_clock_ptr qemu_clock_ptr_mips64el #define qemu_clocks qemu_clocks_mips64el #define qemu_cond_destroy qemu_cond_destroy_mips64el -#define qemu_cpu_is_self qemu_cpu_is_self_mips64el -#define qemu_cpu_kick_thread qemu_cpu_kick_thread_mips64el #define qemu_daemon qemu_daemon_mips64el #define qemu_event_destroy qemu_event_destroy_mips64el #define qemu_event_init qemu_event_init_mips64el @@ -2516,9 +2513,7 @@ #define qemu_st_helpers qemu_st_helpers_mips64el #define qemu_strnlen qemu_strnlen_mips64el #define qemu_strsep qemu_strsep_mips64el -#define qemu_tcg_cpu_thread_fn qemu_tcg_cpu_thread_fn_mips64el #define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_mips64el -#define qemu_thread_exit qemu_thread_exit_mips64el #define qemu_try_memalign qemu_try_memalign_mips64el #define qentry_destroy qentry_destroy_mips64el #define qerror_human qerror_human_mips64el diff --git a/qemu/mipsel.h b/qemu/mipsel.h index 8fb00f62..dced0f85 100644 --- a/qemu/mipsel.h +++ b/qemu/mipsel.h @@ -2258,7 +2258,6 @@ #define parse_value parse_value_mipsel #define par_write par_write_mipsel #define patch_reloc patch_reloc_mipsel -#define pause_all_vcpus pause_all_vcpus_mipsel #define phys_map_node_alloc phys_map_node_alloc_mipsel #define phys_map_node_reserve phys_map_node_reserve_mipsel #define phys_mem_alloc phys_mem_alloc_mipsel @@ -2418,8 +2417,6 @@ #define qemu_clock_ptr qemu_clock_ptr_mipsel #define qemu_clocks qemu_clocks_mipsel #define qemu_cond_destroy qemu_cond_destroy_mipsel -#define qemu_cpu_is_self qemu_cpu_is_self_mipsel -#define qemu_cpu_kick_thread qemu_cpu_kick_thread_mipsel #define qemu_daemon qemu_daemon_mipsel #define qemu_event_destroy qemu_event_destroy_mipsel #define qemu_event_init qemu_event_init_mipsel @@ -2516,9 +2513,7 @@ #define qemu_st_helpers qemu_st_helpers_mipsel #define qemu_strnlen qemu_strnlen_mipsel #define qemu_strsep qemu_strsep_mipsel -#define qemu_tcg_cpu_thread_fn qemu_tcg_cpu_thread_fn_mipsel #define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_mipsel -#define qemu_thread_exit qemu_thread_exit_mipsel #define qemu_try_memalign qemu_try_memalign_mipsel #define qentry_destroy qentry_destroy_mipsel #define qerror_human qerror_human_mipsel diff --git a/qemu/powerpc.h b/qemu/powerpc.h index 5d2f53f2..1e46c3b4 100644 --- a/qemu/powerpc.h +++ b/qemu/powerpc.h @@ -2418,7 +2418,6 @@ #define qemu_clock_ptr qemu_clock_ptr_powerpc #define qemu_clocks qemu_clocks_powerpc #define qemu_cond_destroy qemu_cond_destroy_powerpc -#define qemu_cpu_is_self qemu_cpu_is_self_powerpc #define qemu_cpu_kick_thread qemu_cpu_kick_thread_powerpc #define qemu_daemon qemu_daemon_powerpc #define qemu_event_destroy qemu_event_destroy_powerpc @@ -2516,7 +2515,6 @@ #define qemu_st_helpers qemu_st_helpers_powerpc #define qemu_strnlen qemu_strnlen_powerpc #define qemu_strsep qemu_strsep_powerpc -#define qemu_tcg_cpu_thread_fn qemu_tcg_cpu_thread_fn_powerpc #define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_powerpc #define qemu_thread_exit qemu_thread_exit_powerpc #define qemu_try_memalign qemu_try_memalign_powerpc diff --git a/qemu/sparc.h b/qemu/sparc.h index cf04547f..637911c2 100644 --- a/qemu/sparc.h +++ b/qemu/sparc.h @@ -2258,7 +2258,6 @@ #define parse_value parse_value_sparc #define par_write par_write_sparc #define patch_reloc patch_reloc_sparc -#define pause_all_vcpus pause_all_vcpus_sparc #define phys_map_node_alloc phys_map_node_alloc_sparc #define phys_map_node_reserve phys_map_node_reserve_sparc #define phys_mem_alloc phys_mem_alloc_sparc @@ -2418,8 +2417,6 @@ #define qemu_clock_ptr qemu_clock_ptr_sparc #define qemu_clocks qemu_clocks_sparc #define qemu_cond_destroy qemu_cond_destroy_sparc -#define qemu_cpu_is_self qemu_cpu_is_self_sparc -#define qemu_cpu_kick_thread qemu_cpu_kick_thread_sparc #define qemu_daemon qemu_daemon_sparc #define qemu_event_destroy qemu_event_destroy_sparc #define qemu_event_init qemu_event_init_sparc @@ -2516,9 +2513,7 @@ #define qemu_st_helpers qemu_st_helpers_sparc #define qemu_strnlen qemu_strnlen_sparc #define qemu_strsep qemu_strsep_sparc -#define qemu_tcg_cpu_thread_fn qemu_tcg_cpu_thread_fn_sparc #define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_sparc -#define qemu_thread_exit qemu_thread_exit_sparc #define qemu_try_memalign qemu_try_memalign_sparc #define qentry_destroy qentry_destroy_sparc #define qerror_human qerror_human_sparc diff --git a/qemu/sparc64.h b/qemu/sparc64.h index 2195b1d6..57b3b4fe 100644 --- a/qemu/sparc64.h +++ b/qemu/sparc64.h @@ -2258,7 +2258,6 @@ #define parse_value parse_value_sparc64 #define par_write par_write_sparc64 #define patch_reloc patch_reloc_sparc64 -#define pause_all_vcpus pause_all_vcpus_sparc64 #define phys_map_node_alloc phys_map_node_alloc_sparc64 #define phys_map_node_reserve phys_map_node_reserve_sparc64 #define phys_mem_alloc phys_mem_alloc_sparc64 @@ -2418,8 +2417,6 @@ #define qemu_clock_ptr qemu_clock_ptr_sparc64 #define qemu_clocks qemu_clocks_sparc64 #define qemu_cond_destroy qemu_cond_destroy_sparc64 -#define qemu_cpu_is_self qemu_cpu_is_self_sparc64 -#define qemu_cpu_kick_thread qemu_cpu_kick_thread_sparc64 #define qemu_daemon qemu_daemon_sparc64 #define qemu_event_destroy qemu_event_destroy_sparc64 #define qemu_event_init qemu_event_init_sparc64 @@ -2516,9 +2513,7 @@ #define qemu_st_helpers qemu_st_helpers_sparc64 #define qemu_strnlen qemu_strnlen_sparc64 #define qemu_strsep qemu_strsep_sparc64 -#define qemu_tcg_cpu_thread_fn qemu_tcg_cpu_thread_fn_sparc64 #define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_sparc64 -#define qemu_thread_exit qemu_thread_exit_sparc64 #define qemu_try_memalign qemu_try_memalign_sparc64 #define qentry_destroy qentry_destroy_sparc64 #define qerror_human qerror_human_sparc64 diff --git a/qemu/translate-all.c b/qemu/translate-all.c index aec38c7c..12ef2ca7 100644 --- a/qemu/translate-all.c +++ b/qemu/translate-all.c @@ -1531,15 +1531,6 @@ static void tcg_handle_interrupt(CPUState *cpu, int mask) { cpu->interrupt_request |= mask; - /* - * If called from iothread context, wake the target cpu in - * case its halted. - */ - if (!qemu_cpu_is_self(cpu)) { - qemu_cpu_kick(cpu); - return; - } - cpu->tcg_exit_req = 1; } diff --git a/qemu/unicorn_common.h b/qemu/unicorn_common.h index 2df9ccef..d1e00c14 100644 --- a/qemu/unicorn_common.h +++ b/qemu/unicorn_common.h @@ -70,7 +70,6 @@ static inline void uc_common_init(struct uc_struct* uc) uc->tcg_enabled = tcg_enabled; uc->tcg_exec_init = tcg_exec_init; uc->cpu_exec_init_all = cpu_exec_init_all; - uc->pause_all_vcpus = pause_all_vcpus; uc->vm_start = vm_start; uc->memory_map = memory_map; uc->memory_map_ptr = memory_map_ptr; diff --git a/qemu/util/oslib-posix.c b/qemu/util/oslib-posix.c index c936b6e9..49e902f7 100644 --- a/qemu/util/oslib-posix.c +++ b/qemu/util/oslib-posix.c @@ -71,15 +71,6 @@ extern int daemon(int, int); #include #endif -int qemu_get_thread_id(void) -{ -#if defined(__linux__) - return syscall(SYS_gettid); -#else - return getpid(); -#endif -} - int qemu_daemon(int nochdir, int noclose) { return daemon(nochdir, noclose); diff --git a/qemu/util/oslib-win32.c b/qemu/util/oslib-win32.c index eb8409ac..63b60798 100644 --- a/qemu/util/oslib-win32.c +++ b/qemu/util/oslib-win32.c @@ -37,7 +37,6 @@ #include #include "config-host.h" #include "sysemu/sysemu.h" -#include "qemu/main-loop.h" // #include "trace.h" //#include "qemu/sockets.h" @@ -167,11 +166,6 @@ int qemu_gettimeofday(qemu_timeval *tp) return 0; } -int qemu_get_thread_id(void) -{ - return GetCurrentThreadId(); -} - char * qemu_get_local_state_pathname(const char *relative_pathname) { diff --git a/qemu/util/qemu-thread-posix.c b/qemu/util/qemu-thread-posix.c index 6430f929..78bbb75c 100644 --- a/qemu/util/qemu-thread-posix.c +++ b/qemu/util/qemu-thread-posix.c @@ -426,16 +426,6 @@ int qemu_thread_create(struct uc_struct *uc, QemuThread *thread, const char *nam return 0; } -void qemu_thread_get_self(struct uc_struct *uc, QemuThread *thread) -{ - thread->thread = pthread_self(); -} - -bool qemu_thread_is_self(QemuThread *thread) -{ - return pthread_equal(pthread_self(), thread->thread); -} - void qemu_thread_exit(struct uc_struct *uc, void *retval) { pthread_exit(retval); diff --git a/qemu/util/qemu-thread-win32.c b/qemu/util/qemu-thread-win32.c index 2c2cf4ad..1715c037 100644 --- a/qemu/util/qemu-thread-win32.c +++ b/qemu/util/qemu-thread-win32.c @@ -359,12 +359,6 @@ int qemu_thread_create(struct uc_struct *uc, QemuThread *thread, const char *nam return 0; } -void qemu_thread_get_self(struct uc_struct *uc, QemuThread *thread) -{ - thread->data = uc->qemu_thread_data; - thread->tid = GetCurrentThreadId(); -} - HANDLE qemu_thread_get_handle(QemuThread *thread) { QemuThreadData *data; @@ -386,8 +380,3 @@ HANDLE qemu_thread_get_handle(QemuThread *thread) LeaveCriticalSection(&data->cs); return handle; } - -bool qemu_thread_is_self(QemuThread *thread) -{ - return GetCurrentThreadId() == thread->tid; -} diff --git a/qemu/x86_64.h b/qemu/x86_64.h index bbb695e5..e465a0c0 100644 --- a/qemu/x86_64.h +++ b/qemu/x86_64.h @@ -2258,7 +2258,6 @@ #define parse_value parse_value_x86_64 #define par_write par_write_x86_64 #define patch_reloc patch_reloc_x86_64 -#define pause_all_vcpus pause_all_vcpus_x86_64 #define phys_map_node_alloc phys_map_node_alloc_x86_64 #define phys_map_node_reserve phys_map_node_reserve_x86_64 #define phys_mem_alloc phys_mem_alloc_x86_64 @@ -2418,8 +2417,6 @@ #define qemu_clock_ptr qemu_clock_ptr_x86_64 #define qemu_clocks qemu_clocks_x86_64 #define qemu_cond_destroy qemu_cond_destroy_x86_64 -#define qemu_cpu_is_self qemu_cpu_is_self_x86_64 -#define qemu_cpu_kick_thread qemu_cpu_kick_thread_x86_64 #define qemu_daemon qemu_daemon_x86_64 #define qemu_event_destroy qemu_event_destroy_x86_64 #define qemu_event_init qemu_event_init_x86_64 @@ -2516,9 +2513,7 @@ #define qemu_st_helpers qemu_st_helpers_x86_64 #define qemu_strnlen qemu_strnlen_x86_64 #define qemu_strsep qemu_strsep_x86_64 -#define qemu_tcg_cpu_thread_fn qemu_tcg_cpu_thread_fn_x86_64 #define qemu_tcg_init_vcpu qemu_tcg_init_vcpu_x86_64 -#define qemu_thread_exit qemu_thread_exit_x86_64 #define qemu_try_memalign qemu_try_memalign_x86_64 #define qentry_destroy qentry_destroy_x86_64 #define qerror_human qerror_human_x86_64