[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/3] cpu: Set current_cpu early in qemu-user
From: |
Ilya Leoshkevich |
Subject: |
[PATCH 1/3] cpu: Set current_cpu early in qemu-user |
Date: |
Mon, 13 Jan 2025 14:36:27 +0100 |
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(+)
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 0a5bc578365..aa052e515c9 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -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);
diff --git a/linux-user/main.c b/linux-user/main.c
index b97634a32dd..b2bf0688617 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -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",
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 78c7c0b34ef..a101f177632 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -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);
--
2.47.1