mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 00:45:40 +00:00
Merge branch 'smaller_nothreads' of https://github.com/cseagle/unicorn into cseagle-smaller_nothreads
This commit is contained in:
commit
47a7bb3c9f
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
83
qemu/cpus.c
83
qemu/cpus.c
|
@ -38,17 +38,13 @@ static void cpu_handle_guest_debug(CPUState *cpu);
|
|||
static int tcg_cpu_exec(struct uc_struct *uc, CPUArchState *env);
|
||||
static bool tcg_exec_all(struct uc_struct* uc);
|
||||
static int qemu_tcg_init_vcpu(CPUState *cpu);
|
||||
static void *qemu_tcg_cpu_thread_fn(void *arg);
|
||||
static void *qemu_tcg_cpu_loop(struct uc_struct *uc);
|
||||
|
||||
int vm_start(struct uc_struct* uc)
|
||||
{
|
||||
if (resume_all_vcpus(uc)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// kick off TCG thread
|
||||
qemu_mutex_unlock_iothread(uc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -59,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;
|
||||
|
@ -99,7 +77,6 @@ int resume_all_vcpus(struct uc_struct *uc)
|
|||
if (qemu_init_vcpu(cpu))
|
||||
return -1;
|
||||
}
|
||||
qemu_mutex_lock_iothread(uc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,6 +84,7 @@ int resume_all_vcpus(struct uc_struct *uc)
|
|||
CPU_FOREACH(cpu) {
|
||||
cpu_resume(cpu);
|
||||
}
|
||||
qemu_tcg_cpu_loop(uc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -116,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);
|
||||
|
@ -125,44 +102,24 @@ int qemu_init_vcpu(CPUState *cpu)
|
|||
}
|
||||
|
||||
|
||||
static void *qemu_tcg_cpu_thread_fn(void *arg)
|
||||
static void *qemu_tcg_cpu_loop(struct uc_struct *uc)
|
||||
{
|
||||
CPUState *cpu = arg;
|
||||
struct uc_struct *uc = cpu->uc;
|
||||
CPUState *cpu;
|
||||
|
||||
//qemu_tcg_init_cpu_signals();
|
||||
qemu_thread_get_self(uc, cpu->thread);
|
||||
|
||||
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);
|
||||
|
||||
/* wait for initial kick-off after machine start */
|
||||
while (QTAILQ_FIRST(&uc->cpus)->stopped) {
|
||||
qemu_cond_wait(uc->tcg_halt_cond, &uc->qemu_global_mutex);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
#if 0
|
||||
int count = 0;
|
||||
if (count < 10) {
|
||||
count++;
|
||||
unsigned int eip = X86_CPU(mycpu)->env.eip;
|
||||
printf(">>> current EIP = %x\n", eip);
|
||||
printf(">>> ECX = %x\n", (unsigned int)X86_CPU(mycpu)->env.regs[R_ECX]);
|
||||
printf(">>> EDX = %x\n", (unsigned int)X86_CPU(mycpu)->env.regs[R_EDX]);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (tcg_exec_all(uc))
|
||||
break;
|
||||
}
|
||||
|
||||
CPU_FOREACH(cpu) {
|
||||
cpu->thread_id = 0;
|
||||
cpu->created = false;
|
||||
}
|
||||
|
||||
|
@ -173,38 +130,16 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
|
|||
|
||||
|
||||
|
||||
/* 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);
|
||||
if (qemu_thread_create(uc, cpu->thread, thread_name, qemu_tcg_cpu_thread_fn,
|
||||
cpu, QEMU_THREAD_JOINABLE))
|
||||
return -1;
|
||||
#ifdef _WIN32
|
||||
cpu->hThread = qemu_thread_get_handle(cpu->thread);
|
||||
#endif
|
||||
while (!cpu->created) {
|
||||
qemu_cond_wait(&uc->qemu_cpu_cond, &uc->qemu_global_mutex);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Event loop thread
|
||||
*
|
||||
* Copyright Red Hat Inc., 2013
|
||||
*
|
||||
* Authors:
|
||||
* Stefan Hajnoczi <stefanha@redhat.com>
|
||||
*
|
||||
* 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 */
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
139
qemu/main-loop.c
139
qemu/main-loop.c
|
@ -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();
|
||||
}*/
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1529,15 +1529,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -71,15 +71,6 @@ extern int daemon(int, int);
|
|||
#include <sys/sysctl.h>
|
||||
#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);
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include <stdlib.h>
|
||||
#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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -123,7 +123,6 @@ int machine_initialize(struct uc_struct *uc)
|
|||
configure_accelerator(current_machine);
|
||||
|
||||
qemu_init_cpu_loop(uc);
|
||||
qemu_mutex_lock_iothread(uc);
|
||||
|
||||
current_machine->cpu_model = NULL;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
7
uc.c
7
uc.c
|
@ -573,14 +573,13 @@ uc_err uc_emu_start(uc_engine* uc, uint64_t begin, uint64_t until, uint64_t time
|
|||
|
||||
uc->addr_end = until;
|
||||
|
||||
if (timeout)
|
||||
enable_emu_timer(uc, timeout * 1000); // microseconds -> nanoseconds
|
||||
|
||||
if (uc->vm_start(uc)) {
|
||||
return UC_ERR_RESOURCE;
|
||||
}
|
||||
|
||||
if (timeout)
|
||||
enable_emu_timer(uc, timeout * 1000); // microseconds -> nanoseconds
|
||||
|
||||
uc->pause_all_vcpus(uc);
|
||||
// emulation is done
|
||||
uc->emulation_done = true;
|
||||
|
||||
|
|
Loading…
Reference in a new issue