@@ -627,6 +627,8 @@ int main(int argc, char **argv)
target_cpu_init(env, regs);
+ current_cpu = cpu;
+
if (gdbstub) {
gdbserver_start(gdbstub);
gdb_handlesig(cpu, 0, NULL, NULL, 0);
@@ -1022,6 +1022,8 @@ int main(int argc, char **argv, char **envp)
target_cpu_copy_regs(env, regs);
+ current_cpu = cpu;
+
if (gdbstub) {
if (gdbserver_start(gdbstub) < 0) {
fprintf(stderr, "qemu: could not open gdbserver on %s\n",
@@ -6542,6 +6542,7 @@ static void *clone_func(void *arg)
env = info->env;
cpu = env_cpu(env);
thread_cpu = cpu;
+ current_cpu = cpu;
ts = get_task_state(cpu);
info->tid = sys_gettid();
task_settid(ts);
gdb_handlesig() uses current_cpu. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> --- bsd-user/main.c | 2 ++ linux-user/main.c | 2 ++ linux-user/syscall.c | 1 + 3 files changed, 5 insertions(+)